Pre-release.
Added: 1) Added check for transition to new speed and parity. 2) Added the ability to stop scanning before polling all addresses. 3) A window has been added that allows you to set the value of multiple registers at once. Supports both simple saving on the device and the saved-sent mode. 4) Added check for parity and speed changes. 5) Added output of current voltage to the table. 6) Now, when you click on an indicator in the table, the corresponding element will be highlighted. Minor updates: 1) Now the device settings take into account the number of boards found during scanning. 2) When you close the main window, the device turns off.
This commit is contained in:
@@ -25,18 +25,21 @@ SOURCES += \
|
|||||||
devicesettingsdialog.cpp \
|
devicesettingsdialog.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
m3kte.cpp \
|
m3kte.cpp \
|
||||||
|
multiplesettings.cpp \
|
||||||
settingsdialog.cpp \
|
settingsdialog.cpp \
|
||||||
writeregistermodel.cpp
|
writeregistermodel.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
devicesettingsdialog.h \
|
devicesettingsdialog.h \
|
||||||
m3kte.h \
|
m3kte.h \
|
||||||
|
multiplesettings.h \
|
||||||
settingsdialog.h \
|
settingsdialog.h \
|
||||||
writeregistermodel.h
|
writeregistermodel.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
devicesettingsdialog.ui \
|
devicesettingsdialog.ui \
|
||||||
m3kte.ui \
|
m3kte.ui \
|
||||||
|
multiplesettings.ui \
|
||||||
settingsdialog.ui
|
settingsdialog.ui
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ DeviceSettingsDialog::DeviceSettingsDialog(QWidget *parent) :
|
|||||||
_currentBoardTimers[2] = ui->spinTimerBoard_3->value();
|
_currentBoardTimers[2] = ui->spinTimerBoard_3->value();
|
||||||
_currentBoardTimers[3] = ui->spinTimerBoard_4->value();
|
_currentBoardTimers[3] = ui->spinTimerBoard_4->value();
|
||||||
|
|
||||||
|
_m_timer[0] = ui->spinTimerBoard_1;
|
||||||
|
_m_timer[1] = ui->spinTimerBoard_2;
|
||||||
|
_m_timer[2] = ui->spinTimerBoard_3;
|
||||||
|
_m_timer[3] = ui->spinTimerBoard_4;
|
||||||
|
|
||||||
_currentSpeed = ui->speedBox->currentText().toUInt();
|
_currentSpeed = ui->speedBox->currentText().toUInt();
|
||||||
|
|
||||||
_currentParity = ui->parityBox->currentIndex();
|
_currentParity = ui->parityBox->currentIndex();
|
||||||
@@ -38,13 +43,13 @@ void DeviceSettingsDialog::on_buttonApplyChangeTimer_clicked()
|
|||||||
void DeviceSettingsDialog::on_buttonApplyChangeSpeed_clicked()
|
void DeviceSettingsDialog::on_buttonApplyChangeSpeed_clicked()
|
||||||
{
|
{
|
||||||
|
|
||||||
_currentSpeed = ui->speedBox->currentText().toUInt();
|
_currentSpeed = ui->speedBox->currentIndex();
|
||||||
emit speedChanged();
|
emit speedChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceSettingsDialog::on_buttonApplyChangeParity_clicked()
|
void DeviceSettingsDialog::on_buttonApplyChangeParity_clicked()
|
||||||
{
|
{
|
||||||
_currentParity = ui->parityBox->currentData().toUInt();
|
_currentParity = ui->parityBox->currentIndex();
|
||||||
emit parityChanged();
|
emit parityChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +57,7 @@ void DeviceSettingsDialog::on_buttonApplyChangeAdr_clicked()
|
|||||||
{
|
{
|
||||||
BoardIdHasBeenChanged* _boardIdHasBeenChanged = new BoardIdHasBeenChanged(ui->idComboBox->currentIndex(), ui->adrSpinBox->value());
|
BoardIdHasBeenChanged* _boardIdHasBeenChanged = new BoardIdHasBeenChanged(ui->idComboBox->currentIndex(), ui->adrSpinBox->value());
|
||||||
QCoreApplication::postEvent(parent(), _boardIdHasBeenChanged);
|
QCoreApplication::postEvent(parent(), _boardIdHasBeenChanged);
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned DeviceSettingsDialog::currentBoardTimer(unsigned short _ID)
|
unsigned DeviceSettingsDialog::currentBoardTimer(unsigned short _ID)
|
||||||
@@ -69,16 +75,22 @@ unsigned short DeviceSettingsDialog::currentParity()
|
|||||||
return _currentParity;
|
return _currentParity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceSettingsDialog::updateSettingsAfterConnection(unsigned tmp_speed, unsigned tmp_parity, unsigned *tmp_adr)
|
void DeviceSettingsDialog::updateSettingsAfterConnection(unsigned tmp_speed, unsigned tmp_parity, unsigned *tmp_adr, int CurrentConnectedDevice)
|
||||||
{
|
{
|
||||||
ui->speedBox->setCurrentText(QString::number(_currentSpeed=tmp_speed, 10));
|
ui->speedBox->setCurrentText(QString::number(_currentSpeed=tmp_speed, 10));
|
||||||
if(tmp_parity>0)
|
if(tmp_parity>0)
|
||||||
tmp_parity--;
|
tmp_parity--;
|
||||||
ui->parityBox->setCurrentIndex(_currentParity = tmp_parity);
|
ui->parityBox->setCurrentIndex(_currentParity = tmp_parity);
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < CurrentConnectedDevice; i++)
|
||||||
{
|
{
|
||||||
|
_m_timer[i]->setEnabled(true);
|
||||||
|
ui->idComboBox->addItem(QString::number(i));
|
||||||
_currentAdrs[i] = tmp_adr[i];
|
_currentAdrs[i] = tmp_adr[i];
|
||||||
}
|
}
|
||||||
|
for(int i = CurrentConnectedDevice; i < 4; i++)
|
||||||
|
{
|
||||||
|
_m_timer[i]->setEnabled(false);
|
||||||
|
}
|
||||||
on_idComboBox_currentIndexChanged(ui->idComboBox->currentIndex());
|
on_idComboBox_currentIndexChanged(ui->idComboBox->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,3 +98,34 @@ void DeviceSettingsDialog::on_idComboBox_currentIndexChanged(int index)
|
|||||||
{
|
{
|
||||||
ui->adrSpinBox->setValue(_currentAdrs[index]);
|
ui->adrSpinBox->setValue(_currentAdrs[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceSettingsDialog::on_buttonBox_clicked(QAbstractButton *button)
|
||||||
|
{
|
||||||
|
switch (ui->buttonBox->buttonRole(button)) {
|
||||||
|
case QDialogButtonBox::ResetRole:
|
||||||
|
ui->spinTimerBoard_1->setValue(1000);
|
||||||
|
ui->spinTimerBoard_2->setValue(1000);
|
||||||
|
ui->spinTimerBoard_3->setValue(1000);
|
||||||
|
ui->spinTimerBoard_4->setValue(1000);
|
||||||
|
_currentBoardTimers[0] = ui->spinTimerBoard_1->value();
|
||||||
|
_currentBoardTimers[1] = ui->spinTimerBoard_2->value();
|
||||||
|
_currentBoardTimers[2] = ui->spinTimerBoard_3->value();
|
||||||
|
_currentBoardTimers[3] = ui->spinTimerBoard_4->value();
|
||||||
|
|
||||||
|
ui->speedBox->setCurrentText("31250");
|
||||||
|
_currentSpeed = ui->speedBox->currentText().toUInt();
|
||||||
|
|
||||||
|
ui->parityBox->setCurrentIndex(0);
|
||||||
|
_currentParity = ui->parityBox->currentIndex();
|
||||||
|
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
_currentAdrs[i] = i+1;
|
||||||
|
}
|
||||||
|
ui->adrSpinBox->setValue(_currentAdrs[ui->idComboBox->currentIndex()]);
|
||||||
|
break;
|
||||||
|
case QDialogButtonBox::AcceptRole:
|
||||||
|
close();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
#include <QAbstractButton>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QSpinBox>
|
||||||
|
|
||||||
class BoardIdHasBeenChanged : public QEvent
|
class BoardIdHasBeenChanged : public QEvent
|
||||||
{
|
{
|
||||||
@@ -33,7 +36,7 @@ public:
|
|||||||
unsigned currentBoardTimer(unsigned short _ID);
|
unsigned currentBoardTimer(unsigned short _ID);
|
||||||
unsigned currentSpeed();
|
unsigned currentSpeed();
|
||||||
unsigned short currentParity();
|
unsigned short currentParity();
|
||||||
void updateSettingsAfterConnection(unsigned tmp_speed, unsigned tmp_parity, unsigned *tmp_adr);
|
void updateSettingsAfterConnection(unsigned tmp_speed, unsigned tmp_parity, unsigned *tmp_adr, int CurrentConnectedDevice);
|
||||||
signals:
|
signals:
|
||||||
void parityChanged();
|
void parityChanged();
|
||||||
void speedChanged();
|
void speedChanged();
|
||||||
@@ -54,7 +57,10 @@ private slots:
|
|||||||
|
|
||||||
void on_idComboBox_currentIndexChanged(int index);
|
void on_idComboBox_currentIndexChanged(int index);
|
||||||
|
|
||||||
|
void on_buttonBox_clicked(QAbstractButton *button);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QSpinBox *_m_timer[4];
|
||||||
unsigned _currentBoardTimers[4];
|
unsigned _currentBoardTimers[4];
|
||||||
unsigned _currentSpeed;
|
unsigned _currentSpeed;
|
||||||
unsigned short _currentParity;
|
unsigned short _currentParity;
|
||||||
|
|||||||
@@ -30,28 +30,18 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QComboBox" name="speedBox">
|
<widget class="QComboBox" name="speedBox">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>5</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1200</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>2400</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>4800</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>9600</string>
|
<string>9600</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>14400</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>19200</string>
|
<string>19200</string>
|
||||||
@@ -67,6 +57,11 @@
|
|||||||
<string>38400</string>
|
<string>38400</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>56000</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>57600</string>
|
<string>57600</string>
|
||||||
@@ -204,30 +199,17 @@
|
|||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string>Номер платы</string>
|
<string>Номер платы</string>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>2</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>3</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>4</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="adrSpinBox"/>
|
<widget class="QSpinBox" name="adrSpinBox">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>247</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QPushButton" name="buttonApplyChangeAdr">
|
<widget class="QPushButton" name="buttonApplyChangeAdr">
|
||||||
|
|||||||
1178
M3KTE_TERM/m3kte.cpp
1178
M3KTE_TERM/m3kte.cpp
@@ -21,416 +21,328 @@ M3KTE::M3KTE(QWidget *parent)
|
|||||||
//Массив указателей на индикаторы напряжения топливных элементов
|
//Массив указателей на индикаторы напряжения топливных элементов
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
m[i++] = ui->FuelCellVoltageBar_1;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_1;
|
||||||
m[i++] = ui->FuelCellVoltageBar_2;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_2;
|
||||||
m[i++] = ui->FuelCellVoltageBar_3;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_3;
|
||||||
m[i++] = ui->FuelCellVoltageBar_4;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_4;
|
||||||
m[i++] = ui->FuelCellVoltageBar_5;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_5;
|
||||||
m[i++] = ui->FuelCellVoltageBar_6;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_6;
|
||||||
m[i++] = ui->FuelCellVoltageBar_7;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_7;
|
||||||
m[i++] = ui->FuelCellVoltageBar_8;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_8;
|
||||||
m[i++] = ui->FuelCellVoltageBar_9;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_9;
|
||||||
m[i++] = ui->FuelCellVoltageBar_10;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_10;
|
||||||
m[i++] = ui->FuelCellVoltageBar_11;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_11;
|
||||||
m[i++] = ui->FuelCellVoltageBar_12;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_12;
|
||||||
m[i++] = ui->FuelCellVoltageBar_13;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_13;
|
||||||
m[i++] = ui->FuelCellVoltageBar_14;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_14;
|
||||||
m[i++] = ui->FuelCellVoltageBar_15;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_15;
|
||||||
m[i++] = ui->FuelCellVoltageBar_16;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_16;
|
||||||
m[i++] = ui->FuelCellVoltageBar_17;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_17;
|
||||||
m[i++] = ui->FuelCellVoltageBar_18;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_18;
|
||||||
m[i++] = ui->FuelCellVoltageBar_19;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_19;
|
||||||
m[i++] = ui->FuelCellVoltageBar_20;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_20;
|
||||||
m[i++] = ui->FuelCellVoltageBar_21;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_21;
|
||||||
m[i++] = ui->FuelCellVoltageBar_22;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_22;
|
||||||
m[i++] = ui->FuelCellVoltageBar_23;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_23;
|
||||||
m[i++] = ui->FuelCellVoltageBar_24;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_24;
|
||||||
m[i++] = ui->FuelCellVoltageBar_25;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_25;
|
||||||
m[i++] = ui->FuelCellVoltageBar_26;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_26;
|
||||||
m[i++] = ui->FuelCellVoltageBar_27;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_27;
|
||||||
m[i++] = ui->FuelCellVoltageBar_28;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_28;
|
||||||
m[i++] = ui->FuelCellVoltageBar_29;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_29;
|
||||||
m[i++] = ui->FuelCellVoltageBar_30;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_30;
|
||||||
m[i++] = ui->FuelCellVoltageBar_31;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_31;
|
||||||
m[i++] = ui->FuelCellVoltageBar_32;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_32;
|
||||||
m[i++] = ui->FuelCellVoltageBar_33;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_33;
|
||||||
m[i++] = ui->FuelCellVoltageBar_34;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_34;
|
||||||
m[i++] = ui->FuelCellVoltageBar_35;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_35;
|
||||||
m[i++] = ui->FuelCellVoltageBar_36;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_36;
|
||||||
m[i++] = ui->FuelCellVoltageBar_37;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_37;
|
||||||
m[i++] = ui->FuelCellVoltageBar_38;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_38;
|
||||||
m[i++] = ui->FuelCellVoltageBar_39;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_39;
|
||||||
m[i++] = ui->FuelCellVoltageBar_40;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_40;
|
||||||
m[i++] = ui->FuelCellVoltageBar_41;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_41;
|
||||||
m[i++] = ui->FuelCellVoltageBar_42;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_42;
|
||||||
m[i++] = ui->FuelCellVoltageBar_43;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_43;
|
||||||
m[i++] = ui->FuelCellVoltageBar_44;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_44;
|
||||||
m[i++] = ui->FuelCellVoltageBar_45;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_45;
|
||||||
m[i++] = ui->FuelCellVoltageBar_46;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_46;
|
||||||
m[i++] = ui->FuelCellVoltageBar_47;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_47;
|
||||||
m[i++] = ui->FuelCellVoltageBar_48;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_48;
|
||||||
m[i++] = ui->FuelCellVoltageBar_49;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_49;
|
||||||
m[i++] = ui->FuelCellVoltageBar_50;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_50;
|
||||||
m[i++] = ui->FuelCellVoltageBar_51;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_51;
|
||||||
m[i++] = ui->FuelCellVoltageBar_52;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_52;
|
||||||
m[i++] = ui->FuelCellVoltageBar_53;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_53;
|
||||||
m[i++] = ui->FuelCellVoltageBar_54;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_54;
|
||||||
m[i++] = ui->FuelCellVoltageBar_55;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_55;
|
||||||
m[i++] = ui->FuelCellVoltageBar_56;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_56;
|
||||||
m[i++] = ui->FuelCellVoltageBar_57;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_57;
|
||||||
m[i++] = ui->FuelCellVoltageBar_58;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_58;
|
||||||
m[i++] = ui->FuelCellVoltageBar_59;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_59;
|
||||||
m[i++] = ui->FuelCellVoltageBar_60;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_60;
|
||||||
m[i++] = ui->FuelCellVoltageBar_61;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_61;
|
||||||
m[i++] = ui->FuelCellVoltageBar_62;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_62;
|
||||||
m[i++] = ui->FuelCellVoltageBar_63;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_63;
|
||||||
m[i++] = ui->FuelCellVoltageBar_64;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_64;
|
||||||
m[i++] = ui->FuelCellVoltageBar_65;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_65;
|
||||||
m[i++] = ui->FuelCellVoltageBar_66;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_66;
|
||||||
m[i++] = ui->FuelCellVoltageBar_67;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_67;
|
||||||
m[i++] = ui->FuelCellVoltageBar_68;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_68;
|
||||||
m[i++] = ui->FuelCellVoltageBar_69;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_69;
|
||||||
m[i++] = ui->FuelCellVoltageBar_70;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_70;
|
||||||
m[i++] = ui->FuelCellVoltageBar_71;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_71;
|
||||||
m[i++] = ui->FuelCellVoltageBar_72;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_72;
|
||||||
m[i++] = ui->FuelCellVoltageBar_73;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_73;
|
||||||
m[i++] = ui->FuelCellVoltageBar_74;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_74;
|
||||||
m[i++] = ui->FuelCellVoltageBar_75;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_75;
|
||||||
m[i++] = ui->FuelCellVoltageBar_76;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_76;
|
||||||
m[i++] = ui->FuelCellVoltageBar_77;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_77;
|
||||||
m[i++] = ui->FuelCellVoltageBar_78;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_78;
|
||||||
m[i++] = ui->FuelCellVoltageBar_79;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_79;
|
||||||
m[i++] = ui->FuelCellVoltageBar_80;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_80;
|
||||||
m[i++] = ui->FuelCellVoltageBar_81;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_81;
|
||||||
m[i++] = ui->FuelCellVoltageBar_82;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_82;
|
||||||
m[i++] = ui->FuelCellVoltageBar_83;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_83;
|
||||||
m[i++] = ui->FuelCellVoltageBar_84;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_84;
|
||||||
m[i++] = ui->FuelCellVoltageBar_85;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_85;
|
||||||
m[i++] = ui->FuelCellVoltageBar_86;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_86;
|
||||||
m[i++] = ui->FuelCellVoltageBar_87;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_87;
|
||||||
m[i++] = ui->FuelCellVoltageBar_88;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_88;
|
||||||
m[i++] = ui->FuelCellVoltageBar_89;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_89;
|
||||||
m[i++] = ui->FuelCellVoltageBar_90;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_90;
|
||||||
m[i++] = ui->FuelCellVoltageBar_91;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_91;
|
||||||
m[i++] = ui->FuelCellVoltageBar_92;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_92;
|
||||||
m[i++] = ui->FuelCellVoltageBar_93;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_93;
|
||||||
m[i++] = ui->FuelCellVoltageBar_94;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_94;
|
||||||
m[i++] = ui->FuelCellVoltageBar_95;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_95;
|
||||||
m[i++] = ui->FuelCellVoltageBar_96;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_96;
|
||||||
m[i++] = ui->FuelCellVoltageBar_97;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_97;
|
||||||
m[i++] = ui->FuelCellVoltageBar_98;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_98;
|
||||||
m[i++] = ui->FuelCellVoltageBar_99;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_99;
|
||||||
m[i++] = ui->FuelCellVoltageBar_100;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_100;
|
||||||
m[i++] = ui->FuelCellVoltageBar_101;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_101;
|
||||||
m[i++] = ui->FuelCellVoltageBar_102;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_102;
|
||||||
m[i++] = ui->FuelCellVoltageBar_103;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_103;
|
||||||
m[i++] = ui->FuelCellVoltageBar_104;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_104;
|
||||||
m[i++] = ui->FuelCellVoltageBar_105;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_105;
|
||||||
m[i++] = ui->FuelCellVoltageBar_106;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_106;
|
||||||
m[i++] = ui->FuelCellVoltageBar_107;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_107;
|
||||||
m[i++] = ui->FuelCellVoltageBar_108;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_108;
|
||||||
m[i++] = ui->FuelCellVoltageBar_109;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_109;
|
||||||
m[i++] = ui->FuelCellVoltageBar_110;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_110;
|
||||||
m[i++] = ui->FuelCellVoltageBar_111;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_111;
|
||||||
m[i++] = ui->FuelCellVoltageBar_112;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_112;
|
||||||
m[i++] = ui->FuelCellVoltageBar_113;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_113;
|
||||||
m[i++] = ui->FuelCellVoltageBar_114;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_114;
|
||||||
m[i++] = ui->FuelCellVoltageBar_115;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_115;
|
||||||
m[i++] = ui->FuelCellVoltageBar_116;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_116;
|
||||||
m[i++] = ui->FuelCellVoltageBar_117;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_117;
|
||||||
m[i++] = ui->FuelCellVoltageBar_118;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_118;
|
||||||
m[i++] = ui->FuelCellVoltageBar_119;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_119;
|
||||||
m[i++] = ui->FuelCellVoltageBar_120;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_120;
|
||||||
m[i++] = ui->FuelCellVoltageBar_121;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_121;
|
||||||
m[i++] = ui->FuelCellVoltageBar_122;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_122;
|
||||||
m[i++] = ui->FuelCellVoltageBar_123;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_123;
|
||||||
m[i++] = ui->FuelCellVoltageBar_124;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_124;
|
||||||
m[i++] = ui->FuelCellVoltageBar_125;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_125;
|
||||||
m[i++] = ui->FuelCellVoltageBar_126;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_126;
|
||||||
m[i++] = ui->FuelCellVoltageBar_127;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_127;
|
||||||
m[i++] = ui->FuelCellVoltageBar_128;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_128;
|
||||||
m[i++] = ui->FuelCellVoltageBar_129;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_129;
|
||||||
m[i++] = ui->FuelCellVoltageBar_130;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_130;
|
||||||
m[i++] = ui->FuelCellVoltageBar_131;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_131;
|
||||||
m[i++] = ui->FuelCellVoltageBar_132;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_132;
|
||||||
m[i++] = ui->FuelCellVoltageBar_133;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_133;
|
||||||
m[i++] = ui->FuelCellVoltageBar_134;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_134;
|
||||||
m[i++] = ui->FuelCellVoltageBar_135;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_135;
|
||||||
m[i++] = ui->FuelCellVoltageBar_136;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_136;
|
||||||
m[i++] = ui->FuelCellVoltageBar_137;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_137;
|
||||||
m[i++] = ui->FuelCellVoltageBar_138;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_138;
|
||||||
m[i++] = ui->FuelCellVoltageBar_139;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_139;
|
||||||
m[i++] = ui->FuelCellVoltageBar_140;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_140;
|
||||||
m[i++] = ui->FuelCellVoltageBar_141;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_141;
|
||||||
m[i++] = ui->FuelCellVoltageBar_142;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_142;
|
||||||
m[i++] = ui->FuelCellVoltageBar_143;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_143;
|
||||||
m[i++] = ui->FuelCellVoltageBar_144;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_144;
|
||||||
m[i++] = ui->FuelCellVoltageBar_145;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_145;
|
||||||
m[i++] = ui->FuelCellVoltageBar_146;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_146;
|
||||||
m[i++] = ui->FuelCellVoltageBar_147;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_147;
|
||||||
m[i++] = ui->FuelCellVoltageBar_148;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_148;
|
||||||
m[i++] = ui->FuelCellVoltageBar_149;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_149;
|
||||||
m[i++] = ui->FuelCellVoltageBar_150;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_150;
|
||||||
m[i++] = ui->FuelCellVoltageBar_151;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_151;
|
||||||
m[i++] = ui->FuelCellVoltageBar_152;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_152;
|
||||||
m[i++] = ui->FuelCellVoltageBar_153;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_153;
|
||||||
m[i++] = ui->FuelCellVoltageBar_154;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_154;
|
||||||
m[i++] = ui->FuelCellVoltageBar_155;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_155;
|
||||||
m[i++] = ui->FuelCellVoltageBar_156;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_156;
|
||||||
m[i++] = ui->FuelCellVoltageBar_157;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_157;
|
||||||
m[i++] = ui->FuelCellVoltageBar_158;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_158;
|
||||||
m[i++] = ui->FuelCellVoltageBar_159;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_159;
|
||||||
m[i++] = ui->FuelCellVoltageBar_160;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_160;
|
||||||
m[i++] = ui->FuelCellVoltageBar_161;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_161;
|
||||||
m[i++] = ui->FuelCellVoltageBar_162;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_162;
|
||||||
m[i++] = ui->FuelCellVoltageBar_163;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_163;
|
||||||
m[i++] = ui->FuelCellVoltageBar_164;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_164;
|
||||||
m[i++] = ui->FuelCellVoltageBar_165;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_165;
|
||||||
m[i++] = ui->FuelCellVoltageBar_166;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_166;
|
||||||
m[i++] = ui->FuelCellVoltageBar_167;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_167;
|
||||||
m[i++] = ui->FuelCellVoltageBar_168;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_168;
|
||||||
m[i++] = ui->FuelCellVoltageBar_169;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_169;
|
||||||
m[i++] = ui->FuelCellVoltageBar_170;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_170;
|
||||||
m[i++] = ui->FuelCellVoltageBar_171;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_171;
|
||||||
m[i++] = ui->FuelCellVoltageBar_172;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_172;
|
||||||
m[i++] = ui->FuelCellVoltageBar_173;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_173;
|
||||||
m[i++] = ui->FuelCellVoltageBar_174;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_174;
|
||||||
m[i++] = ui->FuelCellVoltageBar_175;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_175;
|
||||||
m[i++] = ui->FuelCellVoltageBar_176;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_176;
|
||||||
m[i++] = ui->FuelCellVoltageBar_177;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_177;
|
||||||
m[i++] = ui->FuelCellVoltageBar_178;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_178;
|
||||||
m[i++] = ui->FuelCellVoltageBar_179;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_179;
|
||||||
m[i++] = ui->FuelCellVoltageBar_180;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_180;
|
||||||
m[i++] = ui->FuelCellVoltageBar_181;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_181;
|
||||||
m[i++] = ui->FuelCellVoltageBar_182;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_182;
|
||||||
m[i++] = ui->FuelCellVoltageBar_183;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_183;
|
||||||
m[i++] = ui->FuelCellVoltageBar_184;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_184;
|
||||||
m[i++] = ui->FuelCellVoltageBar_185;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_185;
|
||||||
m[i++] = ui->FuelCellVoltageBar_186;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_186;
|
||||||
m[i++] = ui->FuelCellVoltageBar_187;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_187;
|
||||||
m[i++] = ui->FuelCellVoltageBar_188;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_188;
|
||||||
m[i++] = ui->FuelCellVoltageBar_189;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_189;
|
||||||
m[i++] = ui->FuelCellVoltageBar_190;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_190;
|
||||||
m[i++] = ui->FuelCellVoltageBar_191;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_191;
|
||||||
m[i++] = ui->FuelCellVoltageBar_192;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_192;
|
||||||
m[i++] = ui->FuelCellVoltageBar_193;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_193;
|
||||||
m[i++] = ui->FuelCellVoltageBar_194;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_194;
|
||||||
m[i++] = ui->FuelCellVoltageBar_195;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_195;
|
||||||
m[i++] = ui->FuelCellVoltageBar_196;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_196;
|
||||||
m[i++] = ui->FuelCellVoltageBar_197;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_197;
|
||||||
m[i++] = ui->FuelCellVoltageBar_198;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_198;
|
||||||
m[i++] = ui->FuelCellVoltageBar_199;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_199;
|
||||||
m[i++] = ui->FuelCellVoltageBar_200;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_200;
|
||||||
m[i++] = ui->FuelCellVoltageBar_201;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_201;
|
||||||
m[i++] = ui->FuelCellVoltageBar_202;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_202;
|
||||||
m[i++] = ui->FuelCellVoltageBar_203;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_203;
|
||||||
m[i++] = ui->FuelCellVoltageBar_204;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_204;
|
||||||
m[i++] = ui->FuelCellVoltageBar_205;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_205;
|
||||||
m[i++] = ui->FuelCellVoltageBar_206;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_206;
|
||||||
m[i++] = ui->FuelCellVoltageBar_207;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_207;
|
||||||
m[i++] = ui->FuelCellVoltageBar_208;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_208;
|
||||||
m[i++] = ui->FuelCellVoltageBar_209;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_209;
|
||||||
m[i++] = ui->FuelCellVoltageBar_210;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_210;
|
||||||
m[i++] = ui->FuelCellVoltageBar_211;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_211;
|
||||||
m[i++] = ui->FuelCellVoltageBar_212;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_212;
|
||||||
m[i++] = ui->FuelCellVoltageBar_213;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_213;
|
||||||
m[i++] = ui->FuelCellVoltageBar_214;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_214;
|
||||||
m[i++] = ui->FuelCellVoltageBar_215;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_215;
|
||||||
m[i++] = ui->FuelCellVoltageBar_216;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_216;
|
||||||
m[i++] = ui->FuelCellVoltageBar_217;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_217;
|
||||||
m[i++] = ui->FuelCellVoltageBar_218;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_218;
|
||||||
m[i++] = ui->FuelCellVoltageBar_219;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_219;
|
||||||
m[i++] = ui->FuelCellVoltageBar_220;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_220;
|
||||||
m[i++] = ui->FuelCellVoltageBar_221;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_221;
|
||||||
m[i++] = ui->FuelCellVoltageBar_222;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_222;
|
||||||
m[i++] = ui->FuelCellVoltageBar_223;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_223;
|
||||||
m[i++] = ui->FuelCellVoltageBar_224;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_224;
|
||||||
m[i++] = ui->FuelCellVoltageBar_225;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_225;
|
||||||
m[i++] = ui->FuelCellVoltageBar_226;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_226;
|
||||||
m[i++] = ui->FuelCellVoltageBar_227;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_227;
|
||||||
m[i++] = ui->FuelCellVoltageBar_228;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_228;
|
||||||
m[i++] = ui->FuelCellVoltageBar_229;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_229;
|
||||||
m[i++] = ui->FuelCellVoltageBar_230;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_230;
|
||||||
m[i++] = ui->FuelCellVoltageBar_231;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_231;
|
||||||
m[i++] = ui->FuelCellVoltageBar_232;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_232;
|
||||||
m[i++] = ui->FuelCellVoltageBar_233;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_233;
|
||||||
m[i++] = ui->FuelCellVoltageBar_234;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_234;
|
||||||
m[i++] = ui->FuelCellVoltageBar_235;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_235;
|
||||||
m[i++] = ui->FuelCellVoltageBar_236;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_236;
|
||||||
m[i++] = ui->FuelCellVoltageBar_237;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_237;
|
||||||
m[i++] = ui->FuelCellVoltageBar_238;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_238;
|
||||||
m[i++] = ui->FuelCellVoltageBar_239;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_239;
|
||||||
m[i++] = ui->FuelCellVoltageBar_240;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_240;
|
||||||
m[i++] = ui->FuelCellVoltageBar_241;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_241;
|
||||||
m[i++] = ui->FuelCellVoltageBar_242;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_242;
|
||||||
m[i++] = ui->FuelCellVoltageBar_243;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_243;
|
||||||
m[i++] = ui->FuelCellVoltageBar_244;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_244;
|
||||||
m[i++] = ui->FuelCellVoltageBar_245;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_245;
|
||||||
m[i++] = ui->FuelCellVoltageBar_246;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_246;
|
||||||
m[i++] = ui->FuelCellVoltageBar_247;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_247;
|
||||||
m[i++] = ui->FuelCellVoltageBar_248;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_248;
|
||||||
m[i++] = ui->FuelCellVoltageBar_249;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_249;
|
||||||
m[i++] = ui->FuelCellVoltageBar_250;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_250;
|
||||||
m[i++] = ui->FuelCellVoltageBar_251;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_251;
|
||||||
m[i++] = ui->FuelCellVoltageBar_252;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_252;
|
||||||
m[i++] = ui->FuelCellVoltageBar_253;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_253;
|
||||||
m[i++] = ui->FuelCellVoltageBar_254;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_254;
|
||||||
m[i++] = ui->FuelCellVoltageBar_255;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_255;
|
||||||
m[i++] = ui->FuelCellVoltageBar_256;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_256;
|
||||||
m[i++] = ui->FuelCellVoltageBar_257;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_257;
|
||||||
m[i++] = ui->FuelCellVoltageBar_258;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_258;
|
||||||
m[i++] = ui->FuelCellVoltageBar_259;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_259;
|
||||||
m[i++] = ui->FuelCellVoltageBar_260;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_260;
|
||||||
m[i++] = ui->FuelCellVoltageBar_261;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_261;
|
||||||
m[i++] = ui->FuelCellVoltageBar_262;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_262;
|
||||||
m[i++] = ui->FuelCellVoltageBar_263;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_263;
|
||||||
m[i++] = ui->FuelCellVoltageBar_264;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_264;
|
||||||
m[i++] = ui->FuelCellVoltageBar_265;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_265;
|
||||||
m[i++] = ui->FuelCellVoltageBar_266;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_266;
|
||||||
m[i++] = ui->FuelCellVoltageBar_267;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_267;
|
||||||
m[i++] = ui->FuelCellVoltageBar_268;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_268;
|
||||||
m[i++] = ui->FuelCellVoltageBar_269;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_269;
|
||||||
m[i++] = ui->FuelCellVoltageBar_270;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_270;
|
||||||
m[i++] = ui->FuelCellVoltageBar_271;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_271;
|
||||||
m[i++] = ui->FuelCellVoltageBar_272;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_272;
|
||||||
m[i++] = ui->FuelCellVoltageBar_273;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_273;
|
||||||
m[i++] = ui->FuelCellVoltageBar_274;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_274;
|
||||||
m[i++] = ui->FuelCellVoltageBar_275;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_275;
|
||||||
m[i++] = ui->FuelCellVoltageBar_276;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_276;
|
||||||
m[i++] = ui->FuelCellVoltageBar_277;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_277;
|
||||||
m[i++] = ui->FuelCellVoltageBar_278;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_278;
|
||||||
m[i++] = ui->FuelCellVoltageBar_279;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_279;
|
||||||
m[i++] = ui->FuelCellVoltageBar_280;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_280;
|
||||||
m[i++] = ui->FuelCellVoltageBar_281;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_281;
|
||||||
m[i++] = ui->FuelCellVoltageBar_282;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_282;
|
||||||
m[i++] = ui->FuelCellVoltageBar_283;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_283;
|
||||||
m[i++] = ui->FuelCellVoltageBar_284;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_284;
|
||||||
m[i++] = ui->FuelCellVoltageBar_285;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_285;
|
||||||
m[i++] = ui->FuelCellVoltageBar_286;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_286;
|
||||||
m[i++] = ui->FuelCellVoltageBar_287;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_287;
|
||||||
m[i++] = ui->FuelCellVoltageBar_288;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_288;
|
||||||
m[i++] = ui->FuelCellVoltageBar_289;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_289;
|
||||||
m[i++] = ui->FuelCellVoltageBar_290;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_290;
|
||||||
m[i++] = ui->FuelCellVoltageBar_291;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_291;
|
||||||
m[i++] = ui->FuelCellVoltageBar_292;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_292;
|
||||||
m[i++] = ui->FuelCellVoltageBar_293;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_293;
|
||||||
m[i++] = ui->FuelCellVoltageBar_294;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_294;
|
||||||
m[i++] = ui->FuelCellVoltageBar_295;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_295;
|
||||||
m[i++] = ui->FuelCellVoltageBar_296;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_296;
|
||||||
m[i++] = ui->FuelCellVoltageBar_297;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_297;
|
||||||
m[i++] = ui->FuelCellVoltageBar_298;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_298;
|
||||||
m[i++] = ui->FuelCellVoltageBar_299;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_299;
|
||||||
m[i++] = ui->FuelCellVoltageBar_300;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_300;
|
||||||
m[i++] = ui->FuelCellVoltageBar_301;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_301;
|
||||||
m[i++] = ui->FuelCellVoltageBar_302;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_302;
|
||||||
m[i++] = ui->FuelCellVoltageBar_303;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_303;
|
||||||
m[i++] = ui->FuelCellVoltageBar_304;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_304;
|
||||||
m[i++] = ui->FuelCellVoltageBar_305;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_305;
|
||||||
m[i++] = ui->FuelCellVoltageBar_306;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_306;
|
||||||
m[i++] = ui->FuelCellVoltageBar_307;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_307;
|
||||||
m[i++] = ui->FuelCellVoltageBar_308;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_308;
|
||||||
m[i++] = ui->FuelCellVoltageBar_309;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_309;
|
||||||
m[i++] = ui->FuelCellVoltageBar_310;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_310;
|
||||||
m[i++] = ui->FuelCellVoltageBar_311;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_311;
|
||||||
m[i++] = ui->FuelCellVoltageBar_312;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_312;
|
||||||
m[i++] = ui->FuelCellVoltageBar_313;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_313;
|
||||||
m[i++] = ui->FuelCellVoltageBar_314;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_314;
|
||||||
m[i++] = ui->FuelCellVoltageBar_315;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_315;
|
||||||
m[i++] = ui->FuelCellVoltageBar_316;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_316;
|
||||||
m[i++] = ui->FuelCellVoltageBar_317;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_317;
|
||||||
m[i++] = ui->FuelCellVoltageBar_318;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_318;
|
||||||
m[i++] = ui->FuelCellVoltageBar_319;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_319;
|
||||||
m[i++] = ui->FuelCellVoltageBar_320;
|
m_ProgressBar[i++] = ui->FuelCellVoltageBar_320;
|
||||||
}
|
}
|
||||||
/*QGroupBox *FCB[85];
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
FCB[i++] = ui->FuelCellBox_1;
|
|
||||||
FCB[i++] = ui->FuelCellBox_2;
|
|
||||||
FCB[i++] = ui->FuelCellBox_3;
|
|
||||||
FCB[i++] = ui->FuelCellBox_4;
|
|
||||||
FCB[i++] = ui->FuelCellBox_5;
|
|
||||||
FCB[i++] = ui->FuelCellBox_6;
|
|
||||||
FCB[i++] = ui->FuelCellBox_7;
|
|
||||||
FCB[i++] = ui->FuelCellBox_8;
|
|
||||||
FCB[i++] = ui->FuelCellBox_9;
|
|
||||||
FCB[i++] = ui->FuelCellBox_10;
|
|
||||||
FCB[i++] = ui->FuelCellBox_11;
|
|
||||||
FCB[i++] = ui->FuelCellBox_12;
|
|
||||||
FCB[i++] = ui->FuelCellBox_13;
|
|
||||||
FCB[i++] = ui->FuelCellBox_14;
|
|
||||||
FCB[i++] = ui->FuelCellBox_15;
|
|
||||||
FCB[i++] = ui->FuelCellBox_16;
|
|
||||||
FCB[i++] = ui->FuelCellBox_17;
|
|
||||||
FCB[i++] = ui->FuelCellBox_18;
|
|
||||||
FCB[i++] = ui->FuelCellBox_19;
|
|
||||||
FCB[i++] = ui->FuelCellBox_20;
|
|
||||||
FCB[i++] = ui->FuelCellBox_21;
|
|
||||||
FCB[i++] = ui->FuelCellBox_22;
|
|
||||||
FCB[i++] = ui->FuelCellBox_23;
|
|
||||||
FCB[i++] = ui->FuelCellBox_24;
|
|
||||||
FCB[i++] = ui->FuelCellBox_25;
|
|
||||||
FCB[i++] = ui->FuelCellBox_26;
|
|
||||||
FCB[i++] = ui->FuelCellBox_27;
|
|
||||||
FCB[i++] = ui->FuelCellBox_28;
|
|
||||||
FCB[i++] = ui->FuelCellBox_29;
|
|
||||||
FCB[i++] = ui->FuelCellBox_30;
|
|
||||||
FCB[i++] = ui->FuelCellBox_31;
|
|
||||||
FCB[i++] = ui->FuelCellBox_32;
|
|
||||||
FCB[i++] = ui->FuelCellBox_33;
|
|
||||||
FCB[i++] = ui->FuelCellBox_34;
|
|
||||||
FCB[i++] = ui->FuelCellBox_35;
|
|
||||||
FCB[i++] = ui->FuelCellBox_36;
|
|
||||||
FCB[i++] = ui->FuelCellBox_37;
|
|
||||||
FCB[i++] = ui->FuelCellBox_38;
|
|
||||||
FCB[i++] = ui->FuelCellBox_39;
|
|
||||||
FCB[i++] = ui->FuelCellBox_40;
|
|
||||||
FCB[i++] = ui->FuelCellBox_41;
|
|
||||||
FCB[i++] = ui->FuelCellBox_42;
|
|
||||||
FCB[i++] = ui->FuelCellBox_43;
|
|
||||||
FCB[i++] = ui->FuelCellBox_44;
|
|
||||||
FCB[i++] = ui->FuelCellBox_45;
|
|
||||||
FCB[i++] = ui->FuelCellBox_46;
|
|
||||||
FCB[i++] = ui->FuelCellBox_47;
|
|
||||||
FCB[i++] = ui->FuelCellBox_48;
|
|
||||||
FCB[i++] = ui->FuelCellBox_49;
|
|
||||||
FCB[i++] = ui->FuelCellBox_50;
|
|
||||||
FCB[i++] = ui->FuelCellBox_51;
|
|
||||||
FCB[i++] = ui->FuelCellBox_52;
|
|
||||||
FCB[i++] = ui->FuelCellBox_53;
|
|
||||||
FCB[i++] = ui->FuelCellBox_54;
|
|
||||||
FCB[i++] = ui->FuelCellBox_55;
|
|
||||||
FCB[i++] = ui->FuelCellBox_56;
|
|
||||||
FCB[i++] = ui->FuelCellBox_57;
|
|
||||||
FCB[i++] = ui->FuelCellBox_58;
|
|
||||||
FCB[i++] = ui->FuelCellBox_59;
|
|
||||||
FCB[i++] = ui->FuelCellBox_60;
|
|
||||||
FCB[i++] = ui->FuelCellBox_61;
|
|
||||||
FCB[i++] = ui->FuelCellBox_62;
|
|
||||||
FCB[i++] = ui->FuelCellBox_63;
|
|
||||||
FCB[i++] = ui->FuelCellBox_64;
|
|
||||||
FCB[i++] = ui->FuelCellBox_65;
|
|
||||||
FCB[i++] = ui->FuelCellBox_66;
|
|
||||||
FCB[i++] = ui->FuelCellBox_67;
|
|
||||||
FCB[i++] = ui->FuelCellBox_68;
|
|
||||||
FCB[i++] = ui->FuelCellBox_69;
|
|
||||||
FCB[i++] = ui->FuelCellBox_70;
|
|
||||||
FCB[i++] = ui->FuelCellBox_71;
|
|
||||||
FCB[i++] = ui->FuelCellBox_72;
|
|
||||||
FCB[i++] = ui->FuelCellBox_73;
|
|
||||||
FCB[i++] = ui->FuelCellBox_74;
|
|
||||||
FCB[i++] = ui->FuelCellBox_75;
|
|
||||||
FCB[i++] = ui->FuelCellBox_76;
|
|
||||||
FCB[i++] = ui->FuelCellBox_77;
|
|
||||||
FCB[i++] = ui->FuelCellBox_78;
|
|
||||||
FCB[i++] = ui->FuelCellBox_79;
|
|
||||||
FCB[i++] = ui->FuelCellBox_80;
|
|
||||||
FCB[i++] = ui->FuelCellBox_81;
|
|
||||||
FCB[i++] = ui->FuelCellBox_82;
|
|
||||||
FCB[i++] = ui->FuelCellBox_83;
|
|
||||||
FCB[i++] = ui->FuelCellBox_84;
|
|
||||||
FCB[i++] = ui->FuelCellBox_85;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
m_settingsDialog = new SettingsDialog(this);
|
m_settingsDialog = new SettingsDialog(this);
|
||||||
|
|
||||||
@@ -449,8 +361,10 @@ M3KTE::M3KTE(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_deviceSettingsDialog = new DeviceSettingsDialog(this);
|
m_deviceSettingsDialog = new DeviceSettingsDialog(this);
|
||||||
|
m_regMultipleSettings = new MultipleSettings(this);
|
||||||
|
|
||||||
modbusDevice = new QModbusRtuSerialMaster(this);
|
modbusDevice = new QModbusRtuSerialMaster(this);
|
||||||
|
//ui->M3kteRegSettings->setEnabled(false);
|
||||||
|
|
||||||
Boards[0].boardScanners = new QTimer();
|
Boards[0].boardScanners = new QTimer();
|
||||||
Boards[1].boardScanners = new QTimer();
|
Boards[1].boardScanners = new QTimer();
|
||||||
@@ -489,14 +403,26 @@ M3KTE::M3KTE(QWidget *parent)
|
|||||||
statusM3KTE.Accidents[i] = false;
|
statusM3KTE.Accidents[i] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QBrush tb(Qt::transparent); // Transparent brush, solid pattern
|
||||||
for(int i = 0; i<320; i++)
|
for(int i = 0; i<320; i++)
|
||||||
{
|
{
|
||||||
m[i]->setValue(3);
|
m_ProgressBar[i]->setValue(3);
|
||||||
QString style_fc_off = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(30) + ", 30, 30, 30%);} ";
|
QString style_fc_off = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(30) + ", 30, 30, 30%);} ";
|
||||||
m[i]->setStyleSheet(style_fc_off);
|
m_ProgressBar[i]->setStyleSheet(style_fc_off);
|
||||||
|
|
||||||
|
ThePhantomMenace[i] = new QPushButton(m_ProgressBar[i]);
|
||||||
|
ThePhantomMenace[i]->setFlat(true);
|
||||||
|
ThePhantomMenace[i]->setPalette(QPalette(tb, tb, tb, tb, tb, tb, tb, tb, tb));
|
||||||
|
connect(ThePhantomMenace[i], &QPushButton::clicked, this, [this, i]() {
|
||||||
|
selectPositionOnTree(i);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
debug();
|
debug();
|
||||||
|
|
||||||
|
connect(m_deviceSettingsDialog, &DeviceSettingsDialog::parityChanged, this, &M3KTE::onParityUpdate);
|
||||||
|
connect(m_deviceSettingsDialog, &DeviceSettingsDialog::speedChanged, this, &M3KTE::onSpeedUpdate);
|
||||||
|
|
||||||
|
|
||||||
//Вызов окна настройки подключения
|
//Вызов окна настройки подключения
|
||||||
|
|
||||||
//Вызов окна настройки устройства
|
//Вызов окна настройки устройства
|
||||||
@@ -505,6 +431,10 @@ M3KTE::M3KTE(QWidget *parent)
|
|||||||
|
|
||||||
M3KTE::~M3KTE()
|
M3KTE::~M3KTE()
|
||||||
{
|
{
|
||||||
|
if(modbusDevice->state() == QModbusDevice::ConnectedState)
|
||||||
|
{
|
||||||
|
onConnectClicked();
|
||||||
|
}
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,39 +443,39 @@ void M3KTE::debug()
|
|||||||
srand(time(0));
|
srand(time(0));
|
||||||
for(int i = 0; i < 320; i++)
|
for(int i = 0; i < 320; i++)
|
||||||
{
|
{
|
||||||
m[i]->setTextVisible(true);
|
m_ProgressBar[i]->setTextVisible(true);
|
||||||
m[i]->setMinimumSize(25, 25);
|
m_ProgressBar[i]->setMinimumSize(25, 25);
|
||||||
m[i]->setMaximumSize(25, 25);
|
m_ProgressBar[i]->setMaximumSize(25, 25);
|
||||||
m[i]->resize(25, 25);
|
m_ProgressBar[i]->resize(25, 25);
|
||||||
m[i]->setAlignment(Qt::AlignCenter);
|
m_ProgressBar[i]->setAlignment(Qt::AlignCenter);
|
||||||
m[i]->setFormat(QString("%1").arg((i%85+1)));
|
m_ProgressBar[i]->setFormat(QString("%1").arg((i%85+1)));
|
||||||
// int j = rand()%4;
|
// int j = rand()%4;
|
||||||
// if(j!=3) j=rand()%4;
|
// if(j!=3) j=rand()%4;
|
||||||
// m[i]->setValue(j);
|
// m_ProgressBar[i]->setValue(j);
|
||||||
// QString style_fc = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(j*50-50) + ", 255, 255, 100%);} ";
|
// QString style_fc = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(j*50-50) + ", 255, 255, 100%);} ";
|
||||||
// QString style_fc_off = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(30) + ", 30, 30, 30%);} ";
|
// QString style_fc_off = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(30) + ", 30, 30, 30%);} ";
|
||||||
// m[i]->setStyleSheet(style_fc);
|
// m_ProgressBar[i]->setStyleSheet(style_fc);
|
||||||
|
|
||||||
// switch (j) {
|
// switch (j) {
|
||||||
// case 1:
|
// case 1:
|
||||||
// {
|
// {
|
||||||
// m[i]->setStatusTip(QString("П%1 ТЭ%2: Аварийный уровень напряжения.").arg(QString::number(i/85+1), QString::number(i%85)));
|
// m_ProgressBar[i]->setStatusTip(QString("П%1 ТЭ%2: Аварийный уровень напряжения.").arg(QString::number(i/85+1), QString::number(i%85)));
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
// case 2:
|
// case 2:
|
||||||
// {
|
// {
|
||||||
// m[i]->setStatusTip(QString("П%1 ТЭ%2: Предупредительный уровень напряжения.").arg(QString::number(i/85+1), QString::number(i%85)));
|
// m_ProgressBar[i]->setStatusTip(QString("П%1 ТЭ%2: Предупредительный уровень напряжения.").arg(QString::number(i/85+1), QString::number(i%85)));
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
// case 3:
|
// case 3:
|
||||||
// {
|
// {
|
||||||
// m[i]->setStatusTip(QString("П%1 ТЭ%2: Уровень напряжения в норме.").arg(QString::number(i/85+1), QString::number(i%85)));
|
// m_ProgressBar[i]->setStatusTip(QString("П%1 ТЭ%2: Уровень напряжения в норме.").arg(QString::number(i/85+1), QString::number(i%85)));
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
// case 0:
|
// case 0:
|
||||||
// m[i]->setStatusTip(QString("П%1 ТЭ%2: Топливный Элемент не учитывается.").arg(QString::number(i/85+1), QString::number(i%85)));
|
// m_ProgressBar[i]->setStatusTip(QString("П%1 ТЭ%2: Топливный Элемент не учитывается.").arg(QString::number(i/85+1), QString::number(i%85)));
|
||||||
// m[i]->setStyleSheet(style_fc_off);
|
// m_ProgressBar[i]->setStyleSheet(style_fc_off);
|
||||||
// m[i]->setValue(3);
|
// m_ProgressBar[i]->setValue(3);
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
@@ -571,6 +501,10 @@ void M3KTE::initActions()
|
|||||||
connect(ui->writeTable, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(ui->writeTable, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
this, &M3KTE::onWriteTableChanged);
|
this, &M3KTE::onWriteTableChanged);
|
||||||
|
|
||||||
|
connect(ui->M3kteRegSettings, &QAction::triggered, m_regMultipleSettings, &QDialog::show);
|
||||||
|
connect(m_regMultipleSettings, &MultipleSettings::write, this, &M3KTE::slotmultipleRegWrite);
|
||||||
|
connect(m_regMultipleSettings, &MultipleSettings::writeAndSend, this, &M3KTE::slotmultipleRegWriteAndSend);
|
||||||
|
|
||||||
connect(ui->ConnectionMenuSettings, &QAction::triggered, m_settingsDialog, &QDialog::show);
|
connect(ui->ConnectionMenuSettings, &QAction::triggered, m_settingsDialog, &QDialog::show);
|
||||||
connect(ui->M3kteMenuSettings, &QAction::triggered, m_deviceSettingsDialog, &QDialog::show);
|
connect(ui->M3kteMenuSettings, &QAction::triggered, m_deviceSettingsDialog, &QDialog::show);
|
||||||
}
|
}
|
||||||
@@ -609,7 +543,9 @@ void M3KTE::onConnectClicked()
|
|||||||
tmp_adr[i] = Boards[i].adr;
|
tmp_adr[i] = Boards[i].adr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceSettingsDialog->updateSettingsAfterConnection(m_settingsDialog->settings().baud, m_settingsDialog->settings().parity, tmp_adr);
|
ui->M3kteRegSettings->setEnabled(true);
|
||||||
|
|
||||||
|
m_deviceSettingsDialog->updateSettingsAfterConnection(m_settingsDialog->settings().baud, m_settingsDialog->settings().parity, tmp_adr, CurrentConnectedDevice);
|
||||||
|
|
||||||
ui->boardSelectBox->setCurrentIndex(0);
|
ui->boardSelectBox->setCurrentIndex(0);
|
||||||
ui->writeTable->setCurrentIndex(0);
|
ui->writeTable->setCurrentIndex(0);
|
||||||
@@ -626,6 +562,19 @@ void M3KTE::onConnectClicked()
|
|||||||
//Опрос устройств
|
//Опрос устройств
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
QString style_fc_off = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(30) + ", 30, 30, 30%);} ";
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
Boards[i].boardScanners->stop();
|
||||||
|
}
|
||||||
|
for(int i = 0; i < 320; i++)
|
||||||
|
{
|
||||||
|
m_ProgressBar[i]->setStatusTip(QString("П%1 ТЭ%2: Топливный Элемент не учитывается.").arg(QString::number(i/85+1), QString::number(i%85)));
|
||||||
|
m_ProgressBar[i]->setWhatsThis(QString("П%1 ТЭ%2: Топливный Элемент не учитывается.").arg(QString::number(i/85+1), QString::number(i%85)));
|
||||||
|
m_ProgressBar[i]->setValue(3);
|
||||||
|
m_ProgressBar[i]->setStyleSheet(style_fc_off);
|
||||||
|
}
|
||||||
|
|
||||||
modbusDevice->disconnectDevice();
|
modbusDevice->disconnectDevice();
|
||||||
ui->ConnectionMenuConnect->setEnabled(true);
|
ui->ConnectionMenuConnect->setEnabled(true);
|
||||||
ui->ConnectionMenuDisconnect->setEnabled(false);
|
ui->ConnectionMenuDisconnect->setEnabled(false);
|
||||||
@@ -639,6 +588,8 @@ void M3KTE::onConnectClicked()
|
|||||||
ui->BSM_Warning->setEnabled(false);
|
ui->BSM_Warning->setEnabled(false);
|
||||||
ui->BSM_Accident->setEnabled(false);
|
ui->BSM_Accident->setEnabled(false);
|
||||||
ui->BSM_WorkInProgress->setEnabled(false);
|
ui->BSM_WorkInProgress->setEnabled(false);
|
||||||
|
|
||||||
|
ui->M3kteRegSettings->setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -649,6 +600,7 @@ void M3KTE::onReadButtonClicked()
|
|||||||
//ui->readValue->clear();
|
//ui->readValue->clear();
|
||||||
statusBar()->clearMessage();
|
statusBar()->clearMessage();
|
||||||
|
|
||||||
|
|
||||||
if (auto *reply = modbusDevice->sendReadRequest(readRequest(), Boards[ui->boardSelectBox->currentIndex()].adr)) {
|
if (auto *reply = modbusDevice->sendReadRequest(readRequest(), Boards[ui->boardSelectBox->currentIndex()].adr)) {
|
||||||
if (!reply->isFinished())
|
if (!reply->isFinished())
|
||||||
connect(reply, &QModbusReply::finished, this, &M3KTE::onReadReady);
|
connect(reply, &QModbusReply::finished, this, &M3KTE::onReadReady);
|
||||||
@@ -684,7 +636,7 @@ void M3KTE::onReadReady()
|
|||||||
if (reply->error() == QModbusDevice::NoError) {
|
if (reply->error() == QModbusDevice::NoError) {
|
||||||
const QModbusDataUnit unit = reply->result();
|
const QModbusDataUnit unit = reply->result();
|
||||||
int Adr = 255;
|
int Adr = 255;
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < CurrentConnectedDevice; i++)
|
||||||
{
|
{
|
||||||
if(Boards[i].adr==reply->serverAddress())
|
if(Boards[i].adr==reply->serverAddress())
|
||||||
{
|
{
|
||||||
@@ -692,19 +644,21 @@ void M3KTE::onReadReady()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = unit.startAddress(), total = int(unit.valueCount()); i < total; ++i) {
|
for (int i = 0, total = int(unit.valueCount()); i < total; ++i) {
|
||||||
//ui->readValue->addItem(entry);
|
//ui->readValue->addItem(entry);
|
||||||
if(unit.registerType() == QModbusDataUnit::Coils)
|
if(unit.registerType() == QModbusDataUnit::Coils)
|
||||||
{
|
{
|
||||||
//QStandardItem *item = ui->writeValueTable->model()->item
|
//QStandardItem *item = ui->writeValueTable->model()->item
|
||||||
|
Boards[Adr].coil[i + unit.startAddress()] = unit.value(i);
|
||||||
if(unit.value(i)==1)
|
if(unit.value(i)==1)
|
||||||
Boards[Adr].ModbusModelCoil->setData(ui->writeValueTable->model()->index(i, 2), Qt::Checked, Qt::CheckStateRole);
|
Boards[Adr].ModbusModelCoil->setData(ui->writeValueTable->model()->index(i + unit.startAddress(), 2), Qt::Checked, Qt::CheckStateRole);
|
||||||
else
|
else
|
||||||
Boards[Adr].ModbusModelCoil->setData(ui->writeValueTable->model()->index(i, 2), Qt::Unchecked, Qt::CheckStateRole);
|
Boards[Adr].ModbusModelCoil->setData(ui->writeValueTable->model()->index(i + unit.startAddress(), 2), Qt::Unchecked, Qt::CheckStateRole);
|
||||||
}
|
}
|
||||||
else if(unit.registerType() == QModbusDataUnit::HoldingRegisters)
|
else if(unit.registerType() == QModbusDataUnit::HoldingRegisters)
|
||||||
{
|
{
|
||||||
Boards[Adr].ModbusModelHoldingReg->setData(ui->writeValueTable->model()->index(i, 3), QString::number(unit.value(i), 16), Qt::EditRole);
|
Boards[Adr].HR[i + unit.startAddress()] = unit.value(i);
|
||||||
|
Boards[Adr].ModbusModelHoldingReg->setData(ui->writeValueTable->model()->index(i + unit.startAddress(), 3), QString::number(unit.value(i), 16), Qt::EditRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (reply->error() == QModbusDevice::ProtocolError) {
|
} else if (reply->error() == QModbusDevice::ProtocolError) {
|
||||||
@@ -730,10 +684,16 @@ void M3KTE::onWriteButtonClicked()
|
|||||||
QModbusDataUnit::RegisterType table = writeUnit.registerType();
|
QModbusDataUnit::RegisterType table = writeUnit.registerType();
|
||||||
for (int i = 0, total = int(writeUnit.valueCount()); i < total; ++i) {
|
for (int i = 0, total = int(writeUnit.valueCount()); i < total; ++i) {
|
||||||
if (table == QModbusDataUnit::Coils)
|
if (table == QModbusDataUnit::Coils)
|
||||||
|
{
|
||||||
|
Boards[ui->boardSelectBox->currentIndex()].coil[i+writeUnit.startAddress()] = Boards[ui->boardSelectBox->currentIndex()].ModbusModelCoil->m_coils[i + writeUnit.startAddress()];
|
||||||
writeUnit.setValue(i, Boards[ui->boardSelectBox->currentIndex()].ModbusModelCoil->m_coils[i + writeUnit.startAddress()]);
|
writeUnit.setValue(i, Boards[ui->boardSelectBox->currentIndex()].ModbusModelCoil->m_coils[i + writeUnit.startAddress()]);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
Boards[ui->boardSelectBox->currentIndex()].HR[i+writeUnit.startAddress()] = Boards[ui->boardSelectBox->currentIndex()].ModbusModelHoldingReg->m_holdingRegisters[i+writeUnit.startAddress()];
|
||||||
writeUnit.setValue(i, Boards[ui->boardSelectBox->currentIndex()].ModbusModelHoldingReg->m_holdingRegisters[i + writeUnit.startAddress()]);
|
writeUnit.setValue(i, Boards[ui->boardSelectBox->currentIndex()].ModbusModelHoldingReg->m_holdingRegisters[i + writeUnit.startAddress()]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (auto *reply = modbusDevice->sendWriteRequest(writeUnit, Boards[ui->boardSelectBox->currentIndex()].adr)) {
|
if (auto *reply = modbusDevice->sendWriteRequest(writeUnit, Boards[ui->boardSelectBox->currentIndex()].adr)) {
|
||||||
if (!reply->isFinished()) {
|
if (!reply->isFinished()) {
|
||||||
@@ -846,16 +806,50 @@ bool M3KTE::event(QEvent *event)
|
|||||||
BoardIdHasBeenChanged* _event = static_cast<BoardIdHasBeenChanged*>(event);
|
BoardIdHasBeenChanged* _event = static_cast<BoardIdHasBeenChanged*>(event);
|
||||||
QModbusDataUnit* _unit = new QModbusDataUnit(QModbusDataUnit::HoldingRegisters, 172, 1);
|
QModbusDataUnit* _unit = new QModbusDataUnit(QModbusDataUnit::HoldingRegisters, 172, 1);
|
||||||
_unit->setValue(0, _event->BoardNewID());
|
_unit->setValue(0, _event->BoardNewID());
|
||||||
modbusDevice->sendWriteRequest(*_unit, Boards[_event->BoardNum()].adr);
|
if (auto *reply = modbusDevice->sendWriteRequest(*_unit, Boards[_event->BoardNum()].adr))
|
||||||
if (auto *reply = modbusDevice->sendReadRequest(*_unit, Boards[_event->BoardNum()]._tmp_adr))
|
|
||||||
{
|
{
|
||||||
if (!reply->isFinished())
|
if(!reply->isFinished())
|
||||||
connect(reply, &QModbusReply::finished, this, &M3KTE::onReadReady);
|
connect(reply, &QModbusReply::finished, this, [reply, this, _event, _unit]()
|
||||||
|
{
|
||||||
|
if(reply->error()==QModbusDevice::TimeoutError)
|
||||||
|
{
|
||||||
|
if (auto *subreply = modbusDevice->sendReadRequest(*_unit, Boards[_event->BoardNum()]._tmp_adr))
|
||||||
|
{
|
||||||
|
if (!subreply->isFinished())
|
||||||
|
connect(subreply, &QModbusReply::finished, this, &M3KTE::checkAdrChange);
|
||||||
else
|
else
|
||||||
delete reply; // broadcast replies return immediately
|
{
|
||||||
|
errorAdrChange();
|
||||||
|
delete subreply; // broadcast replies return immediately
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
errorAdrChange();
|
errorAdrChange();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errorAdrChange();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete reply;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errorAdrChange();
|
||||||
|
}
|
||||||
|
// if (auto *reply = modbusDevice->sendReadRequest(*_unit, Boards[_event->BoardNum()]._tmp_adr))
|
||||||
|
// {
|
||||||
|
// if (!reply->isFinished())
|
||||||
|
// connect(reply, &QModbusReply::finished, this, &M3KTE::checkAdrChange);
|
||||||
|
// else
|
||||||
|
// delete reply; // broadcast replies return immediately
|
||||||
|
// } else {
|
||||||
|
// errorAdrChange();
|
||||||
|
// }
|
||||||
|
m_deviceSettingsDialog->show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return QWidget::event(event);
|
return QWidget::event(event);
|
||||||
@@ -870,7 +864,7 @@ void M3KTE::checkAdrChange()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (reply->error() == QModbusDevice::NoError) {
|
if (reply->error() == QModbusDevice::NoError) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < CurrentConnectedDevice; i++) {
|
||||||
if(Boards[i]._tmp_adr == reply->serverAddress())
|
if(Boards[i]._tmp_adr == reply->serverAddress())
|
||||||
{
|
{
|
||||||
//OK
|
//OK
|
||||||
@@ -903,14 +897,56 @@ void M3KTE::onSpeedUpdate()
|
|||||||
|
|
||||||
QModbusDataUnit* _unit = new QModbusDataUnit(QModbusDataUnit::HoldingRegisters, 173, 1);
|
QModbusDataUnit* _unit = new QModbusDataUnit(QModbusDataUnit::HoldingRegisters, 173, 1);
|
||||||
_unit->setValue(0, m_deviceSettingsDialog->currentSpeed());
|
_unit->setValue(0, m_deviceSettingsDialog->currentSpeed());
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < CurrentConnectedDevice; i++) {
|
||||||
modbusDevice->sendWriteRequest(*_unit, Boards[i].adr);
|
auto *reply = modbusDevice->sendWriteRequest(*_unit, Boards[i].adr);
|
||||||
}
|
{
|
||||||
|
if (!reply->isFinished())
|
||||||
|
connect(reply, &QModbusReply::finished, this, [this, reply, i](){
|
||||||
|
if(reply->error()==QModbusDevice::TimeoutError)
|
||||||
|
{
|
||||||
modbusDevice->disconnectDevice();
|
modbusDevice->disconnectDevice();
|
||||||
modbusDevice->setConnectionParameter(QModbusDevice::SerialBaudRateParameter,
|
modbusDevice->setConnectionParameter(QModbusDevice::SerialBaudRateParameter,
|
||||||
m_settingsDialog->UpdateBaud(m_deviceSettingsDialog->currentSpeed()));
|
m_settingsDialog->UpdateBaud(m_deviceSettingsDialog->currentSpeed()));
|
||||||
modbusDevice->connectDevice();
|
modbusDevice->connectDevice();
|
||||||
|
QModbusDataUnit* _unit = new QModbusDataUnit(QModbusDataUnit::InputRegisters, 85, 1);
|
||||||
|
if (auto *subreply = modbusDevice->sendReadRequest(*_unit, Boards[i].adr))
|
||||||
|
{
|
||||||
|
if (!subreply->isFinished())
|
||||||
|
connect(subreply, &QModbusReply::finished, this, [subreply, this, i](){
|
||||||
|
if(subreply->error() != QModbusDevice::NoError)
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(tr("Не удалось изменить скорость платы %1.").arg(i));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(tr("Не удалось изменить скорость платы %1.").arg(i));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
delete subreply; // broadcast replies return immediately
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(tr("Не удалось изменить скорость платы %1.").arg(i));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
else
|
||||||
|
delete reply; // broadcast replies return immediately
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void M3KTE::onParityUpdate()
|
void M3KTE::onParityUpdate()
|
||||||
@@ -936,14 +972,53 @@ void M3KTE::onParityUpdate()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < CurrentConnectedDevice; i++) {
|
||||||
modbusDevice->sendWriteRequest(*_unit, Boards[i].adr);
|
auto *reply = modbusDevice->sendWriteRequest(*_unit, Boards[i].adr);
|
||||||
}
|
{
|
||||||
|
if (!reply->isFinished())
|
||||||
|
connect(reply, &QModbusReply::finished, this, [this, reply, i](){
|
||||||
|
if(reply->error()==QModbusDevice::TimeoutError)
|
||||||
|
{
|
||||||
modbusDevice->disconnectDevice();
|
modbusDevice->disconnectDevice();
|
||||||
modbusDevice->setConnectionParameter(QModbusDevice::SerialParityParameter,
|
modbusDevice->setConnectionParameter(QModbusDevice::SerialParityParameter,
|
||||||
m_settingsDialog->UpdateParity(m_deviceSettingsDialog->currentParity()));
|
m_settingsDialog->UpdateParity(m_deviceSettingsDialog->currentParity()));
|
||||||
modbusDevice->connectDevice();
|
modbusDevice->connectDevice();
|
||||||
|
QModbusDataUnit* _unit = new QModbusDataUnit(QModbusDataUnit::InputRegisters, 85, 1);
|
||||||
|
if (auto *subreply = modbusDevice->sendReadRequest(*_unit, Boards[i].adr))
|
||||||
|
{
|
||||||
|
if (!subreply->isFinished())
|
||||||
|
connect(subreply, &QModbusReply::finished, this, [subreply, this, i](){
|
||||||
|
if(subreply->error() != QModbusDevice::NoError)
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(tr("Не удалось изменить чётность платы %1.").arg(i));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(tr("Не удалось изменить чётность платы %1.").arg(i));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
delete subreply; // broadcast replies return immediately
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(tr("Не удалось изменить чётность платы %1.").arg(i));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
else
|
||||||
|
delete reply; // broadcast replies return immediately
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool M3KTE::pingNetworkDevices()
|
bool M3KTE::pingNetworkDevices()
|
||||||
@@ -955,40 +1030,68 @@ bool M3KTE::pingNetworkDevices()
|
|||||||
QModbusDataUnit* _unit = new QModbusDataUnit(QModbusDataUnit::InputRegisters, 85, 1);
|
QModbusDataUnit* _unit = new QModbusDataUnit(QModbusDataUnit::InputRegisters, 85, 1);
|
||||||
int tmp_adr = 1;
|
int tmp_adr = 1;
|
||||||
|
|
||||||
|
bool isRun = false;
|
||||||
|
bool *tmp_isRun = &isRun;
|
||||||
auto bar = new QProgressDialog(this);
|
auto bar = new QProgressDialog(this);
|
||||||
|
connect(bar, &QProgressDialog::canceled, this, [this, tmp_isRun]()
|
||||||
|
{
|
||||||
|
*tmp_isRun = true;
|
||||||
|
});
|
||||||
bar->setLabelText(tr("Поиск плат..."));
|
bar->setLabelText(tr("Поиск плат..."));
|
||||||
bar->setCancelButton(nullptr);
|
bar->setCancelButton(nullptr);
|
||||||
bar->setRange(0, 4);
|
bar->setRange(0, 4);
|
||||||
bar->setMinimumDuration(100);
|
bar->setMinimumDuration(100);
|
||||||
bar->setValue(i);
|
bar->setValue(i);
|
||||||
|
|
||||||
|
CurrentConnectedDevice = 0;
|
||||||
|
|
||||||
for(i=0; i<1;)
|
for(i=0; i<4;)
|
||||||
{
|
{
|
||||||
bar->setValue(i);
|
|
||||||
|
if(isRun && CurrentConnectedDevice < 1)
|
||||||
|
{
|
||||||
|
onConnectClicked();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(isRun)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
timerForPingSignal = false;
|
timerForPingSignal = false;
|
||||||
timer->start(m_settingsDialog->settings().responseTime);
|
timer->start(m_settingsDialog->settings().responseTime);
|
||||||
auto *reply = modbusDevice->sendReadRequest(*_unit, tmp_adr);
|
auto *reply = modbusDevice->sendReadRequest(*_unit, tmp_adr);
|
||||||
while(!reply->isFinished() && !timerForPingSignal)
|
while(!reply->isFinished() && !timerForPingSignal)
|
||||||
{
|
{
|
||||||
|
if(isRun && CurrentConnectedDevice < 1)
|
||||||
|
{
|
||||||
|
onConnectClicked();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(isRun)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
if(timerForPingSignal)
|
if(timerForPingSignal)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(reply->error()==QModbusDevice::NoError)
|
if(reply->error()==QModbusDevice::NoError)
|
||||||
{
|
{
|
||||||
timer->stop();
|
timer->stop();
|
||||||
|
CurrentConnectedDevice++;
|
||||||
Boards[i].adr = Boards[i]._tmp_adr = tmp_adr;
|
Boards[i].adr = Boards[i]._tmp_adr = tmp_adr;
|
||||||
|
statusBar()->showMessage(tr("Плата %1 найдена по адресу %2.").arg(i).arg(tmp_adr), m_settingsDialog->settings().responseTime);
|
||||||
i++;
|
i++;
|
||||||
|
bar->setValue(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmp_adr++;
|
tmp_adr++;
|
||||||
if(tmp_adr>=247)
|
bar->setLabelText(tr("Поиск плат... Текущий адрес: %1").arg(tmp_adr));
|
||||||
|
if(tmp_adr>=247 && (CurrentConnectedDevice<1))
|
||||||
{
|
{
|
||||||
//ERROR
|
//ERROR
|
||||||
//OUT OF RANGE
|
//OUT OF RANGE
|
||||||
@@ -998,25 +1101,48 @@ bool M3KTE::pingNetworkDevices()
|
|||||||
onConnectClicked();
|
onConnectClicked();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if(tmp_adr>=247)
|
||||||
|
{
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
bar->setLabelText(tr("Сканирование регистров..."));
|
}
|
||||||
bar->setValue(0);
|
isRun=false;
|
||||||
bar->setRange(0, 12);
|
QMessageBox::warning(this, "Сканирование сети завершено.", tr("Найдено плат: %1 из 4.").arg(i));
|
||||||
|
if(isRun)
|
||||||
|
{
|
||||||
|
onConnectClicked();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bar->setLabelText(tr("Считывание текущих настроек..."));
|
||||||
|
|
||||||
|
bar->setRange(0, CurrentConnectedDevice*3);
|
||||||
QModbusDataUnit* _unit_settings[3];
|
QModbusDataUnit* _unit_settings[3];
|
||||||
_unit_settings[0] = new QModbusDataUnit(QModbusDataUnit::Coils, 0, 85);
|
_unit_settings[0] = new QModbusDataUnit(QModbusDataUnit::Coils, 0, 85);
|
||||||
_unit_settings[1] = new QModbusDataUnit(QModbusDataUnit::HoldingRegisters, 0, 85);
|
_unit_settings[1] = new QModbusDataUnit(QModbusDataUnit::HoldingRegisters, 0, 85);
|
||||||
_unit_settings[2] = new QModbusDataUnit(QModbusDataUnit::HoldingRegisters, 85, 85);
|
_unit_settings[2] = new QModbusDataUnit(QModbusDataUnit::HoldingRegisters, 85, 85);
|
||||||
|
|
||||||
for(i=0; i<1; i++)
|
for(i=0; i<CurrentConnectedDevice; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j<3; j++)
|
for (int j = 0; j<3; j++)
|
||||||
{
|
{
|
||||||
bar->setValue(i*3+j);
|
bar->setValue(i*3+j);
|
||||||
|
if(isRun)
|
||||||
|
{
|
||||||
|
onConnectClicked();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
timerForPingSignal = false;
|
timerForPingSignal = false;
|
||||||
timer->start(m_settingsDialog->settings().responseTime);
|
timer->start(m_settingsDialog->settings().responseTime);
|
||||||
auto *reply = modbusDevice->sendReadRequest(*_unit_settings[j], Boards[i].adr);
|
auto *reply = modbusDevice->sendReadRequest(*_unit_settings[j], Boards[i].adr);
|
||||||
while(!reply->isFinished() && !timerForPingSignal)
|
while(!reply->isFinished() && !timerForPingSignal)
|
||||||
{
|
{
|
||||||
|
if(isRun)
|
||||||
|
{
|
||||||
|
onConnectClicked();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
if(timerForPingSignal)
|
if(timerForPingSignal)
|
||||||
@@ -1035,7 +1161,7 @@ bool M3KTE::pingNetworkDevices()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, "Ошибка при получении текущих настроек.", QString("Таймаут при опросе устройства %1 по адресу %2").arg(i).arg(Boards[i].adr));
|
QMessageBox::warning(this, "Ошибка при получении текущих настроек.", QString("Таймаут при опросе устройства %1 по адресу %2").arg(i).arg(Boards[i].adr));
|
||||||
bar->setValue(12);
|
bar->setValue(CurrentConnectedDevice*3);
|
||||||
onConnectClicked();
|
onConnectClicked();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1055,10 +1181,14 @@ void M3KTE::timeForPingIsGone()
|
|||||||
|
|
||||||
void M3KTE::beginScanBoards()
|
void M3KTE::beginScanBoards()
|
||||||
{
|
{
|
||||||
|
if(CurrentConnectedDevice>=1)
|
||||||
firstBoardScan();
|
firstBoardScan();
|
||||||
//secondBoardScan();
|
if(CurrentConnectedDevice>=2)
|
||||||
//thirdBoardScan();
|
secondBoardScan();
|
||||||
//fourthBoardScan();
|
if(CurrentConnectedDevice>=3)
|
||||||
|
thirdBoardScan();
|
||||||
|
if(CurrentConnectedDevice>=4)
|
||||||
|
fourthBoardScan();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1193,40 +1323,46 @@ void M3KTE::displayResultOfScan(QModbusReply *reply, int boardID)
|
|||||||
{
|
{
|
||||||
//QErrorMessage::showMessage()
|
//QErrorMessage::showMessage()
|
||||||
//if(Boards[boardID].ModbusModelCoil->data(Boards[boardID].ModbusModelCoil->index(i, 2), Qt::CheckStateRole).Bool != 0)
|
//if(Boards[boardID].ModbusModelCoil->data(Boards[boardID].ModbusModelCoil->index(i, 2), Qt::CheckStateRole).Bool != 0)
|
||||||
if(Boards[boardID].ModbusModelCoil->get_coil(Boards[boardID].ModbusModelCoil->index(i, 2))==true)
|
//if(Boards[boardID].ModbusModelCoil->get_coil(Boards[boardID].ModbusModelCoil->index(i, 2))==true)
|
||||||
|
if(Boards[boardID].coil[i]==true)
|
||||||
{
|
{
|
||||||
int j = 0;
|
int j = 0;
|
||||||
if(Boards[boardID].ModbusModelHoldingReg->get_holreg(Boards[boardID].ModbusModelHoldingReg->index(85+i, 3)) > unit.value(i))
|
//if(Boards[boardID].ModbusModelHoldingReg->get_holreg(Boards[boardID].ModbusModelHoldingReg->index(85+i, 3)) > unit.value(i))
|
||||||
|
if(Boards[boardID].HR[i + 85] > unit.value(i))
|
||||||
{
|
{
|
||||||
j = 1;
|
j = 1;
|
||||||
m[i+boardID*85]->setStatusTip(QString("П%1 ТЭ%2: Аварийный уровень напряжения.").arg(QString::number(boardID+1), QString::number(i%85)));
|
m_ProgressBar[i+boardID*85]->setStatusTip(QString("П%1 ТЭ%2: Аварийный уровень напряжения.").arg(QString::number(boardID+1), QString::number(i%85)));
|
||||||
m[i+boardID*85]->setWhatsThis(QString("П%1 ТЭ%2: Аварийный уровень напряжения.").arg(QString::number(boardID+1), QString::number(i%85)));
|
m_ProgressBar[i+boardID*85]->setWhatsThis(QString("П%1 ТЭ%2: Аварийный уровень напряжения.").arg(QString::number(boardID+1), QString::number(i%85)));
|
||||||
A_Flag = true;
|
A_Flag = true;
|
||||||
}
|
}
|
||||||
else if(Boards[boardID].ModbusModelHoldingReg->get_holreg(Boards[boardID].ModbusModelHoldingReg->index(i, 3)) > unit.value(i))
|
//else if(Boards[boardID].ModbusModelHoldingReg->get_holreg(Boards[boardID].ModbusModelHoldingReg->index(i, 3)) > unit.value(i))
|
||||||
|
else if(Boards[boardID].HR[i] > unit.value(i))
|
||||||
{
|
{
|
||||||
j = 2;
|
j = 2;
|
||||||
m[i+boardID*85]->setStatusTip(QString("П%1 ТЭ%2: Предупредительный уровень напряжения.").arg(QString::number(boardID+1), QString::number(i%85)));
|
m_ProgressBar[i+boardID*85]->setStatusTip(QString("П%1 ТЭ%2: Предупредительный уровень напряжения.").arg(QString::number(boardID+1), QString::number(i%85)));
|
||||||
m[i+boardID*85]->setWhatsThis(QString("П%1 ТЭ%2: Предупредительный уровень напряжения.").arg(QString::number(boardID+1), QString::number(i%85)));
|
m_ProgressBar[i+boardID*85]->setWhatsThis(QString("П%1 ТЭ%2: Предупредительный уровень напряжения.").arg(QString::number(boardID+1), QString::number(i%85)));
|
||||||
W_Flag = true;
|
W_Flag = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
j = 3;
|
j = 3;
|
||||||
m[i+boardID*85]->setStatusTip(QString("П%1 ТЭ%2: Уровень напряжения в норме.").arg(QString::number(boardID+1), QString::number(i%85)));
|
m_ProgressBar[i+boardID*85]->setStatusTip(QString("П%1 ТЭ%2: Уровень напряжения в норме.").arg(QString::number(boardID+1), QString::number(i%85)));
|
||||||
m[i+boardID*85]->setWhatsThis(QString("П%1 ТЭ%2: Уровень напряжения в норме.").arg(QString::number(boardID+1), QString::number(i%85)));
|
m_ProgressBar[i+boardID*85]->setWhatsThis(QString("П%1 ТЭ%2: Уровень напряжения в норме.").arg(QString::number(boardID+1), QString::number(i%85)));
|
||||||
}
|
}
|
||||||
m[i+boardID*85]->setValue(j);
|
m_ProgressBar[i+boardID*85]->setValue(j);
|
||||||
QString style_fc = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(j*50-50) + ", 255, 255, 100%);} ";
|
QString style_fc = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(j*50-50) + ", 255, 255, 100%);} ";
|
||||||
m[i+boardID*85]->setStyleSheet(style_fc);
|
m_ProgressBar[i+boardID*85]->setStyleSheet(style_fc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m[i+boardID*85]->setStatusTip(QString("П%1 ТЭ%2: Топливный Элемент не учитывается.").arg(QString::number(boardID+1), QString::number(i%85)));
|
m_ProgressBar[i+boardID*85]->setValue(3);
|
||||||
m[i+boardID*85]->setWhatsThis(QString("П%1 ТЭ%2: Топливный Элемент не учитывается.").arg(QString::number(boardID+1), QString::number(i%85)));
|
m_ProgressBar[i+boardID*85]->setStatusTip(QString("П%1 ТЭ%2: Топливный Элемент не учитывается.").arg(QString::number(boardID+1), QString::number(i%85)));
|
||||||
|
m_ProgressBar[i+boardID*85]->setWhatsThis(QString("П%1 ТЭ%2: Топливный Элемент не учитывается.").arg(QString::number(boardID+1), QString::number(i%85)));
|
||||||
QString style_fc_off = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(30) + ", 30, 30, 30%);} ";
|
QString style_fc_off = "QProgressBar {border: 2px solid black; font: bold 10px} QProgressBar::chunk {background: hsva(" + QString::number(30) + ", 30, 30, 30%);} ";
|
||||||
m[i+boardID*85]->setStyleSheet(style_fc_off);
|
m_ProgressBar[i+boardID*85]->setStyleSheet(style_fc_off);
|
||||||
}
|
}
|
||||||
|
Boards[boardID].ModbusModelCoil->set_currentU(unit.value(i), i);
|
||||||
|
Boards[boardID].ModbusModelHoldingReg->set_currentU(unit.value(i), i);
|
||||||
}
|
}
|
||||||
if(A_Flag)
|
if(A_Flag)
|
||||||
statusM3KTE.Accidents[boardID] = true;
|
statusM3KTE.Accidents[boardID] = true;
|
||||||
@@ -1281,19 +1417,26 @@ void M3KTE::stepForScanCurrentSettings(QModbusReply *reply)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = unit.startAddress(), total = int(unit.valueCount()); i < total; ++i) {
|
for (int i = 0, total = int(unit.valueCount()); i < (total); ++i) {
|
||||||
//ui->readValue->addItem(entry);
|
//ui->readValue->addItem(entry);
|
||||||
if(unit.registerType() == QModbusDataUnit::Coils)
|
if(unit.registerType() == QModbusDataUnit::Coils)
|
||||||
{
|
{
|
||||||
|
Boards[Adr].coil[i + unit.startAddress()] = unit.value(i);
|
||||||
//QStandardItem *item = ui->writeValueTable->model()->item
|
//QStandardItem *item = ui->writeValueTable->model()->item
|
||||||
if(unit.value(i)==1)
|
if(unit.value(i)==1)
|
||||||
Boards[Adr].ModbusModelCoil->setData(ui->writeValueTable->model()->index(i, 2), Qt::Checked, Qt::CheckStateRole);
|
{
|
||||||
|
Boards[Adr].ModbusModelCoil->setData(ui->writeValueTable->model()->index(i + unit.startAddress(), 2), Qt::Checked, Qt::CheckStateRole);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Boards[Adr].ModbusModelCoil->setData(ui->writeValueTable->model()->index(i, 2), Qt::Unchecked, Qt::CheckStateRole);
|
{
|
||||||
|
Boards[Adr].ModbusModelCoil->setData(ui->writeValueTable->model()->index(i + unit.startAddress(), 2), Qt::Unchecked, Qt::CheckStateRole);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(unit.registerType() == QModbusDataUnit::HoldingRegisters)
|
else if(unit.registerType() == QModbusDataUnit::HoldingRegisters)
|
||||||
{
|
{
|
||||||
Boards[Adr].ModbusModelHoldingReg->setData(ui->writeValueTable->model()->index(i, 3), QString::number(unit.value(i), 16), Qt::EditRole);
|
Boards[Adr].HR[i + unit.startAddress()] = unit.value(i);
|
||||||
|
Boards[Adr].ModbusModelHoldingReg->setData(Boards[Adr].ModbusModelHoldingReg->index(i + unit.startAddress(), 3), QString::number(unit.value(i), 16), Qt::EditRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (reply->error() == QModbusDevice::ProtocolError) {
|
} else if (reply->error() == QModbusDevice::ProtocolError) {
|
||||||
@@ -1308,3 +1451,88 @@ void M3KTE::stepForScanCurrentSettings(QModbusReply *reply)
|
|||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void M3KTE::slotmultipleRegWrite()
|
||||||
|
{
|
||||||
|
if (!modbusDevice)
|
||||||
|
return;
|
||||||
|
multipleRegWrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
void M3KTE::slotmultipleRegWriteAndSend()
|
||||||
|
{
|
||||||
|
if (!modbusDevice)
|
||||||
|
return;
|
||||||
|
multipleRegWrite();
|
||||||
|
multipleRegSend();
|
||||||
|
}
|
||||||
|
|
||||||
|
void M3KTE::multipleRegSend()
|
||||||
|
{
|
||||||
|
QModbusDataUnit *unit_tx = nullptr;
|
||||||
|
if(m_regMultipleSettings->getTypeReg())
|
||||||
|
{
|
||||||
|
unit_tx = new QModbusDataUnit(QModbusDataUnit::HoldingRegisters, m_regMultipleSettings->getStartAdr(), m_regMultipleSettings->getCountReg());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unit_tx = new QModbusDataUnit(QModbusDataUnit::Coils, m_regMultipleSettings->getStartAdr(), m_regMultipleSettings->getCountReg());
|
||||||
|
}
|
||||||
|
for (unsigned i = 0; i < m_regMultipleSettings->getCountReg(); i++) {
|
||||||
|
unit_tx->setValue(i, m_regMultipleSettings->getNewValue());
|
||||||
|
if(m_regMultipleSettings->getTypeReg())
|
||||||
|
{
|
||||||
|
Boards[m_regMultipleSettings->getBoardId()].HR[i+m_regMultipleSettings->getStartAdr()] = m_regMultipleSettings->getNewValue();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Boards[m_regMultipleSettings->getBoardId()].coil[i+m_regMultipleSettings->getStartAdr()] = m_regMultipleSettings->getNewValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto *reply = modbusDevice->sendWriteRequest(*unit_tx, Boards[m_regMultipleSettings->getBoardId()].adr)) {
|
||||||
|
if (!reply->isFinished()) {
|
||||||
|
connect(reply, &QModbusReply::finished, this, [this, reply]() {
|
||||||
|
if (reply->error() == QModbusDevice::ProtocolError) {
|
||||||
|
statusBar()->showMessage(tr("Write response error: %1 (Mobus exception: 0x%2)")
|
||||||
|
.arg(reply->errorString()).arg(reply->rawResult().exceptionCode(), -1, 16),
|
||||||
|
5000);
|
||||||
|
} else if (reply->error() != QModbusDevice::NoError) {
|
||||||
|
statusBar()->showMessage(tr("Write response error: %1 (code: 0x%2)").
|
||||||
|
arg(reply->errorString()).arg(reply->error(), -1, 16), 5000);
|
||||||
|
}
|
||||||
|
reply->deleteLater();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// broadcast replies return immediately
|
||||||
|
reply->deleteLater();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
statusBar()->showMessage(tr("Write error: ") + modbusDevice->errorString(), 5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void M3KTE::multipleRegWrite()
|
||||||
|
{
|
||||||
|
for (unsigned i = 0; i < m_regMultipleSettings->getCountReg(); i++) {
|
||||||
|
if(m_regMultipleSettings->getTypeReg())
|
||||||
|
{
|
||||||
|
//Boards[m_regMultipleSettings->getBoardId()].HR[i] = m_regMultipleSettings->getNewValue();
|
||||||
|
Boards[m_regMultipleSettings->getBoardId()].ModbusModelHoldingReg->m_holdingRegisters[i+m_regMultipleSettings->getStartAdr()] = m_regMultipleSettings->getNewValue();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Boards[m_regMultipleSettings->getBoardId()].coil[i] = m_regMultipleSettings->getNewValue();
|
||||||
|
Boards[m_regMultipleSettings->getBoardId()].ModbusModelCoil->m_coils[i+m_regMultipleSettings->getStartAdr()] = (bool)m_regMultipleSettings->getNewValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void M3KTE::selectPositionOnTree(unsigned int index)
|
||||||
|
{
|
||||||
|
ui->boardSelectBox->setCurrentIndex(index/85);
|
||||||
|
QModelIndex selected = ui->writeValueTable->model()->index(index%85, 0);
|
||||||
|
ui->writeValueTable->selectionModel()->select(selected, QItemSelectionModel::ClearAndSelect |QItemSelectionModel::Rows);
|
||||||
|
ui->writeValueTable->scrollTo(selected);
|
||||||
|
//selection
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <QtSerialBus/QModbusDataUnit>
|
#include <QtSerialBus/QModbusDataUnit>
|
||||||
#include "writeregistermodel.h"
|
#include "writeregistermodel.h"
|
||||||
#include "devicesettingsdialog.h"
|
#include "devicesettingsdialog.h"
|
||||||
|
#include "multiplesettings.h"
|
||||||
|
|
||||||
#include <QModbusTcpClient>
|
#include <QModbusTcpClient>
|
||||||
#include <QModbusRtuSerialMaster>
|
#include <QModbusRtuSerialMaster>
|
||||||
@@ -16,6 +17,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
#include <QErrorMessage>
|
#include <QErrorMessage>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
#include <QtSerialBus/qtserialbusglobal.h>
|
#include <QtSerialBus/qtserialbusglobal.h>
|
||||||
|
|
||||||
@@ -45,7 +47,16 @@ private:
|
|||||||
void beginScanBoards();
|
void beginScanBoards();
|
||||||
void displayResultOfScan(QModbusReply *reply, int boardID);
|
void displayResultOfScan(QModbusReply *reply, int boardID);
|
||||||
void stepForScanCurrentSettings(QModbusReply *reply);
|
void stepForScanCurrentSettings(QModbusReply *reply);
|
||||||
|
|
||||||
|
void multipleRegWrite();
|
||||||
|
void multipleRegSend();
|
||||||
|
|
||||||
|
void selectPositionOnTree(unsigned index);
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
void slotmultipleRegWrite();
|
||||||
|
void slotmultipleRegWriteAndSend();
|
||||||
|
|
||||||
void onConnectClicked();
|
void onConnectClicked();
|
||||||
|
|
||||||
void onReadButtonClicked();
|
void onReadButtonClicked();
|
||||||
@@ -62,7 +73,6 @@ private slots:
|
|||||||
void onSpeedUpdate();
|
void onSpeedUpdate();
|
||||||
void onParityUpdate();
|
void onParityUpdate();
|
||||||
|
|
||||||
|
|
||||||
void firstBoardScan();
|
void firstBoardScan();
|
||||||
void secondBoardScan();
|
void secondBoardScan();
|
||||||
void thirdBoardScan();
|
void thirdBoardScan();
|
||||||
@@ -77,17 +87,17 @@ public:
|
|||||||
~M3KTE();
|
~M3KTE();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool timerForPingSignal = false;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Ui::M3KTE *ui;
|
Ui::M3KTE *ui;
|
||||||
|
bool timerForPingSignal = false;
|
||||||
|
int CurrentConnectedDevice = 0;
|
||||||
//int DeviceOnNetwork[4];
|
//int DeviceOnNetwork[4];
|
||||||
QProgressBar *m[320];
|
QProgressBar *m_ProgressBar[320];
|
||||||
|
QPushButton *ThePhantomMenace[320];
|
||||||
QModbusReply *lastRequest = nullptr;
|
QModbusReply *lastRequest = nullptr;
|
||||||
QModbusClient *modbusDevice = nullptr;
|
QModbusClient *modbusDevice = nullptr;
|
||||||
DeviceSettingsDialog *m_deviceSettingsDialog = nullptr;
|
DeviceSettingsDialog *m_deviceSettingsDialog = nullptr;
|
||||||
SettingsDialog *m_settingsDialog = nullptr;
|
SettingsDialog *m_settingsDialog = nullptr;
|
||||||
|
MultipleSettings *m_regMultipleSettings = nullptr;
|
||||||
//WriteRegisterModel *writeModel = nullptr;
|
//WriteRegisterModel *writeModel = nullptr;
|
||||||
|
|
||||||
struct StatusM3KTE{
|
struct StatusM3KTE{
|
||||||
@@ -99,6 +109,10 @@ private:
|
|||||||
{
|
{
|
||||||
int adr;
|
int adr;
|
||||||
int _tmp_adr;
|
int _tmp_adr;
|
||||||
|
|
||||||
|
bool coil[85];
|
||||||
|
unsigned HR[170];
|
||||||
|
|
||||||
WriteRegisterModel *ModbusModelCoil;
|
WriteRegisterModel *ModbusModelCoil;
|
||||||
WriteRegisterModel *ModbusModelHoldingReg;
|
WriteRegisterModel *ModbusModelHoldingReg;
|
||||||
QTimer *boardScanners;
|
QTimer *boardScanners;
|
||||||
|
|||||||
14766
M3KTE_TERM/m3kte.ui
14766
M3KTE_TERM/m3kte.ui
File diff suppressed because it is too large
Load Diff
75
M3KTE_TERM/multiplesettings.cpp
Normal file
75
M3KTE_TERM/multiplesettings.cpp
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
#include "multiplesettings.h"
|
||||||
|
#include "ui_multiplesettings.h"
|
||||||
|
|
||||||
|
MultipleSettings::MultipleSettings(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::MultipleSettings)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setText("Записать");
|
||||||
|
ui->buttonBox->button(QDialogButtonBox::SaveAll)->setText("Записать и установить");
|
||||||
|
}
|
||||||
|
|
||||||
|
MultipleSettings::~MultipleSettings()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MultipleSettings::on_buttonBox_clicked(QAbstractButton *button)
|
||||||
|
{
|
||||||
|
if(button == ui->buttonBox->button(QDialogButtonBox::Ok))
|
||||||
|
{
|
||||||
|
newValue = ui->regValueLine->text().toInt(nullptr, 16);
|
||||||
|
typeReg = ui->regTypeBox->currentIndex();
|
||||||
|
startAdr = ui->adrBox->value();
|
||||||
|
countReg = ui->countBox->value();
|
||||||
|
boardId = ui->boardBox->currentIndex();
|
||||||
|
emit write();
|
||||||
|
}
|
||||||
|
else if (button == ui->buttonBox->button(QDialogButtonBox::SaveAll))
|
||||||
|
{
|
||||||
|
newValue = ui->regValueLine->text().toInt(nullptr, 16);
|
||||||
|
typeReg = ui->regTypeBox->currentIndex();
|
||||||
|
startAdr = ui->adrBox->value();
|
||||||
|
countReg = ui->countBox->value();
|
||||||
|
boardId = ui->boardBox->currentIndex();
|
||||||
|
emit writeAndSend();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MultipleSettings::on_regTypeBox_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
ui->adrBox->setRange(0, 84);
|
||||||
|
ui->adrBox->setValue(0);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
ui->adrBox->setRange(85, 170);
|
||||||
|
ui->adrBox->setValue(85);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MultipleSettings::on_boardBox_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
switch (index) {
|
||||||
|
case 3:
|
||||||
|
ui->countBox->setRange(1, 65-ui->adrBox->value()+85*ui->regTypeBox->currentIndex()/2);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ui->countBox->setRange(1, 85-ui->adrBox->value()+85*ui->regTypeBox->currentIndex()/2);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MultipleSettings::on_adrBox_valueChanged(int arg1)
|
||||||
|
{
|
||||||
|
ui->countBox->setRange(1, ((85-(20*(ui->boardBox->currentIndex()/3)))*(1+(ui->regTypeBox->currentIndex()/2))-arg1));
|
||||||
|
}
|
||||||
45
M3KTE_TERM/multiplesettings.h
Normal file
45
M3KTE_TERM/multiplesettings.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#ifndef MULTIPLESETTINGS_H
|
||||||
|
#define MULTIPLESETTINGS_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MultipleSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MultipleSettings : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MultipleSettings(QWidget *parent = nullptr);
|
||||||
|
~MultipleSettings();
|
||||||
|
quint16 getNewValue() {return newValue;}
|
||||||
|
unsigned getStartAdr() {return startAdr;}
|
||||||
|
unsigned getCountReg() {return countReg;}
|
||||||
|
short getTypeReg() {return typeReg;}
|
||||||
|
short getBoardId() {return boardId;}
|
||||||
|
signals:
|
||||||
|
void write();
|
||||||
|
void writeAndSend();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_buttonBox_clicked(QAbstractButton *button);
|
||||||
|
|
||||||
|
void on_regTypeBox_currentIndexChanged(int index);
|
||||||
|
|
||||||
|
void on_boardBox_currentIndexChanged(int index);
|
||||||
|
|
||||||
|
void on_adrBox_valueChanged(int arg1);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MultipleSettings *ui;
|
||||||
|
quint16 newValue = 0;
|
||||||
|
unsigned startAdr;
|
||||||
|
unsigned countReg;
|
||||||
|
short typeReg;
|
||||||
|
short boardId;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MULTIPLESETTINGS_H
|
||||||
198
M3KTE_TERM/multiplesettings.ui
Normal file
198
M3KTE_TERM/multiplesettings.ui
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MultipleSettings</class>
|
||||||
|
<widget class="QDialog" name="MultipleSettings">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>381</width>
|
||||||
|
<height>128</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Уставка</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="4">
|
||||||
|
<widget class="QLabel" name="countLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Кол-во</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2" colspan="2">
|
||||||
|
<widget class="QLabel" name="adrLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Стартовый</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="boardLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Плата</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QSpinBox" name="adrBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>84</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QComboBox" name="boardBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>2</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>3</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>4</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QSpinBox" name="countBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>85</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="5">
|
||||||
|
<widget class="QLineEdit" name="regValueLine"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="5">
|
||||||
|
<widget class="QLabel" name="regValueLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Значение (HEX)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="regTypeBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Coil</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Warning</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Accident</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="regTypeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Тип Регистра</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::SaveAll</set>
|
||||||
|
</property>
|
||||||
|
<property name="centerButtons">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>MultipleSettings</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>MultipleSettings</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
@@ -45,8 +45,8 @@ SettingsDialog::Settings SettingsDialog::settings() const
|
|||||||
|
|
||||||
int SettingsDialog::UpdateBaud(int baud)
|
int SettingsDialog::UpdateBaud(int baud)
|
||||||
{
|
{
|
||||||
ui->baudCombo->setCurrentText(QString::number(baud, 10));
|
ui->baudCombo->setCurrentIndex(baud);
|
||||||
return (m_settings.baud = baud);
|
return (m_settings.baud = ui->baudCombo->currentText().toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
int SettingsDialog::UpdateParity(int parity)
|
int SettingsDialog::UpdateParity(int parity)
|
||||||
@@ -60,3 +60,13 @@ int SettingsDialog::UpdateParity(int parity)
|
|||||||
return (m_settings.parity = parity);
|
return (m_settings.parity = parity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SettingsDialog::curBaud()
|
||||||
|
{
|
||||||
|
return ui->baudCombo->currentIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
int SettingsDialog::curParity()
|
||||||
|
{
|
||||||
|
return ui->parityCombo->currentIndex();
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ public:
|
|||||||
int baud = 115200;
|
int baud = 115200;
|
||||||
int dataBits = QSerialPort::Data8;
|
int dataBits = QSerialPort::Data8;
|
||||||
int stopBits = QSerialPort::OneStop;
|
int stopBits = QSerialPort::OneStop;
|
||||||
int responseTime = 1000;
|
int responseTime = 500;
|
||||||
int numberOfRetries = 3;
|
int numberOfRetries = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit SettingsDialog(QWidget *parent = nullptr);
|
explicit SettingsDialog(QWidget *parent = nullptr);
|
||||||
@@ -35,7 +35,8 @@ public:
|
|||||||
int UpdateBaud(int baud);
|
int UpdateBaud(int baud);
|
||||||
int UpdateParity(int parity);
|
int UpdateParity(int parity);
|
||||||
|
|
||||||
|
int curBaud();
|
||||||
|
int curParity();
|
||||||
private:
|
private:
|
||||||
Settings m_settings;
|
Settings m_settings;
|
||||||
Ui::SettingsDialog *ui;
|
Ui::SettingsDialog *ui;
|
||||||
|
|||||||
@@ -35,8 +35,11 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" rowspan="2" colspan="2">
|
<item row="2" column="1" rowspan="2" colspan="2">
|
||||||
<widget class="QSpinBox" name="retriesSpinner">
|
<widget class="QSpinBox" name="retriesSpinner">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -112,28 +115,18 @@
|
|||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="baudCombo">
|
<widget class="QComboBox" name="baudCombo">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>8</number>
|
<number>7</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1200</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>2400</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>4800</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>9600</string>
|
<string>9600</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>14400</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>19200</string>
|
<string>19200</string>
|
||||||
@@ -149,6 +142,11 @@
|
|||||||
<string>38400</string>
|
<string>38400</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>56000</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>57600</string>
|
<string>57600</string>
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
#include "writeregistermodel.h"
|
#include "writeregistermodel.h"
|
||||||
|
|
||||||
enum { NumColumn = 0, NameColumn = 1, CoilsColumn = 2, HoldingColumn = 3, ColumnCount = 4};
|
enum { NumColumn = 0, NameColumn = 1, CoilsColumn = 2, HoldingColumn = 3, ColumnCount = 5, CurrentUColumn = 4};
|
||||||
|
|
||||||
WriteRegisterModel::WriteRegisterModel(QObject *parent, int _tmpRC, bool _isHR)
|
WriteRegisterModel::WriteRegisterModel(QObject *parent, int _tmpRC, bool _isHR)
|
||||||
: QAbstractTableModel(parent),
|
: QAbstractTableModel(parent),
|
||||||
m_coils(RowCount=_tmpRC, false), m_holdingRegisters(RowCount=_tmpRC, 0u)
|
m_coils(RowCount=_tmpRC, false), m_holdingRegisters(RowCount=_tmpRC, 0u), m_currentU(RowCount=_tmpRC)
|
||||||
{
|
{
|
||||||
isHR=_isHR;
|
isHR=_isHR;
|
||||||
}
|
}
|
||||||
@@ -41,6 +41,9 @@ QVariant WriteRegisterModel::data(const QModelIndex &index, int role) const
|
|||||||
if (index.column() == HoldingColumn && role == Qt::DisplayRole) // holding registers
|
if (index.column() == HoldingColumn && role == Qt::DisplayRole) // holding registers
|
||||||
return QString("0x%1").arg(QString::number(m_holdingRegisters.at(index.row()), 16));
|
return QString("0x%1").arg(QString::number(m_holdingRegisters.at(index.row()), 16));
|
||||||
|
|
||||||
|
if(index.column() == CurrentUColumn && role == Qt::DisplayRole)
|
||||||
|
return QString("%1 В").arg(QString::number((double)((double)m_currentU.at(index.row())/(double)1000)));
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -60,6 +63,8 @@ QVariant WriteRegisterModel::headerData(int section, Qt::Orientation orientation
|
|||||||
return QStringLiteral("Coils");
|
return QStringLiteral("Coils");
|
||||||
case HoldingColumn:
|
case HoldingColumn:
|
||||||
return QStringLiteral("Holding Registers");
|
return QStringLiteral("Holding Registers");
|
||||||
|
case CurrentUColumn:
|
||||||
|
return QStringLiteral("Current U");
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -133,3 +138,11 @@ uint WriteRegisterModel::get_holreg(const QModelIndex &index)
|
|||||||
{
|
{
|
||||||
return m_holdingRegisters.at(index.row());
|
return m_holdingRegisters.at(index.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WriteRegisterModel::set_currentU(unsigned _tmpU, unsigned index)
|
||||||
|
{
|
||||||
|
m_currentU[index] = _tmpU;
|
||||||
|
if(isHR)
|
||||||
|
m_currentU[index + m_number] = _tmpU;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ public:
|
|||||||
|
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
|
|
||||||
|
bool set_currentU(unsigned _tmpU, unsigned index);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setStartAddress(int address);
|
void setStartAddress(int address);
|
||||||
void setNumberOfValues(const QString &number);
|
void setNumberOfValues(const QString &number);
|
||||||
@@ -36,5 +38,6 @@ public:
|
|||||||
int m_address = 0;
|
int m_address = 0;
|
||||||
QBitArray m_coils;
|
QBitArray m_coils;
|
||||||
QVector<quint16> m_holdingRegisters;
|
QVector<quint16> m_holdingRegisters;
|
||||||
|
QVector<quint16> m_currentU;
|
||||||
};
|
};
|
||||||
#endif // WRITEREGISTERMODEL_H
|
#endif // WRITEREGISTERMODEL_H
|
||||||
|
|||||||
Reference in New Issue
Block a user