Ajout config CPU Watchdog dans la page des settings

This commit is contained in:
jfmartel 2023-10-29 15:22:03 -04:00
parent a4028c2385
commit 454935965f
25 changed files with 1189 additions and 101 deletions

Binary file not shown.

View File

@ -5226,3 +5226,199 @@ Démarrage du logiciel Otarcik CAN le 2023-10-28 à 12:47:39
2023-10-28 12:47:39 Initialisation du dispositif [MasterCAN]
2023-10-28 12:47:39 Démarrage d'un module CAN...
2023-10-28 12:47:39 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-28 à 16:06:27
********************************************************************
2023-10-28 16:06:27 Librairie Axiomtek chargée avec succès
2023-10-28 16:06:27 Chargement de la configuration système...
2023-10-28 16:06:27 Configuration système chargée avec succès!
2023-10-28 16:06:27 Initialisation du dispositif [MasterCAN]
2023-10-28 16:06:27 Démarrage d'un module CAN...
2023-10-28 16:06:27 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 14:08:18
********************************************************************
2023-10-29 14:08:18 Librairie Axiomtek chargée avec succès
2023-10-29 14:08:18 Chargement de la configuration système...
2023-10-29 14:08:18 Configuration système chargée avec succès!
2023-10-29 14:08:18 Initialisation du dispositif [MasterCAN]
2023-10-29 14:08:18 Démarrage d'un module CAN...
2023-10-29 14:08:18 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 14:09:02
********************************************************************
2023-10-29 14:09:02 Librairie Axiomtek chargée avec succès
2023-10-29 14:09:02 Chargement de la configuration système...
2023-10-29 14:09:02 Configuration système chargée avec succès!
2023-10-29 14:09:02 Initialisation du dispositif [MasterCAN]
2023-10-29 14:09:02 Démarrage d'un module CAN...
2023-10-29 14:09:02 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 14:26:59
********************************************************************
2023-10-29 14:26:59 Librairie Axiomtek chargée avec succès
2023-10-29 14:26:59 Chargement de la configuration système...
2023-10-29 14:26:59 Configuration système chargée avec succès!
2023-10-29 14:26:59 Initialisation du dispositif [MasterCAN]
2023-10-29 14:26:59 Démarrage d'un module CAN...
2023-10-29 14:26:59 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 14:34:36
********************************************************************
2023-10-29 14:34:36 Librairie Axiomtek chargée avec succès
2023-10-29 14:34:36 Chargement de la configuration système...
2023-10-29 14:34:36 Configuration système chargée avec succès!
2023-10-29 14:34:36 Initialisation du dispositif [MasterCAN]
2023-10-29 14:34:36 Démarrage d'un module CAN...
2023-10-29 14:34:36 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 14:38:46
********************************************************************
2023-10-29 14:38:46 Librairie Axiomtek chargée avec succès
2023-10-29 14:38:46 Chargement de la configuration système...
2023-10-29 14:38:46 Configuration système chargée avec succès!
2023-10-29 14:38:46 Initialisation du dispositif [MasterCAN]
2023-10-29 14:38:46 Démarrage d'un module CAN...
2023-10-29 14:38:46 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 14:42:23
********************************************************************
2023-10-29 14:42:23 Librairie Axiomtek chargée avec succès
2023-10-29 14:42:23 Chargement de la configuration système...
2023-10-29 14:42:44 Configuration système chargée avec succès!
2023-10-29 14:42:44 Initialisation du dispositif [MasterCAN]
2023-10-29 14:42:44 Démarrage d'un module CAN...
2023-10-29 14:42:44 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 14:43:24
********************************************************************
2023-10-29 14:43:24 Librairie Axiomtek chargée avec succès
2023-10-29 14:43:24 Chargement de la configuration système...
2023-10-29 14:43:24 Configuration système chargée avec succès!
2023-10-29 14:43:24 Initialisation du dispositif [MasterCAN]
2023-10-29 14:43:24 Démarrage d'un module CAN...
2023-10-29 14:43:24 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 14:55:24
********************************************************************
2023-10-29 14:55:24 Librairie Axiomtek chargée avec succès
2023-10-29 14:55:24 Watchdog CPU arrêté
2023-10-29 14:55:24 Chargement de la configuration système...
2023-10-29 14:55:24 Configuration système chargée avec succès!
2023-10-29 14:55:24 Initialisation du dispositif [MasterCAN]
2023-10-29 14:55:24 Démarrage d'un module CAN...
2023-10-29 14:55:24 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 15:14:15
********************************************************************
2023-10-29 15:14:15 Librairie Axiomtek chargée avec succès
2023-10-29 15:14:15 Watchdog CPU arrêté
2023-10-29 15:14:15 Chargement de la configuration système...
2023-10-29 15:14:15 Configuration système chargée avec succès!
2023-10-29 15:14:15 Initialisation du dispositif [MasterCAN]
2023-10-29 15:14:15 Démarrage d'un module CAN...
2023-10-29 15:14:15 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 15:15:00
********************************************************************
2023-10-29 15:15:00 Librairie Axiomtek chargée avec succès
2023-10-29 15:15:00 Watchdog CPU arrêté
2023-10-29 15:15:00 Chargement de la configuration système...
2023-10-29 15:15:00 Configuration système chargée avec succès!
2023-10-29 15:15:00 Initialisation du dispositif [MasterCAN]
2023-10-29 15:15:00 Démarrage d'un module CAN...
2023-10-29 15:15:00 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 15:15:47
********************************************************************
2023-10-29 15:15:47 Librairie Axiomtek chargée avec succès
2023-10-29 15:15:47 Watchdog CPU arrêté
2023-10-29 15:15:47 Chargement de la configuration système...
2023-10-29 15:15:47 Configuration système chargée avec succès!
2023-10-29 15:15:47 Initialisation du dispositif [MasterCAN]
2023-10-29 15:15:47 Démarrage d'un module CAN...
2023-10-29 15:15:47 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 15:16:17
********************************************************************
2023-10-29 15:16:17 Librairie Axiomtek chargée avec succès
2023-10-29 15:16:31 Watchdog CPU arrêté
2023-10-29 15:16:31 Chargement de la configuration système...
2023-10-29 15:16:42 Configuration système chargée avec succès!
2023-10-29 15:16:42 Initialisation du dispositif [MasterCAN]
2023-10-29 15:16:42 Démarrage d'un module CAN...
2023-10-29 15:16:42 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 15:17:17
********************************************************************
2023-10-29 15:17:17 Librairie Axiomtek chargée avec succès
2023-10-29 15:17:20 Watchdog CPU arrêté
2023-10-29 15:17:20 Chargement de la configuration système...
2023-10-29 15:17:42 Configuration système chargée avec succès!
2023-10-29 15:17:50 Initialisation du dispositif [MasterCAN]
2023-10-29 15:17:50 Démarrage d'un module CAN...
2023-10-29 15:17:50 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 15:19:07
********************************************************************
2023-10-29 15:19:07 Librairie Axiomtek chargée avec succès
2023-10-29 15:19:07 Watchdog CPU arrêté
2023-10-29 15:19:07 Chargement de la configuration système...
2023-10-29 15:19:07 Configuration système chargée avec succès!
2023-10-29 15:19:07 Initialisation du dispositif [MasterCAN]
2023-10-29 15:19:07 Démarrage d'un module CAN...
2023-10-29 15:19:07 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 15:19:51
********************************************************************
2023-10-29 15:19:51 Librairie Axiomtek chargée avec succès
2023-10-29 15:19:51 Watchdog CPU arrêté
2023-10-29 15:19:51 Chargement de la configuration système...
2023-10-29 15:19:51 Configuration système chargée avec succès!
2023-10-29 15:19:51 Initialisation du dispositif [MasterCAN]
2023-10-29 15:19:51 Démarrage d'un module CAN...
2023-10-29 15:19:51 Impossible de trouver le module CAN sur le channel 1
********************************************************************
Démarrage du logiciel Otarcik CAN le 2023-10-29 à 15:20:29
********************************************************************
2023-10-29 15:20:29 Librairie Axiomtek chargée avec succès
2023-10-29 15:20:29 Watchdog CPU arrêté
2023-10-29 15:20:29 Chargement de la configuration système...
2023-10-29 15:20:29 Configuration système chargée avec succès!
2023-10-29 15:20:29 Initialisation du dispositif [MasterCAN]
2023-10-29 15:20:29 Démarrage d'un module CAN...
2023-10-29 15:20:29 Impossible de trouver le module CAN sur le channel 1

