Ajout config CPU Watchdog dans la page des settings

This commit is contained in:
2023-10-29 15:22:03 -04:00
parent a4028c2385
commit 454935965f
25 changed files with 1189 additions and 101 deletions
+2 -2
View File
@@ -156,8 +156,8 @@
<widget class="QPushButton" name="mQuitAppBtn">
<property name="geometry">
<rect>
<x>1529</x>
<y>560</y>
<x>1230</x>
<y>310</y>
<width>131</width>
<height>22</height>
</rect>
@@ -26,6 +26,8 @@ CLoggingSettingsPage::CLoggingSettingsPage(QWidget *parent) :
connect(ui->mChangeParamsBtn,&QPushButton::clicked,this,&CLoggingSettingsPage::ModifyParamsBtnPressed);
connect(ui->mLogZoneVerbositySpinBx,QOverload<int>::of(&QSpinBox::valueChanged),this,&CLoggingSettingsPage::VerbosityParamsChanged);
connect(ui->mLogFileVerbositySpinBx,QOverload<int>::of(&QSpinBox::valueChanged),this,&CLoggingSettingsPage::VerbosityParamsChanged);
connect(ui->mWDActiveChkBx,&QCheckBox::stateChanged,this,&CLoggingSettingsPage::EnableCPUWDCheckBxClicked);
connect(ui->mWDTimerTimeoutSpinBx,QOverload<int>::of(&QSpinBox::valueChanged),this,&CLoggingSettingsPage::CPUWDTimeoutChanged);
}
@@ -61,6 +63,20 @@ int CLoggingSettingsPage::SetGeneralSettingsParams(const CGeneralSystemParams *G
return RET_OK;
}
int CLoggingSettingsPage::SetCPUWatchdogSettings(const CCPUWatchdogConfig *CPUWatchdogParams)
{
if(CPUWatchdogParams == 0)
{
return RET_GENERAL_ERROR;
}
mCPUWatchdogParams = *CPUWatchdogParams;
UpdateCPUWatchdogParams();
}
void CLoggingSettingsPage::ModifyParamsBtnPressed()
{
if(EditMode == false)
@@ -153,6 +169,20 @@ int CLoggingSettingsPage::UpdateGeneralParams()
return RET_OK;
}
int CLoggingSettingsPage::UpdateCPUWatchdogParams()
{
disconnect(ui->mWDActiveChkBx,&QCheckBox::stateChanged,this,&CLoggingSettingsPage::EnableCPUWDCheckBxClicked);
disconnect(ui->mWDTimerTimeoutSpinBx,QOverload<int>::of(&QSpinBox::valueChanged),this,&CLoggingSettingsPage::CPUWDTimeoutChanged);
ui->mWDActiveChkBx->setChecked(mCPUWatchdogParams.mWatchdogEnabled);
ui->mWDTimerTimeoutSpinBx->setValue(mCPUWatchdogParams.mWatchdogTimeout);
connect(ui->mWDActiveChkBx,&QCheckBox::stateChanged,this,&CLoggingSettingsPage::EnableCPUWDCheckBxClicked);
connect(ui->mWDTimerTimeoutSpinBx,QOverload<int>::of(&QSpinBox::valueChanged),this,&CLoggingSettingsPage::CPUWDTimeoutChanged);
return RET_OK;
}
void CLoggingSettingsPage::VerbosityParamsChanged(int value)
{
Q_UNUSED(value)
@@ -165,3 +195,17 @@ void CLoggingSettingsPage::VerbosityParamsChanged(int value)
qDebug("LogZone: %i, LogFile %i",mGeneralSystemParams.mLocalLogVerbosity,mGeneralSystemParams.mLogFileVerbosity);
}
void CLoggingSettingsPage::EnableCPUWDCheckBxClicked(int state)
{
Q_UNUSED(state)
mCPUWatchdogParams.mWatchdogEnabled = ui->mWDActiveChkBx->isChecked();
mProgramHandle->SaveCPUWatchdogSettingsRequest(&mCPUWatchdogParams);
}
void CLoggingSettingsPage::CPUWDTimeoutChanged(int value)
{
Q_UNUSED(value)
mCPUWatchdogParams.mWatchdogTimeout = ui->mWDTimerTimeoutSpinBx->value();
mProgramHandle->SaveCPUWatchdogSettingsRequest(&mCPUWatchdogParams);
}
@@ -4,6 +4,7 @@
#include <QWidget>
#include "CloudParams.h"
#include "GeneralSystemParams.h"
#include "CPUWatchdogConfig.h"
class COtarcikCan;
@@ -22,6 +23,7 @@ public:
int SetCloudParams(const CCloudParams *CloudParams);
int SetGeneralSettingsParams(const CGeneralSystemParams *GeneralParams);
int SetCPUWatchdogSettings(const CCPUWatchdogConfig *CPUWatchdogParams);
COtarcikCan *mProgramHandle;
@@ -29,13 +31,14 @@ public:
private:
int UpdateCloudConfig();
int UpdateGeneralParams();
int UpdateCPUWatchdogParams();
Ui::CLoggingSettingsPage *ui;
bool EditMode;
CCloudParams mCloudParams;
CGeneralSystemParams mGeneralSystemParams;
CCPUWatchdogConfig mCPUWatchdogParams;
@@ -43,6 +46,8 @@ public slots:
void ModifyParamsBtnPressed();
void CancelBtnPressed();
void VerbosityParamsChanged(int value);
void EnableCPUWDCheckBxClicked(int state);
void CPUWDTimeoutChanged(int value);
};
@@ -425,6 +425,66 @@
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
<rect>
<x>590</x>
<y>240</y>
<width>351</width>
<height>101</height>
</rect>
</property>
<property name="title">
<string>Watchdog CPU</string>
</property>
<widget class="QSpinBox" name="mWDTimerTimeoutSpinBx">
<property name="geometry">
<rect>
<x>110</x>
<y>60</y>
<width>101</width>
<height>22</height>
</rect>
</property>
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>15300</number>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>Timeout (s)</string>
</property>
</widget>
<widget class="QCheckBox" name="mWDActiveChkBx">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>171</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Activer watchdog</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>