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; " this->setStyleSheet("QComboBox { background-color : black; color : green; "
"}QComboBox:editable {" "}QComboBox:editable {"
" background: black; selection-background-color: black;}" " background: black; selection-background-color: black; color : green; selection-color: green;}"
"QComboBox QAbstractItemView {" "QComboBox QAbstractItemView {"
" selection-background-color: black;}" " selection-background-color: black; selection-color: green;}"
); );
emit focused(); 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 { Lp200 = 0, Lp500, Lp1000, Lp5000, Lp10000, Lp20000, Lp50000, Lp100000 } typeIFN;
typedef enum { Ch1 = 0, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7, typedef enum { Ch1 = 0, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7,
Ch8, Ch9, Ch10, Ch11, Ch12, Ch13, Ch14, Ch15, Ch16 } typeCHANNEL; 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 typedef enum
{ {
Out_0_0001 = 0, Out_0_0001 = 0,

View File

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

View File

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

View File

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

View File

@ -67,6 +67,132 @@
</color> </color>
</brush> </brush>
</colorrole> </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> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@ -78,14 +204,266 @@
</color> </color>
</brush> </brush>
</colorrole> </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> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>120</red> <red>0</red>
<green>120</green> <green>0</green>
<blue>120</blue> <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> </color>
</brush> </brush>
</colorrole> </colorrole>
@ -168,9 +546,9 @@
<colorrole role="WindowText"> <colorrole role="WindowText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>120</red> <red>0</red>
<green>120</green> <green>0</green>
<blue>120</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
@ -227,9 +605,9 @@
<colorrole role="WindowText"> <colorrole role="WindowText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>120</red> <red>0</red>
<green>120</green> <green>0</green>
<blue>120</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
@ -253,7 +631,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>131</y> <y>130</y>
<width>81</width> <width>81</width>
<height>31</height> <height>31</height>
</rect> </rect>
@ -286,9 +664,9 @@
<colorrole role="WindowText"> <colorrole role="WindowText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>120</red> <red>0</red>
<green>120</green> <green>0</green>
<blue>120</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
@ -345,9 +723,9 @@
<colorrole role="WindowText"> <colorrole role="WindowText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>120</red> <red>255</red>
<green>120</green> <green>255</green>
<blue>120</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
@ -480,18 +858,18 @@
<colorrole role="WindowText"> <colorrole role="WindowText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>120</red> <red>0</red>
<green>120</green> <green>0</green>
<blue>120</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Text"> <colorrole role="Text">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>120</red> <red>0</red>
<green>120</green> <green>0</green>
<blue>120</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
@ -547,9 +925,9 @@
<colorrole role="WindowText"> <colorrole role="WindowText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>120</red> <red>255</red>
<green>120</green> <green>255</green>
<blue>120</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>

View File

@ -37,6 +37,14 @@ WindowChannelSettings::WindowChannelSettings(QWidget *parent) :
thisData.SENS=1.0; thisData.SENS=1.0;
thisData.VALUE=Accel; 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()));//подключаю сигнал от кастом лэйбла для вызова процедуры смены чувствительности connect(ui->labelSENS,SIGNAL(clicked()),this,SLOT(sendSens()));//подключаю сигнал от кастом лэйбла для вызова процедуры смены чувствительности
ui->comboBoxUNITS->addItem("пКл/м/с2"); //индекс 0 ui->comboBoxUNITS->addItem("пКл/м/с2"); //индекс 0
@ -55,8 +63,7 @@ WindowChannelSettings::WindowChannelSettings(QWidget *parent) :
ui->comboBoxUNITS->addItem("мВ/кН"); //индекс 4 ui->comboBoxUNITS->addItem("мВ/кН"); //индекс 4
ui->comboBoxUNITS->addItem("пКл/мВ");//индекс 5 ui->comboBoxUNITS->addItem("пКл/мВ");//индекс 5
ui->comboBoxUNITS->addItem("мВ/мВ"); //индекс 6 ui->comboBoxUNITS->addItem("мВ/мВ"); //индекс 6
ui->comboBoxUNITS->addItem("пКл/пКл");//индекс 7
ui->comboBoxUNITS->addItem("мВ/пКл");//индекс 8
hideValue(); hideValue();
@ -86,11 +93,16 @@ void WindowChannelSettings::sendSens()
if (ok){emit ReadyToSend(dataToSend, SENS);} if (ok){emit ReadyToSend(dataToSend, SENS);}
/*
if(thisData.IKU!=VerifyGainA142(thisData)){ if(thisData.IKU!=VerifyGainA142(thisData)){
thisData.IKU=VerifyGainA142(thisData); thisData.IKU=VerifyGainA142(thisData);
emit ReadyToSend(thisData, IKU); emit ReadyToSend(thisData, IKU);
}; };
*/
} }
void WindowChannelSettings::setSens(Set data) void WindowChannelSettings::setSens(Set data)
@ -156,12 +168,10 @@ void WindowChannelSettings::reDraw()
case k_Nuthon: case k_Nuthon:
ui->comboBoxUNITS->setCurrentIndex(13); ui->comboBoxUNITS->setCurrentIndex(13);
break; break;
case pQ: case pQ_mV:
ui->comboBoxUNITS->setCurrentIndex(15); ui->comboBoxUNITS->setCurrentIndex(15);
break; break;
case mV:
ui->comboBoxUNITS->setCurrentIndex(17);
break;
} }
@ -189,19 +199,16 @@ void WindowChannelSettings::reDraw()
case k_Nuthon: case k_Nuthon:
ui->comboBoxUNITS->setCurrentIndex(12); ui->comboBoxUNITS->setCurrentIndex(12);
break; break;
case pQ: case pQ_mV:
ui->comboBoxUNITS->setCurrentIndex(14); ui->comboBoxUNITS->setCurrentIndex(14);
break; break;
case mV:
ui->comboBoxUNITS->setCurrentIndex(16);
break;
} }
} }
showValue(); showValue();
} }
typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гейн на допусимый прибора при установке сенс typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гейн на допусимый прибора при установке сенс
{ {
@ -214,16 +221,19 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
Data.IKU = Ku1000; Data.IKU = Ku1000;
} }
} }
else else
if(/*sens >= 0.0011f && */Data.SENS <= 10.000f) //0.002 if(Data.SENS <= 10.000f) //0.002
{ {
if(Data.IKU > Ku1000) if(Data.IKU > Ku1000)
{ {
Data.IKU = Ku1000; Data.IKU = Ku1000;
} }
} }
/*
else else
if(/*sens >= 10.001f && */Data.SENS <= 20.000f) //20 if(Data.SENS <= 20.000f) //20
{ {
if(Data.IKU > Ku500) if(Data.IKU > Ku500)
{ {
@ -231,23 +241,30 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
} }
} }
else else
if(/*sens >= 20.001f && */Data.SENS <= 50.000f) //50 if(Data.SENS <= 50.000f) //50
{ {
if(Data.IKU > Ku200) if(Data.IKU > Ku200)
{ {
Data.IKU = Ku200; Data.IKU = Ku200;
} }
} }
*/
else else
if(/*sens >= 50.001f && */Data.SENS <= 100.00f) //100 if(Data.SENS <= 100.00f) //100
{ {
if(Data.IKU > Ku100) if(Data.IKU > Ku100)
{ {
Data.IKU = Ku100; Data.IKU = Ku100;
} }
} }
/*
else else
if(/*sens >= 100.01f && */Data.SENS <= 200.00f) //200 if(Data.SENS <= 200.00f) //200
{ {
if(Data.IKU > Ku50) if(Data.IKU > Ku50)
{ {
@ -255,23 +272,27 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
} }
} }
else else
if(/*sens >= 200.01f && */Data.SENS <= 500.00f) //500 if(Data.SENS <= 500.00f) //500
{ {
if(Data.IKU > Ku20) if(Data.IKU > Ku20)
{ {
Data.IKU = Ku20; Data.IKU = Ku20;
} }
} }
*/
else else
if(/*sens >= 500.01f && */Data.SENS <= 1000.0f) //1000 if(Data.SENS <= 1000.0f) //1000
{ {
if(Data.IKU > Ku10) if(Data.IKU > Ku10)
{ {
Data.IKU = Ku10; Data.IKU = Ku10;
} }
} }
/*
else else
if(/*sens >= 1000.01f && */Data.SENS <= 2000.0f) //2000 if(Data.SENS <= 2000.0f) //2000
{ {
if(Data.IKU > Ku5) if(Data.IKU > Ku5)
{ {
@ -279,23 +300,27 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
} }
} }
else else
if(/*sens >= 2000.01f && */Data.SENS <= 5000.0f) //5000 if(Data.SENS <= 5000.0f) //5000
{ {
if(Data.IKU > Ku2) if(Data.IKU > Ku2)
{ {
Data.IKU = Ku2; Data.IKU = Ku2;
} }
} }
*/
else else
if(/*sens >= 5000.01f && */Data.SENS <= 10000.0f) //10000 if(Data.SENS <= 10000.0f) //10000
{ {
if(Data.IKU > Ku1) if(Data.IKU > Ku1)
{ {
Data.IKU = Ku1; Data.IKU = Ku1;
} }
} }
/*
else else
if(/*sens >= 10001.0f && */Data.SENS <= 20000.0f) //20000 if(Data.SENS <= 20000.0f) //20000
{ {
if(Data.IKU > Ku0_5) if(Data.IKU > Ku0_5)
{ {
@ -303,13 +328,15 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
} }
} }
else else
if(/*sens >= 20001.0f && */Data.SENS <= 50000.0f) //50000 if(Data.SENS <= 50000.0f) //50000
{ {
if(Data.IKU > Ku0_2) if(Data.IKU > Ku0_2)
{ {
Data.IKU = Ku0_2; Data.IKU = Ku0_2;
} }
} }
*/
else else
if(Data.SENS < 100000.0f) //99999 if(Data.SENS < 100000.0f) //99999
{ {
@ -321,6 +348,8 @@ typeIKU WindowChannelSettings::VerifyGainA142(Set Data) //сверяет гей
return Data.IKU; return Data.IKU;
} }
void WindowChannelSettings::on_comboBoxUNITS_activated(int index) void WindowChannelSettings::on_comboBoxUNITS_activated(int index)
{ {
if(index==0) { if(index==0) {
@ -416,28 +445,17 @@ void WindowChannelSettings::on_comboBoxUNITS_activated(int index)
}; };
if(index==14) { if(index==14) {
thisData.IIN=CHARGE; thisData.IIN=CHARGE;
thisData.VALUE=pQ; thisData.VALUE=pQ_mV;
emit ReadyToSend(thisData, IIN); emit ReadyToSend(thisData, IIN);
emit ReadyToSend(thisData, VAL); emit ReadyToSend(thisData, VAL);
}; if(index==15) { }; if(index==15) {
thisData.IIN=ICP; thisData.IIN=ICP;
thisData.VALUE=pQ; thisData.VALUE=pQ_mV;
emit ReadyToSend(thisData, IIN); emit ReadyToSend(thisData, IIN);
emit ReadyToSend(thisData, VAL); 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"> <widget class="QLabel" name="label">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>19</x> <x>11</x>
<y>2</y> <y>1</y>
<width>61</width> <width>61</width>
<height>26</height> <height>26</height>
</rect> </rect>
@ -83,8 +83,8 @@
<widget class="QLabel" name="labelChanel"> <widget class="QLabel" name="labelChanel">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>86</x> <x>78</x>
<y>2</y> <y>1</y>
<width>16</width> <width>16</width>
<height>26</height> <height>26</height>
</rect> </rect>
@ -248,9 +248,9 @@
<widget class="CustomComboBox" name="comboBoxUNITS"> <widget class="CustomComboBox" name="comboBoxUNITS">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>390</x> <x>380</x>
<y>-1</y> <y>-1</y>
<width>111</width> <width>121</width>
<height>32</height> <height>32</height>
</rect> </rect>
</property> </property>
@ -263,8 +263,8 @@
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>96</x> <x>88</x>
<y>1</y> <y>0</y>
<width>61</width> <width>61</width>
<height>26</height> <height>26</height>
</rect> </rect>
@ -317,16 +317,16 @@
</widget> </widget>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>CustomLabel</class>
<extends>QLabel</extends>
<header>customlabel.h</header>
</customwidget>
<customwidget> <customwidget>
<class>CustomComboBox</class> <class>CustomComboBox</class>
<extends>QComboBox</extends> <extends>QComboBox</extends>
<header>customcombobox.h</header> <header>customcombobox.h</header>
</customwidget> </customwidget>
<customwidget>
<class>CustomLabel</class>
<extends>QLabel</extends>
<header>customlabel.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>