main
dplimin 2023-12-19 15:15:10 +03:00
parent 2c8a744b88
commit 11a3f88c67
8 changed files with 611 additions and 136 deletions

View File

@ -18,9 +18,9 @@ void CustomComboBox::enterEvent(QEnterEvent * event)
this->setStyleSheet("QComboBox { background-color : black; color : green; "
"}QComboBox:editable {"
" background: black; selection-background-color: black;}"
" background: black; selection-background-color: black; color : green; selection-color: green;}"
"QComboBox QAbstractItemView {"
" selection-background-color: black;}"
" selection-background-color: black; selection-color: green;}"
);
emit focused();

View File

@ -20,7 +20,7 @@ typedef enum { Hp0_2 = 0, Hp0_3, Hp1, Hp2, Hp10 } typeIFV;
typedef enum { Lp200 = 0, Lp500, Lp1000, Lp5000, Lp10000, Lp20000, Lp50000, Lp100000 } typeIFN;
typedef enum { Ch1 = 0, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7,
Ch8, Ch9, Ch10, Ch11, Ch12, Ch13, Ch14, Ch15, Ch16 } typeCHANNEL;
typedef enum { Accel = 0, Velocity, Pascal, k_Pascal, M_Pascal, Nython, k_Nuthon, pQ, mV } typeVALUE;
typedef enum { Accel = 0, Velocity, Pascal, k_Pascal, M_Pascal, Nython, k_Nuthon, pQ_mV } typeVALUE;
typedef enum
{
Out_0_0001 = 0,

View File

@ -2,7 +2,7 @@
ModbusOverUdp::ModbusOverUdp(QObject *parent) : QObject(parent)
{timer= new QTimer();
timer->setInterval(1000);
timer->setInterval(300);
connect(timer,SIGNAL(timeout()),this,SLOT(timeout()));
timer->start();
@ -11,16 +11,23 @@ ModbusOverUdp::ModbusOverUdp(QObject *parent) : QObject(parent)
void ModbusOverUdp::timeout()
{
{static int count;
if(!isConnected) count=0;
if(isConnected){//запросы по всем фронтам
/*
for(quint16 i=1; i<=4; i++){
req(i,SENS);
req(i,STATE);
}
*/
if(count<4)count++;
else count=1;
req(count,SENS);
req(count,STATE);
}
}
@ -38,13 +45,29 @@ uint16_t crc = 0xFFFF;
uint16_t ModbusOverUdp::Crc16(uint16_t len, QByteArray iobuf) //CRC для сообщения такой то длинны /Len - начало контрольной сумимы
{
uint16_t i;
uint16_t crc = 0xFFFF;
for(i = 0; i < len; i++) {
crc = (crc >> 8) ^ Crc16Table[(crc & 0xFF) ^ (iobuf[i] & 0xFF)]; // ввел маску 0xFF, тк прилетает 0хFFFFFFxx
if(iobuf.size()>len +2){qDebug()<<"немного великоват"; return 0;}
if(iobuf.size()==0){qDebug()<<"нулевой размер массива";}
if(len==0){qDebug()<<"нулевая длинна";}
uint16_t crc = 0xFFFF;
try{
for(uint16_t i = 0; i < len; i++) {
if(iobuf.size()<i){qDebug()<<"немного великоват"; return 0;};
crc = (crc >> 8) ^ Crc16Table[(crc & 0xFF) ^ (iobuf.at(i) & 0xFF)]; // ввел маску 0xFF, тк прилетает 0хFFFFFFxx
}
}
catch(const char* error_message){
qDebug()<<error_message;
}
return crc;
}
@ -52,20 +75,37 @@ void ModbusOverUdp::readPendingDatagrams()
{
while (udpSocket->hasPendingDatagrams()) {
QNetworkDatagram datagram = udpSocket->receiveDatagram();
QByteArray recived = datagram.data(); // копируем датаграмку в аррэй для удобной работы
qDebug()<<"прибыл размером"<<recived.size();
if (recived.size()<5){
qDebug()<<"маленький пакет"; return;
};
if (!(recived.size()==recived[2]+5)){
qDebug()<<"не попал в размер"; return;
};
int indNachalaCrc = recived[2]+3;
uint16_t crcRecived = Crc16(indNachalaCrc, recived); // в функции используют больше или меньше
if((recived[indNachalaCrc]&0xFF)==LO(crcRecived)&&(recived[indNachalaCrc+1]&0xFF)==HI(crcRecived)){ //todo внимание костыль
//qDebug()<<"CRC Ок ";
// qDebug()<<"CRC Ок "; //это работает слишком часто
}else{
qDebug()<<"CRC не катит";
qDebug()<<"CRC не катит ожидалось"<<(recived[indNachalaCrc]&0xFF)<<(recived[indNachalaCrc+1]&0xFF)<<"пришло"<<HI(crcRecived)<<LO(crcRecived);
return;
}
processTheDatagram(datagram);
}
@ -111,7 +151,7 @@ void ModbusOverUdp::processTheDatagram(QNetworkDatagram & datagram)
if((int)recived[6]>5) return;
if((int)recived[8]>7) return;
if((int)recived[10]>12) return;
if((int)recived[22]>3) return;
if((int)recived[22]>7) return;
toSend.IIN=(typeIIN)(recived[4]-0);
toSend.IFV=(typeIFV)(recived[6]-0);

View File

@ -57,9 +57,11 @@ public:
0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
};
explicit ModbusOverUdp(QObject *parent = nullptr);
void sendPendingDatagrams(QByteArray &data);
uint16_t Crc16(uint16_t len, QByteArray iobuf);
uint16_t Crc16(uint16_t len, uint16_t iobuf[]);

View File

@ -25,6 +25,16 @@ windowChannel::windowChannel(QWidget *parent) :
this->setPalette(pal);
this->show();
//прменяю цвета так, потому что когда окно не активно цвета становятся черным
ui->label_2->setStyleSheet("QLabel { color : white;} ");
ui->label_3->setStyleSheet("QLabel { color : white;} ");
ui->label_4->setStyleSheet("QLabel { color : white;} ");
ui->label_6->setStyleSheet("QLabel { color : white;} ");
ui->labelSENS->setStyleSheet("QLabel { color : #ffff00;} ");
ui->labelUNITS->setStyleSheet("QLabel { color : #ffff00;} ");
ui->labelIIN->setStyleSheet("QLabel { color : #55ffff;} ");
ui->comboBoxVCH->addItem("0.2Гц"); //индекс 0
@ -171,17 +181,13 @@ void windowChannel::reDraw()
if(thisData.IIN==ICP&&thisData.VALUE==k_Nuthon)
ui->labelUNITS->setText("мВ/кН");
if(thisData.IIN==CHARGE&&thisData.VALUE==pQ)
if(thisData.IIN==CHARGE&&thisData.VALUE==pQ_mV)
ui->labelUNITS->setText("пКл/мВ");
if(thisData.IIN==ICP&&thisData.VALUE==pQ)
if(thisData.IIN==ICP&&thisData.VALUE==pQ_mV)
ui->labelUNITS->setText("мВ/мВ");
if(thisData.IIN==CHARGE&&thisData.VALUE==mV)
ui->labelUNITS->setText("пКл/пКл");
if(thisData.IIN==ICP&&thisData.VALUE==mV)
ui->labelUNITS->setText("мВ/пКл");
//выставляем значение комбобоксов
@ -193,7 +199,7 @@ void windowChannel::reDraw()
}
case CHARGE:{
ui->labelIIN->setText("IE");
ui->labelIIN->setText("PE");
break;
}
}//end switch
@ -327,39 +333,45 @@ typeIKU windowChannel::maxGain(Set Data) //сверяет гейн на доп
else
if(/*sens >= 0.0011f && */Data.SENS <= 10.000f) //0.002
maxGain= Ku1000;
else
if(/*sens >= 10.001f && */Data.SENS <= 20.000f) //20
maxGain= Ku500;
else
if(/*sens >= 20.001f && */Data.SENS <= 50.000f) //50
maxGain= Ku200;
//else
//if(/*sens >= 10.001f && */Data.SENS <= 20.000f) //20
//maxGain= Ku500;
//else
//if(/*sens >= 20.001f && */Data.SENS <= 50.000f) //50
//maxGain= Ku200;
else
if(/*sens >= 50.001f && */Data.SENS <= 100.00f) //100
maxGain= Ku100;
else
if(/*sens >= 100.01f && */Data.SENS <= 200.00f) //200
maxGain= Ku50;
else
if(/*sens >= 200.01f && */Data.SENS <= 500.00f) //500
maxGain= Ku20;
//else
//if(/*sens >= 100.01f && */Data.SENS <= 200.00f) //200
//maxGain= Ku50;
// else
//if(/*sens >= 200.01f && */Data.SENS <= 500.00f) //500
//maxGain= Ku20;
else
if(/*sens >= 500.01f && */Data.SENS <= 1000.0f) //1000
maxGain= Ku10;
else
if(/*sens >= 1000.01f && */Data.SENS <= 2000.0f) //2000
maxGain= Ku5;
else
if(/*sens >= 2000.01f && */Data.SENS <= 5000.0f) //5000
maxGain= Ku2;
//else
//if(/*sens >= 1000.01f && */Data.SENS <= 2000.0f) //2000
//maxGain= Ku5;
//else
//if(/*sens >= 2000.01f && */Data.SENS <= 5000.0f) //5000
//maxGain= Ku2;
else
if(/*sens >= 5000.01f && */Data.SENS <= 10000.0f) //10000
maxGain= Ku1;
else
if(/*sens >= 10001.0f && */Data.SENS <= 20000.0f) //20000
maxGain= Ku0_5;
else
if(/*sens >= 20001.0f && */Data.SENS <= 50000.0f) //50000
maxGain= Ku0_2;
// else
//if(/*sens >= 10001.0f && */Data.SENS <= 20000.0f) //20000
//maxGain= Ku0_5;
//else
//if(/*sens >= 20001.0f && */Data.SENS <= 50000.0f) //50000
//maxGain= Ku0_2;
else
if(Data.SENS < 100000.0f) //99999
maxGain= Ku0_1;
@ -380,16 +392,19 @@ typeIKU windowChannel::VerifyGainA142(Set Data) //сверяет гейн на
Data.IKU = Ku1000;
}
}
else
if(/*sens >= 0.0011f && */Data.SENS <= 10.000f) //0.002
if(Data.SENS <= 10.000f) //0.002
{
if(Data.IKU > Ku1000)
{
Data.IKU = Ku1000;
}
}
/*
else
if(/*sens >= 10.001f && */Data.SENS <= 20.000f) //20
if(Data.SENS <= 20.000f) //20
{
if(Data.IKU > Ku500)
{
@ -397,23 +412,30 @@ typeIKU windowChannel::VerifyGainA142(Set Data) //сверяет гейн на
}
}
else
if(/*sens >= 20.001f && */Data.SENS <= 50.000f) //50
if(Data.SENS <= 50.000f) //50
{
if(Data.IKU > Ku200)
{
Data.IKU = Ku200;
}
}
*/
else
if(/*sens >= 50.001f && */Data.SENS <= 100.00f) //100
if(Data.SENS <= 100.00f) //100
{
if(Data.IKU > Ku100)
{
Data.IKU = Ku100;
}
}
/*
else
if(/*sens >= 100.01f && */Data.SENS <= 200.00f) //200
if(Data.SENS <= 200.00f) //200
{
if(Data.IKU > Ku50)
{
@ -421,23 +443,27 @@ typeIKU windowChannel::VerifyGainA142(Set Data) //сверяет гейн на
}
}
else
if(/*sens >= 200.01f && */Data.SENS <= 500.00f) //500
if(Data.SENS <= 500.00f) //500
{
if(Data.IKU > Ku20)
{
Data.IKU = Ku20;
}
}
*/
else
if(/*sens >= 500.01f && */Data.SENS <= 1000.0f) //1000
if(Data.SENS <= 1000.0f) //1000
{
if(Data.IKU > Ku10)
{
Data.IKU = Ku10;
}
}
/*
else
if(/*sens >= 1000.01f && */Data.SENS <= 2000.0f) //2000
if(Data.SENS <= 2000.0f) //2000
{
if(Data.IKU > Ku5)
{
@ -445,23 +471,27 @@ typeIKU windowChannel::VerifyGainA142(Set Data) //сверяет гейн на
}
}
else
if(/*sens >= 2000.01f && */Data.SENS <= 5000.0f) //5000
if(Data.SENS <= 5000.0f) //5000
{
if(Data.IKU > Ku2)
{
Data.IKU = Ku2;
}
}
*/
else
if(/*sens >= 5000.01f && */Data.SENS <= 10000.0f) //10000
if(Data.SENS <= 10000.0f) //10000
{
if(Data.IKU > Ku1)
{
Data.IKU = Ku1;
}
}
/*
else
if(/*sens >= 10001.0f && */Data.SENS <= 20000.0f) //20000
if(Data.SENS <= 20000.0f) //20000
{
if(Data.IKU > Ku0_5)
{
@ -469,13 +499,15 @@ typeIKU windowChannel::VerifyGainA142(Set Data) //сверяет гейн на
}
}
else
if(/*sens >= 20001.0f && */Data.SENS <= 50000.0f) //50000
if(Data.SENS <= 50000.0f) //50000
{
if(Data.IKU > Ku0_2)
{
Data.IKU = Ku0_2;
}
}
*/
else
if(Data.SENS < 100000.0f) //99999
{
@ -487,6 +519,7 @@ typeIKU windowChannel::VerifyGainA142(Set Data) //сверяет гейн на
return Data.IKU;
}
QString windowChannel::DisplayIKUA142(float sens, typeIKU iku ,typeVALUE value)
{uint out;
@ -602,16 +635,19 @@ QString windowChannel::DisplayIKUA142(float sens, typeIKU iku ,typeVALUE value)
// qDebug()<<"текущяя строка Ку по списку"<<out;
//qDebug()<<"смещение"<<offset;
qDebug()<<"валуе"<<value;
//qDebug()<<"валуе"<<value;
//этот кусочек смотрит на чувствительность и
//пытается заполнить комбобобокс значениями строк соответствующим индексам КУ
//todo: добавить проверку verify Gain!!!!
ui->comboBoxOUT->clear();
uint16_t maxPlannedOut = offset+13;
//qDebug()<< "max gain"<< thisData.channel<< maxGain(thisData);
for (uint offsetToWork=offset;((offsetToWork<34)&&
(offsetToWork<maxPlannedOut)&&
((maxGain(thisData)+offset)>=offsetToWork)); //проверяем на максиимально возможный для данного сенса
for (uint offsetToWork=offset;((offsetToWork<34)
&&(offsetToWork<maxPlannedOut)
//&&((maxGain(thisData)+offset)>=offsetToWork))
);
//проверяем на максиимально возможный для данного сенса
offsetToWork++) {
@ -895,6 +931,7 @@ QStringList windowChannel::avalibleKuList(Set thisData)
qDebug()<<"стартовый индекс для расчета "<<startIndex;
}
void windowChannel::on_comboBoxOUT_activated(int index)
{
thisData.IKU=(typeIKU)index;

View File

@ -67,6 +67,132 @@
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
@ -78,14 +204,266 @@
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>227</red>
<green>227</green>
<blue>227</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>160</red>
<green>160</green>
<blue>160</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>160</red>
<green>160</green>
<blue>160</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>105</red>
<green>105</green>
<blue>105</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>245</red>
<green>245</green>
<blue>245</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>245</red>
<green>245</green>
<blue>245</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
@ -168,9 +546,9 @@
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
@ -227,9 +605,9 @@
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
@ -253,7 +631,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>131</y>
<y>130</y>
<width>81</width>
<height>31</height>
</rect>
@ -286,9 +664,9 @@
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
@ -345,9 +723,9 @@
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
<red>255</red>
<green>255</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
@ -480,18 +858,18 @@
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
@ -547,9 +925,9 @@
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
<red>255</red>
<green>255</green>
<blue>0</blue>
</color>
</brush>
</colorrole>

View File

@ -37,6 +37,14 @@ WindowChannelSettings::WindowChannelSettings(QWidget *parent) :
thisData.SENS=1.0;
thisData.VALUE=Accel;
ui->label_2->setStyleSheet("QLabel { color : white;} ");
ui->labelChanel->setStyleSheet("QLabel { color : white;} ");
ui->label->setStyleSheet("QLabel { color : white;} ");
ui->labelSENS->setStyleSheet("QLabel { color : #f7e0b5;} ");
ui->labelIIN->setStyleSheet("QLabel { color : #ffff00;} ");
connect(ui->labelSENS,SIGNAL(clicked()),this,SLOT(sendSens()));//подключаю сигнал от кастом лэйбла для вызова процедуры смены чувствительности
ui->comboBoxUNITS->addItem("пКл/м/с2"); //индекс 0
@ -55,8 +63,7 @@ WindowChannelSettings::WindowChannelSettings(QWidget *parent) :
ui->comboBoxUNITS->addItem("мВ/кН"); //индекс 4
ui->comboBoxUNITS->addItem("пКл/мВ");//индекс 5
ui->comboBoxUNITS->addItem("мВ/мВ"); //индекс 6
ui->comboBoxUNITS->addItem("пКл/пКл");//индекс 7
ui->comboBoxUNITS->addItem("мВ/пКл");//индекс 8
hideValue();
@ -86,11 +93,16 @@ void WindowChannelSettings::sendSens()
if (ok){emit ReadyToSend(dataToSend, SENS);}
/*
if(thisData.IKU!=VerifyGainA142(thisData)){
thisData.IKU=VerifyGainA142(thisData);
emit ReadyToSend(thisData, IKU);
};
*/
}
void WindowChannelSettings::setSens(Set data)
@ -156,12 +168,10 @@ void WindowChannelSettings::reDraw()
case k_Nuthon:
ui->comboBoxUNITS->setCurrentIndex(13);
break;
case pQ:
case pQ_mV:
ui->comboBoxUNITS->setCurrentIndex(15);
break;
case mV:
ui->comboBoxUNITS->setCurrentIndex(17);
break;
}
@ -189,19 +199,16 @@ void WindowChannelSettings::reDraw()
case k_Nuthon:
ui->comboBoxUNITS->setCurrentIndex(12);
break;
case pQ:
case pQ_mV:
ui->comboBoxUNITS->setCurrentIndex(14);
break;
case mV:
ui->comboBoxUNITS->setCurrentIndex(16);
break;
}
}
showValue();
}
typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гейн на допусимый прибора при установке сенс
{
@ -214,16 +221,19 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
Data.IKU = Ku1000;
}
}
else
if(/*sens >= 0.0011f && */Data.SENS <= 10.000f) //0.002
if(Data.SENS <= 10.000f) //0.002
{
if(Data.IKU > Ku1000)
{
Data.IKU = Ku1000;
}
}
/*
else
if(/*sens >= 10.001f && */Data.SENS <= 20.000f) //20
if(Data.SENS <= 20.000f) //20
{
if(Data.IKU > Ku500)
{
@ -231,23 +241,30 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
}
}
else
if(/*sens >= 20.001f && */Data.SENS <= 50.000f) //50
if(Data.SENS <= 50.000f) //50
{
if(Data.IKU > Ku200)
{
Data.IKU = Ku200;
}
}
*/
else
if(/*sens >= 50.001f && */Data.SENS <= 100.00f) //100
if(Data.SENS <= 100.00f) //100
{
if(Data.IKU > Ku100)
{
Data.IKU = Ku100;
}
}
/*
else
if(/*sens >= 100.01f && */Data.SENS <= 200.00f) //200
if(Data.SENS <= 200.00f) //200
{
if(Data.IKU > Ku50)
{
@ -255,23 +272,27 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
}
}
else
if(/*sens >= 200.01f && */Data.SENS <= 500.00f) //500
if(Data.SENS <= 500.00f) //500
{
if(Data.IKU > Ku20)
{
Data.IKU = Ku20;
}
}
*/
else
if(/*sens >= 500.01f && */Data.SENS <= 1000.0f) //1000
if(Data.SENS <= 1000.0f) //1000
{
if(Data.IKU > Ku10)
{
Data.IKU = Ku10;
}
}
/*
else
if(/*sens >= 1000.01f && */Data.SENS <= 2000.0f) //2000
if(Data.SENS <= 2000.0f) //2000
{
if(Data.IKU > Ku5)
{
@ -279,23 +300,27 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
}
}
else
if(/*sens >= 2000.01f && */Data.SENS <= 5000.0f) //5000
if(Data.SENS <= 5000.0f) //5000
{
if(Data.IKU > Ku2)
{
Data.IKU = Ku2;
}
}
*/
else
if(/*sens >= 5000.01f && */Data.SENS <= 10000.0f) //10000
if(Data.SENS <= 10000.0f) //10000
{
if(Data.IKU > Ku1)
{
Data.IKU = Ku1;
}
}
/*
else
if(/*sens >= 10001.0f && */Data.SENS <= 20000.0f) //20000
if(Data.SENS <= 20000.0f) //20000
{
if(Data.IKU > Ku0_5)
{
@ -303,13 +328,15 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
}
}
else
if(/*sens >= 20001.0f && */Data.SENS <= 50000.0f) //50000
if(Data.SENS <= 50000.0f) //50000
{
if(Data.IKU > Ku0_2)
{
Data.IKU = Ku0_2;
}
}
*/
else
if(Data.SENS < 100000.0f) //99999
{
@ -321,6 +348,8 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
return Data.IKU;
}
void WindowChannelSettings::on_comboBoxUNITS_activated(int index)
{
if(index==0) {
@ -416,27 +445,16 @@ void WindowChannelSettings::on_comboBoxUNITS_activated(int index)
};
if(index==14) {
thisData.IIN=CHARGE;
thisData.VALUE=pQ;
thisData.VALUE=pQ_mV;
emit ReadyToSend(thisData, IIN);
emit ReadyToSend(thisData, VAL);
}; if(index==15) {
thisData.IIN=ICP;
thisData.VALUE=pQ;
thisData.VALUE=pQ_mV;
emit ReadyToSend(thisData, IIN);
emit ReadyToSend(thisData, VAL);
}; if(index==16) {
thisData.IIN=CHARGE;
thisData.VALUE=mV;
emit ReadyToSend(thisData, IIN);
emit ReadyToSend(thisData, VAL);
}; if(index==17) {
thisData.IIN=ICP;
thisData.VALUE=mV;
emit ReadyToSend(thisData, IIN);
emit ReadyToSend(thisData, VAL);
};

View File

@ -28,8 +28,8 @@
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>19</x>
<y>2</y>
<x>11</x>
<y>1</y>
<width>61</width>
<height>26</height>
</rect>
@ -83,8 +83,8 @@
<widget class="QLabel" name="labelChanel">
<property name="geometry">
<rect>
<x>86</x>
<y>2</y>
<x>78</x>
<y>1</y>
<width>16</width>
<height>26</height>
</rect>
@ -248,9 +248,9 @@
<widget class="CustomComboBox" name="comboBoxUNITS">
<property name="geometry">
<rect>
<x>390</x>
<x>380</x>
<y>-1</y>
<width>111</width>
<width>121</width>
<height>32</height>
</rect>
</property>
@ -263,8 +263,8 @@
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>96</x>
<y>1</y>
<x>88</x>
<y>0</y>
<width>61</width>
<height>26</height>
</rect>
@ -317,16 +317,16 @@
</widget>
</widget>
<customwidgets>
<customwidget>
<class>CustomLabel</class>
<extends>QLabel</extends>
<header>customlabel.h</header>
</customwidget>
<customwidget>
<class>CustomComboBox</class>
<extends>QComboBox</extends>
<header>customcombobox.h</header>
</customwidget>
<customwidget>
<class>CustomLabel</class>
<extends>QLabel</extends>
<header>customlabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>