View File

@ -3,16 +3,16 @@
# Generated by qmake (3.1) (Qt 5.14.2)
# Project: Otarcik_CAN.pro
# Template: app
# Command: C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=qtquickcompiler"
# Command: C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
#############################################################################
MAKEFILE = Makefile
EQ = =
first: release
install: release-install
uninstall: release-uninstall
first: debug
install: debug-install
uninstall: debug-uninstall
QMAKE = C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe
DEL_FILE = del
CHK_DIR_EXISTS= if not exist
@ -37,24 +37,10 @@ RES_FILE =
SED = $(QMAKE) -install sed
MOVE = move
SUBTARGETS = \
release \
debug
debug \
release
release: FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_first: FORCE
$(MAKE) -f $(MAKEFILE).Release
release-all: FORCE
$(MAKE) -f $(MAKEFILE).Release all
release-clean: FORCE
$(MAKE) -f $(MAKEFILE).Release clean
release-distclean: FORCE
$(MAKE) -f $(MAKEFILE).Release distclean
release-install: FORCE
$(MAKE) -f $(MAKEFILE).Release install
release-uninstall: FORCE
$(MAKE) -f $(MAKEFILE).Release uninstall
debug: FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-make_first: FORCE
@ -69,6 +55,20 @@ debug-install: FORCE
$(MAKE) -f $(MAKEFILE).Debug install
debug-uninstall: FORCE
$(MAKE) -f $(MAKEFILE).Debug uninstall
release: FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_first: FORCE
$(MAKE) -f $(MAKEFILE).Release
release-all: FORCE
$(MAKE) -f $(MAKEFILE).Release all
release-clean: FORCE
$(MAKE) -f $(MAKEFILE).Release clean
release-distclean: FORCE
$(MAKE) -f $(MAKEFILE).Release distclean
release-install: FORCE
$(MAKE) -f $(MAKEFILE).Release install
release-uninstall: FORCE
$(MAKE) -f $(MAKEFILE).Release uninstall
Makefile: Otarcik_CAN.pro C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/win32-g++/qmake.conf C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/spec_pre.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/qdevice.pri \
@ -237,11 +237,11 @@ Makefile: Otarcik_CAN.pro C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/win32-g++/qma
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resolve_config.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/exclusive_builds_post.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/default_post.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources_functions.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qtquickcompiler.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qml_debug.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/precompile_header.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/warn_on.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qt.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources_functions.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/moc.prf \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/opengl.prf \
@ -262,7 +262,7 @@ Makefile: Otarcik_CAN.pro C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/win32-g++/qma
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Core.prl \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/qtmain.prl \
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/build_pass.prf
$(QMAKE) -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=qtquickcompiler"
$(QMAKE) -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/spec_pre.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/qdevice.pri:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/device_config.prf:
@ -430,11 +430,11 @@ C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/default_pre.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resolve_config.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/exclusive_builds_post.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/default_post.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources_functions.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qtquickcompiler.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qml_debug.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/precompile_header.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/warn_on.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qt.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources_functions.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/moc.prf:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/opengl.prf:
@ -456,32 +456,32 @@ C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Core.prl:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/qtmain.prl:
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/build_pass.prf:
qmake: FORCE
@$(QMAKE) -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=qtquickcompiler"
@$(QMAKE) -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
qmake_all: FORCE
make_first: release-make_first debug-make_first FORCE
all: release-all debug-all FORCE
clean: release-clean debug-clean FORCE
distclean: release-distclean debug-distclean FORCE
make_first: debug-make_first release-make_first FORCE
all: debug-all release-all FORCE
clean: debug-clean release-clean FORCE
distclean: debug-distclean release-distclean FORCE
-$(DEL_FILE) Makefile
release-mocclean:
$(MAKE) -f $(MAKEFILE).Release mocclean
debug-mocclean:
$(MAKE) -f $(MAKEFILE).Debug mocclean
mocclean: release-mocclean debug-mocclean
release-mocclean:
$(MAKE) -f $(MAKEFILE).Release mocclean
mocclean: debug-mocclean release-mocclean
release-mocables:
$(MAKE) -f $(MAKEFILE).Release mocables
debug-mocables:
$(MAKE) -f $(MAKEFILE).Debug mocables
mocables: release-mocables debug-mocables
release-mocables:
$(MAKE) -f $(MAKEFILE).Release mocables
mocables: debug-mocables release-mocables
check: first
benchmark: first
FORCE:
$(MAKEFILE).Release: Makefile
$(MAKEFILE).Debug: Makefile
$(MAKEFILE).Release: Makefile

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -58,7 +58,8 @@ SOURCES += Sources/main.cpp \
Sources/CANBus/CANWatchdogConfig.cpp \
Sources/GeneralSystemParams.cpp \
Sources/CANBus/CANWatchdog.cpp \
Sources/ComputerBoardInterface.cpp
Sources/ComputerBoardInterface.cpp \
Sources/CPUWatchdogConfig.cpp
HEADERS += Sources/MainWindow.h \
Sources/PCANInterface.h \
@ -87,7 +88,8 @@ HEADERS += Sources/MainWindow.h \
Sources/GeneralSystemParams.h \
Sources/CANBus/CANWatchdog.h \
Sources/Axiomtek/AxUfiAPI.h \
Sources/ComputerBoardInterface.h
Sources/ComputerBoardInterface.h \
Sources/CPUWatchdogConfig.h
FORMS += Sources/Gui/MainWindow.ui \
Sources/Gui/GeneralStatusPage.ui \

