Reduce number of watchdog timer resets and rename Makefile target

This commit is contained in:
2024-09-27 14:35:03 +02:00
parent aa0cd89d4e
commit ae329083db
6 changed files with 40 additions and 40 deletions

View File

@@ -70,8 +70,9 @@ static int Init(void)
// allowing us to detect infinite loops and any
// other error that halts execution.
if (WDT_HasTriggered())
if (WDT_HasTriggered()) {
Info("Unexpected system reset.");
}
WDT_Enable();
WDT_SetTimeoutFlag(WDT2000); // 2 seconds
@@ -80,7 +81,7 @@ static int Init(void)
// stored in EEPROM and load them. Some sanity
// checking must be done before using those.
if (MEM_Read(&mem)) { // Any valid blocks found?
if (MEM_Read(&mem)) { // Any valid block found?
Info("Found persistent configuration in EEPROM!");
Info("Using targets TEMP=%.2fC, DEWP=%.2fC.",
mem.temp, mem.dewp);
@@ -146,7 +147,6 @@ static void Update(void)
// Parse serial commands
while ((ch = USART_Getc()) >= 0) {
if (!CMD_Parse(ch, &cmd)) {
WDT_Reset();
continue;
}
switch(cmd.type) {
@@ -181,7 +181,7 @@ static void SetTarget(float t, float td)
Info("Setting temperature to %.2fC.", t);
Info("Setting dewpoint to %.2fC.", td);
// Even with level wearing there is a finite number
// Even with wear leveling there is a finite number
// of EEPROM write cycles so we should always check
// for redundant values. This could be handled by
// the underlying memory implementation.