@@ -13,6 +13,25 @@ DebugTerminalDialog::DebugTerminalDialog(QWidget *parent) :
m_modbusDevice ( nullptr )
{
ui - > setupUi ( this ) ;
boards [ 0 ] . error24V = ui - > discErr24TestChkBox_1 ;
boards [ 0 ] . error5V = ui - > discErr5TestChkBox_1 ;
boards [ 0 ] . error5VSCI = ui - > discErr5VsciTestChkBox_1 ;
boards [ 0 ] . error5VA = ui - > discErr5VATestChkBox_1 ;
boards [ 1 ] . error24V = ui - > discErr24TestChkBox_2 ;
boards [ 1 ] . error5V = ui - > discErr5TestChkBox_2 ;
boards [ 1 ] . error5VSCI = ui - > discErr5VsciTestChkBox_2 ;
boards [ 1 ] . error5VA = ui - > discErr5VATestChkBox_2 ;
boards [ 2 ] . error24V = ui - > discErr24TestChkBox_3 ;
boards [ 2 ] . error5V = ui - > discErr5TestChkBox_3 ;
boards [ 2 ] . error5VSCI = ui - > discErr5VsciTestChkBox_3 ;
boards [ 2 ] . error5VA = ui - > discErr5VATestChkBox_3 ;
boards [ 3 ] . error24V = ui - > discErr24TestChkBox_4 ;
boards [ 3 ] . error5V = ui - > discErr5TestChkBox_4 ;
boards [ 3 ] . error5VSCI = ui - > discErr5VsciTestChkBox_4 ;
boards [ 3 ] . error5VA = ui - > discErr5VATestChkBox_4 ;
initializeConnections ( ) ;
// Создаем AdcGraphDialog с nullptr
@@ -23,6 +42,10 @@ DebugTerminalDialog::~DebugTerminalDialog()
{
delete ui ;
}
void DebugTerminalDialog : : setMainTerm ( M3KTE * term )
{
mainTerm = term ;
}
void DebugTerminalDialog : : setModbusDevice ( QModbusClient * device )
{
@@ -59,78 +82,75 @@ void DebugTerminalDialog::closeEvent(QCloseEvent *event)
void DebugTerminalDialog : : initializeConnections ( )
{
// Подключаем кнопки OK и RestoreDefaults
connect( ui - > buttonBox , & QDialogButtonBox : : clicked , this , & DebugTerminalDialog: : on_buttonBox_clicked) ;
// // Подключаем кнопки OK и RestoreDefaults
// connect(ui->buttonBox, &QDialogButtonBox::clicked, this, & DebugTerminalDialog:: on_buttonBox_clicked);
// Подключаем все чекбоксы для платы 1
connect( ui - > continiusCallChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_continiusCallChkBox_1_stateChanged) ;
connect( ui - > calibrateCallChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_calibrateCallChkBox_1_stateChanged) ;
connect( ui - > pollTECallChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_pollTECallChkBox_1_stateChanged) ;
connect( ui - > resetKeyCallChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_resetKeyCallChkBox_1_stateChanged) ;
connect( ui - > resetDefaultCallChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_resetDefaultCallChkBox_1_stateChanged) ;
connect( ui - > getHardfaultCallChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_getHardfaultCallChkBox_1_stateChanged) ;
// // Подключаем все чекбоксы для платы 1
// connect(ui-> continiusCallChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_continiusCallChkBox_1_stateChanged);
// connect(ui-> calibrateCallChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_calibrateCallChkBox_1_stateChanged);
// connect(ui-> pollTECallChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_pollTECallChkBox_1_stateChanged);
// connect(ui-> resetKeyCallChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_resetKeyCallChkBox_1_stateChanged);
// connect(ui-> resetDefaultCallChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_resetDefaultCallChkBox_1_stateChanged);
// connect(ui-> getHardfaultCallChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_getHardfaultCallChkBox_1_stateChanged);
connect( ui - > enableLedTestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : enableLedTestChkBox_1_stateChanged) ;
// connect(ui-> enableLedTestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: enableLedTestChkBox_1_stateChanged);
connect( ui - > discWorkTestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discWorkTestChkBox_1_stateChanged) ;
connect( ui - > discWarnTestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discWarnTestChkBox_1_stateChanged) ;
connect( ui - > discErrTestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discErrTestChkBox_1_stateChanged) ;
// connect(ui-> discWorkTestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discWorkTestChkBox_1_stateChanged);
// connect(ui-> discWarnTestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discWarnTestChkBox_1_stateChanged);
// connect(ui-> discErrTestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discErrTestChkBox_1_stateChanged);
connect( ui - > discErr24TestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discErr24TestChkBox_1_stateChanged) ;
ui- > discErr24TestChkBox_1- > setAttribute( Qt : : WA_TransparentForMouseEvents, true ) ;
connect( ui - > discErr5TestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discErr5TestChkBox_1_stateChanged) ;
ui- > discErr5TestChkBox_1- > setAttribute( Qt : : WA_TransparentForMouseEvents, true ) ;
connect( ui - > discErr5VsciTestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discErr5VsciTestChkBox_1_stateChanged) ;
ui- > discErr5VsciTestChkBox_1- > setAttribute( Qt : : WA_TransparentForMouseEvents, true ) ;
connect( ui - > discErr5VATestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discErr5VATestChkBox_1_stateChanged) ;
ui- > discErr5VATestChkBox_1- > setAttribute( Qt : : WA_TransparentForMouseEvents, true ) ;
// connect(ui-> discErr24TestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discErr24TestChkBox_1_stateChanged);
// ui-> discErr24TestChkBox_1-> setAttribute(Qt:: WA_TransparentForMouseEvents, true);
// connect(ui-> discErr5TestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discErr5TestChkBox_1_stateChanged);
// ui-> discErr5TestChkBox_1-> setAttribute(Qt:: WA_TransparentForMouseEvents, true);
// connect(ui-> discErr5VsciTestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discErr5VsciTestChkBox_1_stateChanged);
// ui-> discErr5VsciTestChkBox_1-> setAttribute(Qt:: WA_TransparentForMouseEvents, true);
// connect(ui-> discErr5VATestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discErr5VATestChkBox_1_stateChanged);
// ui-> discErr5VATestChkBox_1-> setAttribute(Qt:: WA_TransparentForMouseEvents, true);
connect( ui - > ledWorkTestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledWorkTestChkBox_1_stateChanged) ;
connect( ui - > ledWarnTestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledWarnTestChkBox_1_stateChanged) ;
connect( ui - > ledErrTestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledErrTestChkBox_1_stateChanged) ;
connect( ui - > ledConnectTestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledConnectTestChkBox_1_stateChanged) ;
connect( ui - > ledVH1TestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledVH1TestChkBox_1_stateChanged) ;
connect( ui - > ledVH2TestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledVH2TestChkBox_1_stateChanged) ;
connect( ui - > ledVH3TestChkBox_1, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledVH3TestChkBox_1_stateChanged) ;
// connect(ui-> ledWorkTestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledWorkTestChkBox_1_stateChanged);
// connect(ui-> ledWarnTestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledWarnTestChkBox_1_stateChanged);
// connect(ui-> ledErrTestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledErrTestChkBox_1_stateChanged);
// connect(ui-> ledConnectTestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledConnectTestChkBox_1_stateChanged);
// connect(ui-> ledVH1TestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledVH1TestChkBox_1_stateChanged);
// connect(ui-> ledVH2TestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledVH2TestChkBox_1_stateChanged);
// connect(ui-> ledVH3TestChkBox_1, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledVH3TestChkBox_1_stateChanged);
// Подключаем все чекбоксы для платы 2
connect( ui - > continiusCallChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_continiusCallChkBox_2_stateChanged) ;
connect( ui - > calibrateCallChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_calibrateCallChkBox_2_stateChanged) ;
connect( ui - > pollTECallChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_pollTECallChkBox_2_stateChanged) ;
connect( ui - > resetKeyCallChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_resetKeyCallChkBox_2_stateChanged) ;
connect( ui - > resetDefaultCallChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_resetDefaultCallChkBox_2_stateChanged) ;
connect( ui - > getHardfaultCallChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_getHardfaultCallChkBox_2_stateChanged) ;
// // Подключаем все чекбоксы для платы 2
// connect(ui-> continiusCallChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_continiusCallChkBox_2_stateChanged);
// connect(ui-> calibrateCallChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_calibrateCallChkBox_2_stateChanged);
// connect(ui-> pollTECallChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_pollTECallChkBox_2_stateChanged);
// connect(ui-> resetKeyCallChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_resetKeyCallChkBox_2_stateChanged);
// connect(ui-> resetDefaultCallChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_resetDefaultCallChkBox_2_stateChanged);
// connect(ui-> getHardfaultCallChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_getHardfaultCallChkBox_2_stateChanged);
connect( ui - > enableLedTestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : enableLedTestChkBox_2_stateChanged) ;
// connect(ui-> enableLedTestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: enableLedTestChkBox_2_stateChanged);
connect( ui - > discWorkTestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discWorkTestChkBox_2_stateChanged) ;
connect( ui - > discWarnTestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discWarnTestChkBox_2_stateChanged) ;
connect( ui - > discErrTestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discErrTestChkBox_2_stateChanged) ;
// connect(ui-> discWorkTestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discWorkTestChkBox_2_stateChanged);
// connect(ui-> discWarnTestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discWarnTestChkBox_2_stateChanged);
// connect(ui-> discErrTestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discErrTestChkBox_2_stateChanged);
connect( ui - > discErr24TestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discErr24TestChkBox_2_stateChanged) ;
ui- > discErr24TestChkBox_2- > setAttribute( Qt : : WA_TransparentForMouseEvents, true ) ;
connect( ui - > discErr5TestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discErr5TestChkBox_2_stateChanged) ;
ui- > discErr5TestChkBox_2- > setAttribute( Qt : : WA_TransparentForMouseEvents, true ) ;
connect( ui - > discErr5VsciTestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discErr5VsciTestChkBox_2_stateChanged) ;
ui- > discErr5VsciTestChkBox_2- > setAttribute( Qt : : WA_TransparentForMouseEvents, true ) ;
connect( ui - > discErr5VATestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_discErr5VATestChkBox_2_stateChanged) ;
ui- > discErr5VATestChkBox_2- > setAttribute( Qt : : WA_TransparentForMouseEvents, true ) ;
// connect(ui-> discErr24TestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discErr24TestChkBox_2_stateChanged);
// ui-> discErr24TestChkBox_2-> setAttribute(Qt:: WA_TransparentForMouseEvents, true);
// connect(ui-> discErr5TestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discErr5TestChkBox_2_stateChanged);
// ui-> discErr5TestChkBox_2-> setAttribute(Qt:: WA_TransparentForMouseEvents, true);
// connect(ui-> discErr5VsciTestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discErr5VsciTestChkBox_2_stateChanged);
// ui-> discErr5VsciTestChkBox_2-> setAttribute(Qt:: WA_TransparentForMouseEvents, true);
// connect(ui-> discErr5VATestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_discErr5VATestChkBox_2_stateChanged);
// ui-> discErr5VATestChkBox_2-> setAttribute(Qt:: WA_TransparentForMouseEvents, true);
connect( ui - > ledWorkTestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledWorkTestChkBox_2_stateChanged) ;
connect( ui - > ledWarnTestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledWarnTestChkBox_2_stateChanged) ;
connect( ui - > ledErrTestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledErrTestChkBox_2_stateChanged) ;
connect( ui - > ledConnectTestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledConnectTestChkBox_2_stateChanged) ;
connect( ui - > ledVH1TestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledVH1TestChkBox_2_stateChanged) ;
connect( ui - > ledVH2TestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledVH2TestChkBox_2_stateChanged) ;
connect( ui - > ledVH3TestChkBox_2, & QCheckBox: : stateChanged, this , & DebugTerminalDialog: : on_ledVH3TestChkBox_2_stateChanged) ;
// connect(ui-> ledWorkTestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledWorkTestChkBox_2_stateChanged);
// connect(ui-> ledWarnTestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledWarnTestChkBox_2_stateChanged);
// connect(ui-> ledErrTestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledErrTestChkBox_2_stateChanged);
// connect(ui-> ledConnectTestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledConnectTestChkBox_2_stateChanged);
// connect(ui-> ledVH1TestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledVH1TestChkBox_2_stateChanged);
// connect(ui-> ledVH2TestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledVH2TestChkBox_2_stateChanged);
// connect(ui-> ledVH3TestChkBox_2, & QCheckBox:: stateChanged, this, & DebugTerminalDialog:: on_ledVH3TestChkBox_2_stateChanged);
}
void DebugTerminalDialog : : updateConnectionStatus ( int boardID , bool connected )
{
// Обновляем визуальное отображение статуса соединения
@@ -140,7 +160,6 @@ void DebugTerminalDialog::updateConnectionStatus(int boardID, bool connected)
// Реализация по необходимости
}
void DebugTerminalDialog : : on_buttonBox_clicked ( QAbstractButton * button )
{
switch ( ui - > buttonBox - > buttonRole ( button ) ) {
@@ -186,7 +205,7 @@ void DebugTerminalDialog::on_getHardfaultCallChkBox_1_stateChanged(int state)
}
// Реализация слотов для теста дискретных сигналов платы 1
void DebugTerminalDialog : : enableLedTestChkBox_1_stateChanged ( int state )
void DebugTerminalDialog : : on_ enableLedTestChkBox_1_stateChanged( int state )
{
writeCoil ( 0 , COIL_LED_TEST_ENABLE , state = = Qt : : Checked ? 1 : 0 ) ;
ui - > leds_1 - > setEnabled ( state ) ;
@@ -252,11 +271,6 @@ void DebugTerminalDialog::on_ledVH3TestChkBox_1_stateChanged(int state)
writeCoil ( 0 , COIL_LED_VH3_TEST , state = = Qt : : Checked ? 1 : 0 ) ;
}
// Реализация слотов для вызова функций платы 2
void DebugTerminalDialog : : on_continiusCallChkBox_2_stateChanged ( int state )
{
@@ -289,7 +303,7 @@ void DebugTerminalDialog::on_getHardfaultCallChkBox_2_stateChanged(int state)
}
// Реализация слотов для теста дискретных сигналов платы 2
void DebugTerminalDialog : : enableLedTestChkBox_2_stateChanged ( int state )
void DebugTerminalDialog : : on_ enableLedTestChkBox_2_stateChanged( int state )
{
writeCoil ( 1 , COIL_LED_TEST_ENABLE , state = = Qt : : Checked ? 1 : 0 ) ;
ui - > leds_2 - > setEnabled ( state ) ;
@@ -355,15 +369,6 @@ void DebugTerminalDialog::on_ledVH3TestChkBox_2_stateChanged(int state)
writeCoil ( 1 , COIL_LED_VH3_TEST , state = = Qt : : Checked ? 1 : 0 ) ;
}
// Реализация слотов для вызова функций платы 3
void DebugTerminalDialog : : on_continiusCallChkBox_3_stateChanged ( int state )
{
@@ -396,7 +401,7 @@ void DebugTerminalDialog::on_getHardfaultCallChkBox_3_stateChanged(int state)
}
// Реализация слотов для теста дискретных сигналов платы 3
void DebugTerminalDialog : : enableLedTestChkBox_3_stateChanged ( int state )
void DebugTerminalDialog : : on_ enableLedTestChkBox_3_stateChanged( int state )
{
writeCoil ( 2 , COIL_LED_TEST_ENABLE , state = = Qt : : Checked ? 1 : 0 ) ;
ui - > leds_3 - > setEnabled ( state ) ;
@@ -462,10 +467,6 @@ void DebugTerminalDialog::on_ledVH3TestChkBox_3_stateChanged(int state)
writeCoil ( 2 , COIL_LED_VH3_TEST , state = = Qt : : Checked ? 1 : 0 ) ;
}
// Реализация слотов для вызова функций платы 4
void DebugTerminalDialog : : on_continiusCallChkBox_4_stateChanged ( int state )
{
@@ -498,7 +499,7 @@ void DebugTerminalDialog::on_getHardfaultCallChkBox_4_stateChanged(int state)
}
// Реализация слотов для теста дискретных сигналов платы 4
void DebugTerminalDialog : : enableLedTestChkBox_4_stateChanged ( int state )
void DebugTerminalDialog : : on_ enableLedTestChkBox_4_stateChanged( int state )
{
writeCoil ( 3 , COIL_LED_TEST_ENABLE , state = = Qt : : Checked ? 1 : 0 ) ;
ui - > leds_4 - > setEnabled ( state ) ;
@@ -564,12 +565,8 @@ void DebugTerminalDialog::on_ledVH3TestChkBox_4_stateChanged(int state)
writeCoil ( 3 , COIL_LED_VH3_TEST , state = = Qt : : Checked ? 1 : 0 ) ;
}
void DebugTerminalDialog : : openAdc ( int boardID , int teNumber )
{
// Удаляем старый диалог и создаем новый
if ( m_adcGraphDialog ) {
m_adcGraphDialog - > deleteLater ( ) ;
@@ -595,21 +592,18 @@ void DebugTerminalDialog::setGraphUpdateInterval(int milliseconds)
}
}
void DebugTerminalDialog : : writeCoil ( int boardID , int coil , int value )
{
QGroupBox * boardGroup = nullptr ;
switch ( boardID ) {
case 0 : boardGroup = ui - > DbgPlate_1 ; break ; // Плата 1
case 1 : boardGroup = ui - > DbgPlate_2 ; break ; // Плата 2
case 1 : boardGroup = ui - > DbgPlate_2 ; break ; // Плата 2
case 2 : boardGroup = ui - > DbgPlate_3 ; break ; // Плата 3
case 3 : boardGroup = ui - > DbgPlate_4 ; break ; // Плата 4
default : return ;
}
if ( ! boardGroup - > isEnabled ( ) )
return ;
qDebug ( ) < < " Writing board " < < boardID < < " coil: " < < coil < < " value: " < < value ;
emit coilValueChanged ( boardID , coil , value ) ;
}
@@ -619,19 +613,17 @@ void DebugTerminalDialog::writeTENumber(int boardId, int teNumber)
m_adcGraphDialog - > setTENumber ( boardId , teNumber ) ;
}
void DebugTerminalDialog : : setBoardActive ( int boardID , bool active )
{
// Получаем групбокс для указанной платы
QGroupBox * boardGroup = nullptr ;
switch ( boardID ) {
case 0 : boardGroup = ui - > DbgPlate_1 ; break ; // Плата 1
case 1 : boardGroup = ui - > DbgPlate_2 ; break ; // Плата 2
case 1 : boardGroup = ui - > DbgPlate_2 ; break ; // Плата 2
case 2 : boardGroup = ui - > DbgPlate_3 ; break ; // Плата 3
case 3 : boardGroup = ui - > DbgPlate_4 ; break ; // Плата 4
default : return ;
}
if ( boardGroup ) {
boardGroup - > setEnabled ( active ) ;
// Можно добавить визуальное отличие неактивных плат
@@ -679,12 +671,6 @@ void DebugTerminalDialog::resetAll()
ui - > ledVH2TestChkBox_1 - > setChecked ( false ) ;
ui - > ledVH3TestChkBox_1 - > setChecked ( false ) ;
// С б р о с всех чекбоксов вызова функций
ui - > continiusCallChkBox_2 - > setChecked ( false ) ;
ui - > calibrateCallChkBox_2 - > setChecked ( false ) ;
@@ -712,7 +698,6 @@ void DebugTerminalDialog::resetAll()
ui - > ledVH2TestChkBox_2 - > setChecked ( false ) ;
ui - > ledVH3TestChkBox_2 - > setChecked ( false ) ;
// С б р о с всех чекбоксов вызова функций
ui - > continiusCallChkBox_3 - > setChecked ( false ) ;
ui - > calibrateCallChkBox_3 - > setChecked ( false ) ;
@@ -740,9 +725,6 @@ void DebugTerminalDialog::resetAll()
ui - > ledVH2TestChkBox_3 - > setChecked ( false ) ;
ui - > ledVH3TestChkBox_3 - > setChecked ( false ) ;
// С б р о с всех чекбоксов вызова функций
ui - > continiusCallChkBox_4 - > setChecked ( false ) ;
ui - > calibrateCallChkBox_4 - > setChecked ( false ) ;
@@ -769,5 +751,61 @@ void DebugTerminalDialog::resetAll()
ui - > ledVH1TestChkBox_4 - > setChecked ( false ) ;
ui - > ledVH2TestChkBox_4 - > setChecked ( false ) ;
ui - > ledVH3TestChkBox_4 - > setChecked ( false ) ;
}
void DebugTerminalDialog : : boardDebugReading ( int boardID )
{
if ( mainTerm = = nullptr )
return ;
if ( ! boards [ boardID ] . isActive )
return ;
if ( ! this - > isVisible ( ) )
return ;
QModbusReply * _24V = mainTerm - > readSingleCoil ( boardID , 603 ) ;
if ( _24V ! = nullptr )
connect ( _24V , & QModbusReply : : finished , this , [ this , boardID , _24V ] ( ) {
if ( _24V - > error ( ) = = QModbusDevice : : NoError )
boards [ boardID ] . error24V - > setChecked ( _24V - > result ( ) . value ( 0 ) ) ;
_24V - > deleteLater ( ) ;
} ) ;
QModbusReply * _5V = mainTerm - > readSingleCoil ( boardID , 604 ) ;
if ( _5V ! = nullptr )
connect ( _5V , & QModbusReply : : finished , this , [ this , boardID , _5V ] ( ) {
if ( _5V - > error ( ) = = QModbusDevice : : NoError )
boards [ boardID ] . error5V - > setChecked ( _5V - > result ( ) . value ( 0 ) ) ;
_5V - > deleteLater ( ) ;
} ) ;
QModbusReply * _5VSCI = mainTerm - > readSingleCoil ( boardID , 605 ) ;
if ( _5VSCI ! = nullptr )
connect ( _5VSCI , & QModbusReply : : finished , this , [ this , boardID , _5VSCI ] ( ) {
if ( _5VSCI - > error ( ) = = QModbusDevice : : NoError )
boards [ boardID ] . error5VSCI - > setChecked ( _5VSCI - > result ( ) . value ( 0 ) ) ;
_5VSCI - > deleteLater ( ) ;
} ) ;
QModbusReply * _5VA = mainTerm - > readSingleCoil ( boardID , 606 ) ;
if ( _5VA ! = nullptr )
connect ( _5VA , & QModbusReply : : finished , this , [ this , boardID , _5VA ] ( ) {
if ( _5VA - > error ( ) = = QModbusDevice : : NoError )
boards [ boardID ] . error5VA - > setChecked ( _5VA - > result ( ) . value ( 0 ) ) ;
_5VA - > deleteLater ( ) ;
} ) ;
}
void DebugTerminalDialog : : setScanBoardActive ( bool flag , int boardID )
{
boards [ boardID ] . isActive = flag ;
}
void DebugTerminalDialog : : offAllBoard ( )
{
for ( int i = 0 ; i < 4 ; i + + )
{
boards [ i ] . isActive = false ;
}
}