From 208aadf3a3b1a32533b81eea3e8c97107c2a890f Mon Sep 17 00:00:00 2001 From: Leon Krieg Date: Fri, 20 Sep 2024 23:44:42 +0200 Subject: [PATCH] Check MCUCSR for WDRF flag only and add TODO --- src/common/watchdog.c | 4 ++-- src/main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/watchdog.c b/src/common/watchdog.c index 6e18075..f15b5cc 100644 --- a/src/common/watchdog.c +++ b/src/common/watchdog.c @@ -74,8 +74,8 @@ bool WDT_HasTriggered(void) // 7 6 5 4 3 2 1 0 // JTD ISC2 – JTRF WDRF BORF EXTRF PORF - // Is power-on reset flag not set? - isreset = ((MCUCSR & BIT(0)) == 0); + // Is watchdog reset flag set? + isreset = ((MCUCSR & BIT(3)) == 1); // XXX: Reset flag detection should be a separate // module to handle the different types. diff --git a/src/main.c b/src/main.c index 286a50c..2df9a28 100644 --- a/src/main.c +++ b/src/main.c @@ -10,13 +10,13 @@ // TODO: Make sure wear leveling resets memory correctly. // TODO: Implement primary state machine for update loop. // TODO: Migrate to ATMega 1284P-PU for 2nd 16-bit timer. -// TODO: Keep persistent TEMP and DEWP targets in EEPROM. // TODO: Check thermistor conversion results /w thermometer. // TODO: Implement optional CRC8 sensor measurement check. // TODO: Use 18.432MHz quarz crystal, burn required fuses. // TODO: Make sure nothing breaks with negative temperatures. // TODO: Write an improved command parser (low priority). // TODO: Proper error handling and recovery (after testing). +// TODO: Check why the MCUCSR EXTRF reset flag is set. enum state_e {