View File

@ -0,0 +1,34 @@
#include "CPUWatchdogConfig.h"
CCPUWatchdogConfig::CCPUWatchdogConfig()
{
mWatchdogEnabled = false;
mWatchdogTimeout = 600; //10 minutes
}
CCPUWatchdogConfig& CCPUWatchdogConfig::operator=(const CCPUWatchdogConfig &source)
{
if(&source == this)
return *this;
this->mWatchdogEnabled = source.mWatchdogEnabled;
this->mWatchdogTimeout = source.mWatchdogTimeout;
return *this;
}
QDataStream &operator>>(QDataStream &in, CCPUWatchdogConfig &dest)
{
in >> dest.mWatchdogEnabled
>> dest.mWatchdogTimeout;
return in;
}
QDataStream &operator<<(QDataStream &out, const CCPUWatchdogConfig &source)
{
out << source.mWatchdogEnabled
<< source.mWatchdogTimeout;
return out;
}

View File

@ -0,0 +1,22 @@
#ifndef CPUWATCHDOGCONFIG_H
#define CPUWATCHDOGCONFIG_H
#include <QDataStream>
#include <QString>
class CCPUWatchdogConfig
{
public:
CCPUWatchdogConfig();
bool mWatchdogEnabled;
unsigned int mWatchdogTimeout;
CCPUWatchdogConfig &operator=(const CCPUWatchdogConfig &source);
};
QDataStream &operator<<(QDataStream &out, const CCPUWatchdogConfig &source);
QDataStream &operator>>(QDataStream &in, CCPUWatchdogConfig &dest);
#endif // CPUWATCHDOGCONFIG_H

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;
}

