Modification au GUI de config du Watchdog vu que ce n'est pas un device dédié

This commit is contained in:
2023-07-28 15:10:33 -04:00
parent 8b3cc9d2b6
commit 41b19a7b58
13 changed files with 2660 additions and 10 deletions
@@ -69,6 +69,9 @@ CCANbusSettingsPage::CCANbusSettingsPage(QWidget *parent) :
ui->mDevicePollPeriodSpinBx->setEnabled(false);
ui->mCancelModifyParamsBtn->hide();
ui->mDeviceNameEditBx->setEnabled(false);
ui->mWatchdogPollPeriodSpinBx->setEnabled(false);
ui->mWatchdogMsgIDSpinBx->setEnabled(false);
ui->mCANDeviceWatchdogActivateChkBx->setEnabled(false);
connect(ui->mDevicesList,&QListWidget::itemSelectionChanged,this,&CCANbusSettingsPage::DeviceSelectionChanged);
@@ -78,6 +81,7 @@ CCANbusSettingsPage::CCANbusSettingsPage(QWidget *parent) :
connect(ui->mDatabaseFileSelectBtn,&QPushButton::clicked,this,&CCANbusSettingsPage::SelectDBFileBtnPressed);
connect(ui->mAddDeviceBtn,&QPushButton::clicked,this,&CCANbusSettingsPage::AddDeviceBtnPressed);
connect(ui->mDeleteDeviceBtn,&QPushButton::clicked,this,&CCANbusSettingsPage::DeleteDeviceBtnPressed);
connect(ui->mCANDeviceWatchdogActivateChkBx,&QCheckBox::stateChanged,this,&CCANbusSettingsPage::WatchdogActivationBoxChanged);
}
@@ -161,6 +165,24 @@ int CCANbusSettingsPage::UpdatePage()
// ui->mDatabaseFileNameLbl->setText(QString("%1").arg(Device->mCANDeviceDatabaseFilename));
ui->mDevicePollPeriodSpinBx->setValue(DevConfigInfo->mDevicePollPeriod);
if(DevConfigInfo->mDeviceWatchdogActivated == true)
{
disconnect(ui->mCANDeviceWatchdogActivateChkBx,&QCheckBox::stateChanged,this,&CCANbusSettingsPage::WatchdogActivationBoxChanged);
ui->mCANDeviceWatchdogActivateChkBx->setCheckState(Qt::Checked);
connect(ui->mCANDeviceWatchdogActivateChkBx,&QCheckBox::stateChanged,this,&CCANbusSettingsPage::WatchdogActivationBoxChanged);
ui->mWatchdogMsgIDSpinBx->setValue(DevConfigInfo->mWatchdogCANMsgID);
ui->mWatchdogPollPeriodSpinBx->setValue(DevConfigInfo->mWatchdogPeriod);
}
else
{
disconnect(ui->mCANDeviceWatchdogActivateChkBx,&QCheckBox::stateChanged,this,&CCANbusSettingsPage::WatchdogActivationBoxChanged);
ui->mCANDeviceWatchdogActivateChkBx->setCheckState(Qt::Unchecked);
connect(ui->mCANDeviceWatchdogActivateChkBx,&QCheckBox::stateChanged,this,&CCANbusSettingsPage::WatchdogActivationBoxChanged);
ui->mWatchdogMsgIDSpinBx->setValue(1);
ui->mWatchdogPollPeriodSpinBx->setValue(100);
}
//update device database information
ui->mDBMessagesListWidget->clear();
ui->mDBSignalDetailsTable->clearContents();
@@ -184,6 +206,8 @@ int CCANbusSettingsPage::UpdatePage()
ui->mDBMessagesListWidget->setCurrentRow(0);
}
}
@@ -374,6 +398,9 @@ int CCANbusSettingsPage::ModifyDeviceConfig()
ModifiedDevice->mDeviceDescription = ui->mDeviceDescriptionTxtEdit->toPlainText();
ModifiedDevice->mDeviceName = ui->mDeviceNameEditBx->toPlainText();
ModifiedDevice->mDevicePollPeriod = ui->mDevicePollPeriodSpinBx->value();
ModifiedDevice->mDeviceWatchdogActivated = ui->mCANDeviceWatchdogActivateChkBx->isChecked();
ModifiedDevice->mWatchdogCANMsgID = ui->mWatchdogMsgIDSpinBx->value();
ModifiedDevice->mWatchdogPeriod = ui->mWatchdogPollPeriodSpinBx->value();
mProgramPtr->SaveCANDevicesConfigRequest(&mDeviceConfigList);
}
@@ -391,6 +418,9 @@ int CCANbusSettingsPage::ModifyDeviceConfig()
ui->mCancelModifyParamsBtn->hide();
ui->mDeviceNameEditBx->setEnabled(false);
mDeviceChangeModeEnabled = false;
ui->mWatchdogPollPeriodSpinBx->setEnabled(false);
ui->mWatchdogMsgIDSpinBx->setEnabled(false);
ui->mCANDeviceWatchdogActivateChkBx->setEnabled(false);
ui->mAddDeviceBtn->setEnabled(true);
@@ -412,6 +442,13 @@ int CCANbusSettingsPage::ModifyDeviceConfig()
ui->mCancelModifyParamsBtn->show();
ui->mDeviceNameEditBx->setEnabled(true);
ui->mAddDeviceBtn->setEnabled(true);
ui->mCANDeviceWatchdogActivateChkBx->setEnabled(true);
if(ui->mCANDeviceWatchdogActivateChkBx->isChecked())
{
ui->mWatchdogPollPeriodSpinBx->setEnabled(true);
ui->mWatchdogMsgIDSpinBx->setEnabled(true);
}
mDeviceChangeModeEnabled = true;
}
@@ -433,6 +470,9 @@ void CCANbusSettingsPage::CancelModifyDevBtnPressed()
ui->mCancelModifyParamsBtn->hide();
ui->mDeviceNameEditBx->setEnabled(false);
ui->mAddDeviceBtn->setEnabled(true);
ui->mWatchdogPollPeriodSpinBx->setEnabled(false);
ui->mWatchdogMsgIDSpinBx->setEnabled(false);
ui->mCANDeviceWatchdogActivateChkBx->setEnabled(false);
mDeviceChangeModeEnabled = false;
UpdatePage();
@@ -518,3 +558,19 @@ int CCANbusSettingsPage::PopulateDevicesConfigList()
return RET_OK;
}
void CCANbusSettingsPage::WatchdogActivationBoxChanged()
{
if(ui->mCANDeviceWatchdogActivateChkBx->isChecked())
{
ui->mWatchdogMsgIDSpinBx->setEnabled(true);
ui->mWatchdogPollPeriodSpinBx->setEnabled(true);
}
else
{
ui->mWatchdogMsgIDSpinBx->setValue(1);
ui->mWatchdogPollPeriodSpinBx->setValue(100);
ui->mWatchdogMsgIDSpinBx->setEnabled(false);
ui->mWatchdogPollPeriodSpinBx->setEnabled(false);
}
}
@@ -50,6 +50,7 @@ public slots:
void SelectDBFileBtnPressed();
void AddDeviceBtnPressed();
void DeleteDeviceBtnPressed();
void WatchdogActivationBoxChanged();
};
+119 -5
View File
@@ -60,7 +60,7 @@
<x>270</x>
<y>100</y>
<width>321</width>
<height>371</height>
<height>461</height>
</rect>
</property>
<property name="title">
@@ -118,8 +118,8 @@
<widget class="QPushButton" name="mModifyDevParamsBtn">
<property name="geometry">
<rect>
<x>220</x>
<y>330</y>
<x>210</x>
<y>420</y>
<width>80</width>
<height>22</height>
</rect>
@@ -215,8 +215,8 @@
<widget class="QPushButton" name="mCancelModifyParamsBtn">
<property name="geometry">
<rect>
<x>30</x>
<y>330</y>
<x>20</x>
<y>420</y>
<width>80</width>
<height>22</height>
</rect>
@@ -256,6 +256,120 @@
<number>255</number>
</property>
</widget>
<widget class="QCheckBox" name="mCANDeviceWatchdogActivateChkBx">
<property name="geometry">
<rect>
<x>10</x>
<y>320</y>
<width>131</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Activer Watchdog</string>
</property>
</widget>
<widget class="QSpinBox" name="mWatchdogPollPeriodSpinBx">
<property name="geometry">
<rect>
<x>200</x>
<y>350</y>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="minimum">
<number>100</number>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="displayIntegerBase">
<number>10</number>
</property>
</widget>
<widget class="QLabel" name="mRefreshRateLbl_2">
<property name="geometry">
<rect>
<x>10</x>
<y>350</y>
<width>181</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Période rafraîchissement (ms):</string>
</property>
</widget>
<widget class="QLabel" name="mWatchdogMsgIDLbl">
<property name="geometry">
<rect>
<x>10</x>
<y>380</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>CAN Msg ID (HEX):</string>
</property>
</widget>
<widget class="QLabel" name="mWatchdogMsgIDPrefixLbl">
<property name="geometry">
<rect>
<x>110</x>
<y>380</y>
<width>30</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>0x</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QSpinBox" name="mWatchdogMsgIDSpinBx">
<property name="geometry">
<rect>
<x>140</x>
<y>380</y>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="value">
<number>1</number>
</property>
<property name="displayIntegerBase">
<number>16</number>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="mDatabaseGroupBox">
<property name="geometry">