From 04ab5c806cbc1c7af507c7e07638b0444101502e Mon Sep 17 00:00:00 2001 From: Michal Fratczak Date: Mon, 15 Jun 2020 20:41:41 +0100 Subject: [PATCH] Add watchdog --- tracker/code/main/main.cpp | 49 +++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/tracker/code/main/main.cpp b/tracker/code/main/main.cpp index cafff02..a8444ec 100644 --- a/tracker/code/main/main.cpp +++ b/tracker/code/main/main.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include "pigpio.h" #include @@ -27,6 +29,10 @@ const char* C_OFF = "\033[0m"; bool G_RUN = true; // keep threads running +// value written to /dev/watchdog +// '1' enables watchdog +// 'V' disables watchdog +std::atomic_char G_WATCHDOG_V{'1'}; char _hex(char Character) { @@ -93,8 +99,37 @@ zmq::message_t make_zmq_reply(const std::string& i_msg_str) } +void watchdog_reset() +{ + char v = G_WATCHDOG_V.load(); + // std::cout<<"watchdog_reset "<