View File

@ -5,19 +5,27 @@
#define CPU_DEFAULT_WATCHDOG_TIMEOUT 600 //10 minutes.
#define CPU_LIBRARY_NAME "dtSBC87853x64"
class CCPUWatchdogConfig;
class CComputerBoardInterface
{
public:
CComputerBoardInterface();
int Init();
int DeInit();
int StartCPUWatchdog(int TimeoutInSeconds = CPU_DEFAULT_WATCHDOG_TIMEOUT); //Timeout in seconds
int StartCPUWatchdog(/*int TimeoutInSeconds = CPU_DEFAULT_WATCHDOG_TIMEOUT*/); //Timeout in seconds
int StopCPUWatchdog();
int KickCPUWatchdog();
int SetWatchdogSettings(CCPUWatchdogConfig *Settings);
private:
int LoadLibrary();
int UnloadLibrary();
int mWatchdogTimeout;
bool mWatchdogEnabled;
};
#endif // COMPUTERBOARDINTERFACE_H

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>

View File

@ -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);
}

View File

@ -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);
};

View File

@ -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/>

View File

@ -39,7 +39,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
mMainWindowWidget->addTab(mCANViewerPage,"Données CAN");
mProgramsSettingsTabWidget->addTab(mCANbusSettingsPage,"CAN Bus");
// mProgramsSettingsTabWidget->addTab(mCANWatchdogSettingsPage,"Watchdog");
mProgramsSettingsTabWidget->addTab(mDataLoggingSettingsPage,"Archivage");
mProgramsSettingsTabWidget->addTab(mDataLoggingSettingsPage,"Général");
setWindowFlags(Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
resize(1700,768);

View File

@ -86,12 +86,16 @@ int COtarcikCan::Start()
mMainWindow.mDataLoggingSettingsPage->SetGeneralSettingsParams(&mGeneralSystemParams);
CGeneralMessagesLogDispatcher::instance()->SetLogVerbosities(mGeneralSystemParams.mLogFileVerbosity,mGeneralSystemParams.mLocalLogVerbosity);
mCPUWatchdogParams = *mSystemConfig.GetCPUWatchdogSettings();
mCPUInterface.SetWatchdogSettings(&mCPUWatchdogParams);
mMainWindow.mDataLoggingSettingsPage->SetCPUWatchdogSettings(mSystemConfig.GetCPUWatchdogSettings());
// mMainWindow.mCANWatchdogSettingsPage->SetCANWatchdogConfig(mSystemConfig.GetCANWatchdogConfig());
// mGPTimer->setSingleShot(false);
// mGPTimer->start(5000);
mCPUInterface.StartCPUWatchdog(25);
mCPUInterface.StartCPUWatchdog();
mWatchdogTimer->start();
}
@ -221,6 +225,22 @@ int COtarcikCan::SaveGeneralParametersSettingsRequest(CGeneralSystemParams *Gene
return RET_OK;
}
int COtarcikCan::SaveCPUWatchdogSettingsRequest(CCPUWatchdogConfig *CPUWatchdogParams)
{
mCPUWatchdogParams = *CPUWatchdogParams;
mSystemConfig.SetCPUWatchdogPArams(&mCPUWatchdogParams);
mSystemConfig.SaveConfig();
mCPUInterface.SetWatchdogSettings(&mCPUWatchdogParams);
mCPUInterface.StopCPUWatchdog();
if(mCPUWatchdogParams.mWatchdogEnabled == true)
{
mCPUInterface.StartCPUWatchdog();
}
return RET_OK;
}
void COtarcikCan::GPTimerExpired()
{
// mCANBusMQTTClient.SendMQTTTestMessage();

View File

@ -34,6 +34,7 @@ public:
int SaveCANDevicesConfigRequest(QList<CCANDeviceConfig*> *DevicesConfigList);
int SaveCloudLoggingConfigRequest(CCloudParams *CloudParams);
int SaveGeneralParametersSettingsRequest(CGeneralSystemParams *GeneralParams);
int SaveCPUWatchdogSettingsRequest(CCPUWatchdogConfig *CPUWatchdogParams);
int SetCANConnectionStatusRequest(bool Connected);
int SetMQTTConnectionSatusRequest(bool Connected);
@ -47,6 +48,7 @@ private:
QList<CCANDevice*> mCANDevicesList;
CCloudParams mCloudLoggingParams;
CGeneralSystemParams mGeneralSystemParams;
CCPUWatchdogConfig mCPUWatchdogParams;
int PopulateCANDevicesList(QList<CCANDeviceConfig*> *DevicesConfigsList);

View File

@ -78,6 +78,12 @@ int CSystemConfig::LoadConfig()
//Load CAN Watchdog parameters
*InputStream >> mCANWatchdogParams;
//Load CPU Watchdog parameters
if(FileVersion > 1)
{
*InputStream >> mCPUWatchdogParams;
}
ConfigFile->close();
@ -133,6 +139,9 @@ int CSystemConfig::SaveConfig()
//Save the CAN Watchdog params
*OutputStream << mCANWatchdogParams;
//Save the CPU Watchdog params
*OutputStream << mCPUWatchdogParams;
ConfigFile->flush();
ConfigFile->close();
@ -190,6 +199,10 @@ CGeneralSystemParams *CSystemConfig::GetGeneralSystemSettings()
return &mGeneralSystemParams;
}
CCPUWatchdogConfig *CSystemConfig::GetCPUWatchdogSettings()
{
return &mCPUWatchdogParams;
}
int CSystemConfig::SetCANWatchdogConfig(CCANWatchdogConfig *Config)
{
@ -216,3 +229,12 @@ int CSystemConfig::SetGeneralSystemParams(CGeneralSystemParams *GeneralParams)
mGeneralSystemParams = *GeneralParams;
return RET_OK;
}
int CSystemConfig::SetCPUWatchdogPArams(CCPUWatchdogConfig *CPUWatchdogParams)
{
if(CPUWatchdogParams == 0)
return RET_GENERAL_ERROR;
mCPUWatchdogParams = *CPUWatchdogParams;
return RET_OK;
}

