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
+24 -10
View File
@@ -2,10 +2,12 @@
#include "defines.h"
#include "AxUfiAPI.h"
#include "GeneralMessagesLogDispatcher.h"
#include "CPUWatchdogConfig.h"
CComputerBoardInterface::CComputerBoardInterface()
{
mWatchdogTimeout = CPU_DEFAULT_WATCHDOG_TIMEOUT;
mWatchdogEnabled = false;
}
int CComputerBoardInterface::Init()
@@ -13,6 +15,7 @@ int CComputerBoardInterface::Init()
if(LoadLibrary() == RET_OK)
{
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Librairie Axiomtek chargée avec succès"),true,1,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_SUCCESS_STATUS);
StopCPUWatchdog();
return RET_OK;
}
else
@@ -48,23 +51,25 @@ int CComputerBoardInterface::DeInit()
return RET_OK;
}
int CComputerBoardInterface::StartCPUWatchdog(int TimeoutInSeconds)
int CComputerBoardInterface::StartCPUWatchdog()
{
if(TimeoutInSeconds > (255*60) ) //Max of 255 minutes
{
// if(TimeoutInSeconds > (255*60) ) //Max of 255 minutes
// {
// return RET_GENERAL_ERROR;
// }
if(mWatchdogEnabled == false)
return RET_GENERAL_ERROR;
}
int Ret;
quint16 RawTimeout = bWDT_SECOND;
if(TimeoutInSeconds <= 60)
if(mWatchdogTimeout <= 60)
{
RawTimeout = TimeoutInSeconds;
RawTimeout = mWatchdogTimeout;
}
else
{
RawTimeout = TimeoutInSeconds/60;
RawTimeout = mWatchdogTimeout/60;
RawTimeout |= bWDT_MINUTE; //set the counter time base in minutes (high byte = 1)
}
@@ -76,7 +81,7 @@ int CComputerBoardInterface::StartCPUWatchdog(int TimeoutInSeconds)
{
if(AxWDTexec(bWDT_ENABLE) == true)
{
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Watchdog CPU démarré. Timeout: %1 secondes").arg(TimeoutInSeconds));
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Watchdog CPU démarré. Timeout: %1 secondes").arg(mWatchdogTimeout));
Ret = RET_OK;
}
else
@@ -96,7 +101,10 @@ int CComputerBoardInterface::StopCPUWatchdog()
{
Ret = RET_GENERAL_ERROR;
}
else
{
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Watchdog CPU arrêté"));
}
return Ret;
}
@@ -106,3 +114,9 @@ int CComputerBoardInterface::KickCPUWatchdog()
return RET_OK;
}
int CComputerBoardInterface::SetWatchdogSettings(CCPUWatchdogConfig *Settings)
{
mWatchdogEnabled = Settings->mWatchdogEnabled;
mWatchdogTimeout = Settings->mWatchdogTimeout;
}