View File

@ -9,8 +9,9 @@
#include "CloudParams.h"
#include "CANWatchdogConfig.h"
#include "GeneralSystemParams.h"
#include "CPUWatchdogConfig.h"
#define OTARCIK_CURRENT_CONFIG_FILE_VERSION 0x01
#define OTARCIK_CURRENT_CONFIG_FILE_VERSION 0x02
#define OTARCIK_CONFIG_FILE_MAGIC_NBR 0xDEADBEEF
//class CCANDeviceConfig;
@ -32,6 +33,8 @@ public:
int SetCloudParams(CCloudParams *CloudParams);
CGeneralSystemParams *GetGeneralSystemSettings();
int SetGeneralSystemParams(CGeneralSystemParams *GeneralParams);
CCPUWatchdogConfig *GetCPUWatchdogSettings();
int SetCPUWatchdogPArams(CCPUWatchdogConfig *CPUWatchdogParams);
@ -50,6 +53,9 @@ public:
CCANWatchdogConfig *GetCANWatchdogConfig();
int SetCANWatchdogConfig(CCANWatchdogConfig *Config);
//Hardware watchdog settings
CCPUWatchdogConfig mCPUWatchdogParams;
};

Binary file not shown.

View File

@ -23,6 +23,7 @@ debug/CANWatchdogConfig.o
debug/GeneralSystemParams.o
debug/CANWatchdog.o
debug/ComputerBoardInterface.o
debug/CPUWatchdogConfig.o
debug/moc_MainWindow.o
debug/moc_PCANInterface.o
debug/moc_OtarcikCan.o

View File

@ -23,6 +23,7 @@ release/CANWatchdogConfig.o
release/GeneralSystemParams.o
release/CANWatchdog.o
release/ComputerBoardInterface.o
release/CPUWatchdogConfig.o
release/moc_MainWindow.o
release/moc_PCANInterface.o
release/moc_OtarcikCan.o

Binary file not shown.

View File

@ -86,7 +86,7 @@ public:
label->setFont(font3);
mQuitAppBtn = new QPushButton(CGeneralStatusPage);
mQuitAppBtn->setObjectName(QString::fromUtf8("mQuitAppBtn"));
mQuitAppBtn->setGeometry(QRect(1529, 560, 131, 22));
mQuitAppBtn->setGeometry(QRect(1230, 310, 131, 22));
retranslateUi(CGeneralStatusPage);

View File

@ -11,6 +11,7 @@
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
@ -48,6 +49,10 @@ public:
QLabel *label;
QLabel *label_2;
QLabel *label_3;
QGroupBox *groupBox_3;
QSpinBox *mWDTimerTimeoutSpinBx;
QLabel *label_7;
QCheckBox *mWDActiveChkBx;
void setupUi(QWidget *CLoggingSettingsPage)
{
@ -165,6 +170,21 @@ public:
label_3->setObjectName(QString::fromUtf8("label_3"));
label_3->setGeometry(QRect(230, 30, 81, 20));
label_3->setFont(font1);
groupBox_3 = new QGroupBox(CLoggingSettingsPage);
groupBox_3->setObjectName(QString::fromUtf8("groupBox_3"));
groupBox_3->setGeometry(QRect(590, 240, 351, 101));
mWDTimerTimeoutSpinBx = new QSpinBox(groupBox_3);
mWDTimerTimeoutSpinBx->setObjectName(QString::fromUtf8("mWDTimerTimeoutSpinBx"));
mWDTimerTimeoutSpinBx->setGeometry(QRect(110, 60, 101, 22));
mWDTimerTimeoutSpinBx->setMinimum(5);
mWDTimerTimeoutSpinBx->setMaximum(15300);
label_7 = new QLabel(groupBox_3);
label_7->setObjectName(QString::fromUtf8("label_7"));
label_7->setGeometry(QRect(20, 60, 91, 21));
label_7->setFont(font2);
mWDActiveChkBx = new QCheckBox(groupBox_3);
mWDActiveChkBx->setObjectName(QString::fromUtf8("mWDActiveChkBx"));
mWDActiveChkBx->setGeometry(QRect(20, 30, 171, 20));
retranslateUi(CLoggingSettingsPage);
@ -190,6 +210,9 @@ public:
label->setText(QCoreApplication::translate("CLoggingSettingsPage", "Verbosit\303\251 du fichier log", nullptr));
label_2->setText(QCoreApplication::translate("CLoggingSettingsPage", "Verbosit\303\251 de la page de statut", nullptr));
label_3->setText(QCoreApplication::translate("CLoggingSettingsPage", "0 = d\303\251sactiv\303\251", nullptr));
groupBox_3->setTitle(QCoreApplication::translate("CLoggingSettingsPage", "Watchdog CPU", nullptr));
label_7->setText(QCoreApplication::translate("CLoggingSettingsPage", "Timeout (s)", nullptr));
mWDActiveChkBx->setText(QCoreApplication::translate("CLoggingSettingsPage", "Activer watchdog", nullptr));
} // retranslateUi
};