From 52f188f848ad9035f0c4d68f2f4cd0da3c39a61f Mon Sep 17 00:00:00 2001 From: John Foster Date: Mon, 6 Apr 2026 15:00:24 -0700 Subject: [PATCH 01/12] Fix comments --- extras/device_client/lib/model/version.dart | 2 +- src/UIState/ResetPHCalibration.cpp | 2 +- src/UIState/ResetThermalCalibration.cpp | 2 +- src/Version.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/device_client/lib/model/version.dart b/extras/device_client/lib/model/version.dart index 917f6589e..c232b7f4c 100644 --- a/extras/device_client/lib/model/version.dart +++ b/extras/device_client/lib/model/version.dart @@ -1 +1 @@ -const String gitVersion = 'v25.4.1 +'; +const String gitVersion = 'v25.4.1-8-g7e17+'; diff --git a/src/UIState/ResetPHCalibration.cpp b/src/UIState/ResetPHCalibration.cpp index 5dcacbc07..ed0806e4d 100644 --- a/src/UIState/ResetPHCalibration.cpp +++ b/src/UIState/ResetPHCalibration.cpp @@ -1,5 +1,5 @@ /** - * SetCalibrationClear.cpp + * ResetPHCalibration.cpp */ #include "ResetPHCalibration.h" diff --git a/src/UIState/ResetThermalCalibration.cpp b/src/UIState/ResetThermalCalibration.cpp index 89d3f324b..69dda3caa 100644 --- a/src/UIState/ResetThermalCalibration.cpp +++ b/src/UIState/ResetThermalCalibration.cpp @@ -1,5 +1,5 @@ /** - * SetCalibrationClear.cpp + * ResetThermalCalibration.cpp */ #include "ResetThermalCalibration.h" diff --git a/src/Version.h b/src/Version.h index 64a455f6f..6e0064d46 100644 --- a/src/Version.h +++ b/src/Version.h @@ -1 +1 @@ -#define VERSION "v25.4.1 +" +#define VERSION "v25.4.1-8-g7e17+" From d0926157e73e5d1651e0e0f6f85c173f1119cbca Mon Sep 17 00:00:00 2001 From: John Foster Date: Mon, 6 Apr 2026 15:01:06 -0700 Subject: [PATCH 02/12] Reset EEPROM --- extras/device_client/lib/model/version.dart | 2 +- src/UIState/ResetEEPROM.cpp | 22 +++++++++++++++++++++ src/UIState/ResetEEPROM.h | 18 +++++++++++++++++ src/Version.h | 2 +- 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/UIState/ResetEEPROM.cpp create mode 100644 src/UIState/ResetEEPROM.h diff --git a/extras/device_client/lib/model/version.dart b/extras/device_client/lib/model/version.dart index c232b7f4c..56d748f8b 100644 --- a/extras/device_client/lib/model/version.dart +++ b/extras/device_client/lib/model/version.dart @@ -1 +1 @@ -const String gitVersion = 'v25.4.1-8-g7e17+'; +const String gitVersion = 'v25.4.1-9-g52f1+'; diff --git a/src/UIState/ResetEEPROM.cpp b/src/UIState/ResetEEPROM.cpp new file mode 100644 index 000000000..58c1746a5 --- /dev/null +++ b/src/UIState/ResetEEPROM.cpp @@ -0,0 +1,22 @@ +/** + * ResetEEPROM.cpp + */ +#include "ResetEEPROM.h" + +#include "Wait.h" +#include "wrappers/EEPROM_TC.h" +#include "wrappers/LiquidCrystal_TC.h" + +void ResetEEPROM::handleKey(char key) { + switch (key) { + case 'A': // Save (erase EEPROM) + EEPROM_TC::instance()->resetAll(); + returnToMainMenu(); + break; + case 'D': // Don't save (cancel) + returnToMainMenu(); + break; + default: + break; + }; +} diff --git a/src/UIState/ResetEEPROM.h b/src/UIState/ResetEEPROM.h new file mode 100644 index 000000000..237813c36 --- /dev/null +++ b/src/UIState/ResetEEPROM.h @@ -0,0 +1,18 @@ +/** + * ResetEEPROM.h + * + * Clear EEPROM + */ +#pragma once +#include "UIState.h" + +class ResetEEPROM : public UIState { +public: + void handleKey(char key); + const __FlashStringHelper* name() { + return F("ResetEEPROM"); + } + const __FlashStringHelper* prompt() { + return F("A: Erase EEPROM"); + }; +}; diff --git a/src/Version.h b/src/Version.h index 6e0064d46..154947cca 100644 --- a/src/Version.h +++ b/src/Version.h @@ -1 +1 @@ -#define VERSION "v25.4.1-8-g7e17+" +#define VERSION "v25.4.1-9-g52f1+" From abe44264e4dbdba005eb71d202520adeeea78bdf Mon Sep 17 00:00:00 2001 From: John Foster Date: Mon, 6 Apr 2026 15:01:27 -0700 Subject: [PATCH 03/12] Reset EEPROM --- extras/device_client/lib/model/version.dart | 2 +- src/Version.h | 2 +- src/wrappers/EEPROM_TC.cpp | 11 +++++++++++ src/wrappers/EEPROM_TC.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/extras/device_client/lib/model/version.dart b/extras/device_client/lib/model/version.dart index 56d748f8b..7fe171800 100644 --- a/extras/device_client/lib/model/version.dart +++ b/extras/device_client/lib/model/version.dart @@ -1 +1 @@ -const String gitVersion = 'v25.4.1-9-g52f1+'; +const String gitVersion = 'v25.4.1-10-gd09+'; diff --git a/src/Version.h b/src/Version.h index 154947cca..2dff642d4 100644 --- a/src/Version.h +++ b/src/Version.h @@ -1 +1 @@ -#define VERSION "v25.4.1-9-g52f1+" +#define VERSION "v25.4.1-10-gd09+" diff --git a/src/wrappers/EEPROM_TC.cpp b/src/wrappers/EEPROM_TC.cpp index 6af8a971b..aac9e1100 100644 --- a/src/wrappers/EEPROM_TC.cpp +++ b/src/wrappers/EEPROM_TC.cpp @@ -73,6 +73,17 @@ void EEPROM_TC::eepromWriteInt(uint16_t address, int32_t value) { } } +/** + * @brief resets EEPROM to factory default by writing 1 to all addresses, and triggers a remote log in DataLogger + * + */ +void EEPROM_TC::resetAll() { + for (uint16_t i = 0; i < EEPROM.length(); i++) { + EEPROM.update(i, 1); + } + DataLogger::instance()->writeWarningSoon(); // log all settings +} + // getter methods float EEPROM_TC::getAmplitude() { return eepromReadFloat(AMPLITUDE_ADDRESS); diff --git a/src/wrappers/EEPROM_TC.h b/src/wrappers/EEPROM_TC.h index be9be0b0d..8550b7c7f 100644 --- a/src/wrappers/EEPROM_TC.h +++ b/src/wrappers/EEPROM_TC.h @@ -11,6 +11,7 @@ class EEPROM_TC { int32_t eepromReadInt(uint16_t address); void eepromWriteFloat(uint16_t address, float value); void eepromWriteInt(uint16_t address, int32_t value); + void resetAll(); // accessor methods float getAmplitude(); // not used From 2e8512e843f59c4cb7f3a4f0362b5f2bbe4a3ee0 Mon Sep 17 00:00:00 2001 From: John Foster Date: Tue, 7 Apr 2026 14:56:28 -0700 Subject: [PATCH 04/12] Disable EEPROM access --- extras/device_client/lib/model/version.dart | 2 +- src/TankController.cpp | 28 +++++++++++++-------- src/UIState/ResetEEPROM.cpp | 6 +++-- src/UIState/ResetEEPROM.h | 3 +++ src/Version.h | 2 +- src/wrappers/EEPROM_TC.cpp | 16 +++++++++--- src/wrappers/EEPROM_TC.h | 7 +++++- 7 files changed, 45 insertions(+), 19 deletions(-) diff --git a/extras/device_client/lib/model/version.dart b/extras/device_client/lib/model/version.dart index 7fe171800..bacbf9da1 100644 --- a/extras/device_client/lib/model/version.dart +++ b/extras/device_client/lib/model/version.dart @@ -1 +1 @@ -const String gitVersion = 'v25.4.1-10-gd09+'; +const String gitVersion = 'v25.4.1-11-gabe+'; diff --git a/src/TankController.cpp b/src/TankController.cpp index 6f73770ad..a6edfcdde 100644 --- a/src/TankController.cpp +++ b/src/TankController.cpp @@ -4,6 +4,7 @@ #include #include "UIState/MainMenu.h" +#include "UIState/ResetEEPROM.h" #include "UIState/UIState.h" #include "Version.h" #include "model/DataLogger.h" @@ -31,18 +32,23 @@ const char TANK_CONTROLLER_VERSION[] = VERSION; /** * static variable to hold singleton */ -TankController *TankController::_instance = nullptr; +TankController* TankController::_instance = nullptr; /** * static function to return singleton */ -TankController *TankController::instance(const char *remoteLogName, const char *pushingBoxID, int tzOffsetHrs) { +TankController* TankController::instance(const char* remoteLogName, const char* pushingBoxID, int tzOffsetHrs) { if (!_instance) { serial(F("\r\n##############\r\nTankController %s"), TANK_CONTROLLER_VERSION); _instance = new TankController(); SD_TC::instance(); RemoteLogPusher::instance()->setRemoteLogName(remoteLogName); EEPROM_TC::instance(); + bool resetEEPROM = Keypad_TC::instance()->getKey() == 'C'; + if (resetEEPROM) { + EEPROM_TC::instance()->setEEPROMAccessEnabled(false); + serial(F("EEPROM access disabled")); + }; Keypad_TC::instance(); LiquidCrystal_TC::instance(TANK_CONTROLLER_VERSION); DataLogger::instance(); @@ -55,7 +61,7 @@ TankController *TankController::instance(const char *remoteLogName, const char * PHControl::instance(); PID_TC::instance(); pinMode(LED_BUILTIN, OUTPUT); - _instance->state = new MainMenu(); + _instance->state = resetEEPROM ? (UIState*)new ResetEEPROM() : (UIState*)new MainMenu(); PushingBox::instance(pushingBoxID); GetTime::instance(tzOffsetHrs); serial(F("Free memory = %i"), _instance->freeMemory()); @@ -114,7 +120,7 @@ int TankController::freeMemory() { #if defined(ARDUINO_CI_COMPILATION_MOCKS) return 1024; #else - extern char *__brkval; + extern char* __brkval; int topOfStack; return (int)((size_t)&topOfStack) - ((size_t)__brkval); @@ -146,7 +152,7 @@ void TankController::handleUI() { // we already have a next state teed-up, do don't try to return to main menu } else if (millis() - lastKeypadTime > IDLE_TIMEOUT) { // time since last keypress exceeds the idle timeout, so return to main menu - setNextState((UIState *)new MainMenu()); + setNextState((UIState*)new MainMenu()); lastKeypadTime = 0; // so we don't do this until another keypress! } } else { @@ -211,7 +217,7 @@ void TankController::serialEvent1() { /** * Set the next state */ -void TankController::setNextState(UIState *newState, bool update) { +void TankController::setNextState(UIState* newState, bool update) { assert(nextState == nullptr); nextState = newState; if (update) { @@ -231,7 +237,7 @@ void TankController::setup() { * Public member function used to get the current state name. * This is primarily used by testing. */ -const __FlashStringHelper *TankController::stateName() { +const __FlashStringHelper* TankController::stateName() { return state->name(); } @@ -262,13 +268,13 @@ void TankController::updateState() { /** * What is the current version? */ -const char *TankController::version() { +const char* TankController::version() { return TANK_CONTROLLER_VERSION; } #if defined(__CYGWIN__) -size_t strnlen(const char *s, size_t n) { - void *found = memchr(s, '\0', n); - return found ? (size_t)((char *)found - s) : n; +size_t strnlen(const char* s, size_t n) { + void* found = memchr(s, '\0', n); + return found ? (size_t)((char*)found - s) : n; } #endif diff --git a/src/UIState/ResetEEPROM.cpp b/src/UIState/ResetEEPROM.cpp index 58c1746a5..bb2698822 100644 --- a/src/UIState/ResetEEPROM.cpp +++ b/src/UIState/ResetEEPROM.cpp @@ -10,11 +10,13 @@ void ResetEEPROM::handleKey(char key) { switch (key) { case 'A': // Save (erase EEPROM) - EEPROM_TC::instance()->resetAll(); + EEPROM_TC::instance()->resetEEPROM(); returnToMainMenu(); break; case 'D': // Don't save (cancel) - returnToMainMenu(); + wdt_enable(WDTO_15MS); + do { + } while (true); break; default: break; diff --git a/src/UIState/ResetEEPROM.h b/src/UIState/ResetEEPROM.h index 237813c36..185d26b9e 100644 --- a/src/UIState/ResetEEPROM.h +++ b/src/UIState/ResetEEPROM.h @@ -9,6 +9,9 @@ class ResetEEPROM : public UIState { public: void handleKey(char key); + bool isInCalibration() { + return true; + } const __FlashStringHelper* name() { return F("ResetEEPROM"); } diff --git a/src/Version.h b/src/Version.h index 2dff642d4..938a521ab 100644 --- a/src/Version.h +++ b/src/Version.h @@ -1 +1 @@ -#define VERSION "v25.4.1-10-gd09+" +#define VERSION "v25.4.1-11-gabe+" diff --git a/src/wrappers/EEPROM_TC.cpp b/src/wrappers/EEPROM_TC.cpp index aac9e1100..de76c73d2 100644 --- a/src/wrappers/EEPROM_TC.cpp +++ b/src/wrappers/EEPROM_TC.cpp @@ -27,7 +27,8 @@ float EEPROM_TC::eepromReadFloat(uint16_t address) { float value = 0.0; byte* p = (byte*)(void*)&value; for (size_t i = 0; i < sizeof(value); i++) { - *p++ = EEPROM.read(address++); + *p++ = eepromAccessEnabled ? EEPROM.read(address++) + : 1; // if access is disabled, return 1s which is the default value for erased EEPROM } return value; } @@ -39,6 +40,10 @@ float EEPROM_TC::eepromReadFloat(uint16_t address) { * @param value */ void EEPROM_TC::eepromWriteFloat(uint16_t address, float value) { + if (!eepromAccessEnabled) { + serial(F("EEPROM disabled, cannot write to address %i"), address); + return; + } if (eepromReadFloat(address) != value) { byte* p = (byte*)(void*)&value; for (size_t i = 0; i < sizeof(value); i++) { @@ -52,7 +57,8 @@ int32_t EEPROM_TC::eepromReadInt(uint16_t address) { int32_t value = 0; byte* p = (byte*)(void*)&value; for (size_t i = 0; i < sizeof(value); i++) { - *p++ = EEPROM.read(address++); + *p++ = eepromAccessEnabled ? EEPROM.read(address++) + : 1; // if access is disabled, return 1s which is the default value for erased EEPROM } return value; } @@ -64,6 +70,10 @@ int32_t EEPROM_TC::eepromReadInt(uint16_t address) { * @param value */ void EEPROM_TC::eepromWriteInt(uint16_t address, int32_t value) { + if (!eepromAccessEnabled) { + serial(F("EEPROM disabled, cannot write to address %i"), address); + return; + } if (eepromReadInt(address) != value) { byte* p = (byte*)(void*)&value; for (size_t i = 0; i < sizeof(value); i++) { @@ -77,7 +87,7 @@ void EEPROM_TC::eepromWriteInt(uint16_t address, int32_t value) { * @brief resets EEPROM to factory default by writing 1 to all addresses, and triggers a remote log in DataLogger * */ -void EEPROM_TC::resetAll() { +void EEPROM_TC::resetEEPROM() { for (uint16_t i = 0; i < EEPROM.length(); i++) { EEPROM.update(i, 1); } diff --git a/src/wrappers/EEPROM_TC.h b/src/wrappers/EEPROM_TC.h index 8550b7c7f..fb070f9d2 100644 --- a/src/wrappers/EEPROM_TC.h +++ b/src/wrappers/EEPROM_TC.h @@ -11,7 +11,7 @@ class EEPROM_TC { int32_t eepromReadInt(uint16_t address); void eepromWriteFloat(uint16_t address, float value); void eepromWriteInt(uint16_t address, int32_t value); - void resetAll(); + void resetEEPROM(); // accessor methods float getAmplitude(); // not used @@ -54,6 +54,9 @@ class EEPROM_TC { float getTempSeriesSize(); // not used // setter methods + void setEEPROMAccessEnabled(bool enabled) { + eepromAccessEnabled = enabled; + } void setAmplitude(float value); void setThermalCorrection(float value); void setFrequency(float value); @@ -98,6 +101,8 @@ class EEPROM_TC { void writeAllToString(char* destination, int size); private: + bool eepromAccessEnabled = true; // disables read/write functions if false to prevent infinite loop when EEPROM is + // corrupted and causing crashes // note that while Arduino floats are 4 bytes, we sometimes allow 8 bytes! // instance variables from v0.197 const uint16_t PH_ADDRESS = 0; // 9.999 From b8f76e29d9c7e8eb203789ea0b8ecca3fcb74632 Mon Sep 17 00:00:00 2001 From: John Foster Date: Tue, 7 Apr 2026 17:26:07 -0700 Subject: [PATCH 05/12] Reboot after user selection --- Makefile | 4 ++++ extras/device_client/lib/model/version.dart | 2 +- src/UIState/ResetEEPROM.cpp | 6 +++++- src/UIState/ResetEEPROM.h | 7 ++++--- src/Version.h | 2 +- src/wrappers/EEPROM_TC.cpp | 4 ++-- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index d9965622b..2fc468dad 100644 --- a/Makefile +++ b/Makefile @@ -377,6 +377,7 @@ OBJECTS=$(BIN)/Arduino.o \ $(BIN)/PHCalibrationMid.o \ $(BIN)/PHCalibrationPrompt.o \ $(BIN)/RemoteLogPusher.o \ + $(BIN)/ResetEEPROM.o \ $(BIN)/SeeDeviceAddress.o \ $(BIN)/SeeDeviceUptime.o \ $(BIN)/SeeFreeMemory.o \ @@ -506,6 +507,9 @@ $(BIN)/PHCalibrationPrompt.o: $(SRC)/UIState/PHCalibrationPrompt.cpp $(HEADERS) $(BIN)/RemoteLogPusher.o: $(SRC)/model/RemoteLogPusher.cpp $(HEADERS) g++ -c $(FLAGS) $(INCLUDE) -o $(BIN)/RemoteLogPusher.o $(SRC)/model/RemoteLogPusher.cpp +$(BIN)/ResetEEPROM.o: $(SRC)/UIState/ResetEEPROM.cpp $(HEADERS) + g++ -c $(FLAGS) $(INCLUDE) -o $(BIN)/ResetEEPROM.o $(SRC)/UIState/ResetEEPROM.cpp + $(BIN)/SeeDeviceAddress.o: $(SRC)/UIState/SeeDeviceAddress.cpp $(HEADERS) g++ -c $(FLAGS) $(INCLUDE) -o $(BIN)/SeeDeviceAddress.o $(SRC)/UIState/SeeDeviceAddress.cpp diff --git a/extras/device_client/lib/model/version.dart b/extras/device_client/lib/model/version.dart index bacbf9da1..6cca22814 100644 --- a/extras/device_client/lib/model/version.dart +++ b/extras/device_client/lib/model/version.dart @@ -1 +1 @@ -const String gitVersion = 'v25.4.1-11-gabe+'; +const String gitVersion = 'v25.4.1-12-g2e8+'; diff --git a/src/UIState/ResetEEPROM.cpp b/src/UIState/ResetEEPROM.cpp index bb2698822..732d19232 100644 --- a/src/UIState/ResetEEPROM.cpp +++ b/src/UIState/ResetEEPROM.cpp @@ -3,6 +3,8 @@ */ #include "ResetEEPROM.h" +#include + #include "Wait.h" #include "wrappers/EEPROM_TC.h" #include "wrappers/LiquidCrystal_TC.h" @@ -11,7 +13,9 @@ void ResetEEPROM::handleKey(char key) { switch (key) { case 'A': // Save (erase EEPROM) EEPROM_TC::instance()->resetEEPROM(); - returnToMainMenu(); + wdt_enable(WDTO_15MS); + do { + } while (true); break; case 'D': // Don't save (cancel) wdt_enable(WDTO_15MS); diff --git a/src/UIState/ResetEEPROM.h b/src/UIState/ResetEEPROM.h index 185d26b9e..ae0c495a5 100644 --- a/src/UIState/ResetEEPROM.h +++ b/src/UIState/ResetEEPROM.h @@ -1,7 +1,8 @@ /** * ResetEEPROM.h * - * Clear EEPROM + * Asks whether to reset EEPROM to factory default, which is useful if the data is corrupted and causing crashes. This + * is accessed by holding the 'C' key on the keypad during startup. The device is rebooted after the selection is made. */ #pragma once #include "UIState.h" @@ -13,9 +14,9 @@ class ResetEEPROM : public UIState { return true; } const __FlashStringHelper* name() { - return F("ResetEEPROM"); + return F("Erase EEPROM?"); } const __FlashStringHelper* prompt() { - return F("A: Erase EEPROM"); + return F("A: Erase D: Cancel"); }; }; diff --git a/src/Version.h b/src/Version.h index 938a521ab..859c93c1b 100644 --- a/src/Version.h +++ b/src/Version.h @@ -1 +1 @@ -#define VERSION "v25.4.1-11-gabe+" +#define VERSION "v25.4.1-12-g2e8+" diff --git a/src/wrappers/EEPROM_TC.cpp b/src/wrappers/EEPROM_TC.cpp index de76c73d2..07d0f10c2 100644 --- a/src/wrappers/EEPROM_TC.cpp +++ b/src/wrappers/EEPROM_TC.cpp @@ -84,14 +84,14 @@ void EEPROM_TC::eepromWriteInt(uint16_t address, int32_t value) { } /** - * @brief resets EEPROM to factory default by writing 1 to all addresses, and triggers a remote log in DataLogger + * @brief resets EEPROM to factory default by writing 1 to all addresses, and reenables read/write functions * */ void EEPROM_TC::resetEEPROM() { for (uint16_t i = 0; i < EEPROM.length(); i++) { EEPROM.update(i, 1); } - DataLogger::instance()->writeWarningSoon(); // log all settings + eepromAccessEnabled = true; } // getter methods From 6a53b5c857e344a634fe0713320a7bd880f91d74 Mon Sep 17 00:00:00 2001 From: John Foster Date: Wed, 8 Apr 2026 13:18:58 -0700 Subject: [PATCH 06/12] Fix mistakes --- extras/device_client/lib/model/version.dart | 2 +- src/TankController.cpp | 8 ++++++-- src/UIState/ResetEEPROM.h | 4 ++-- src/Version.h | 2 +- src/wrappers/EEPROM_TC.cpp | 8 ++++---- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/extras/device_client/lib/model/version.dart b/extras/device_client/lib/model/version.dart index 6cca22814..ae1c5ad93 100644 --- a/extras/device_client/lib/model/version.dart +++ b/extras/device_client/lib/model/version.dart @@ -1 +1 @@ -const String gitVersion = 'v25.4.1-12-g2e8+'; +const String gitVersion = 'v25.4.1-13-gb8f+'; diff --git a/src/TankController.cpp b/src/TankController.cpp index a6edfcdde..449eeb02a 100644 --- a/src/TankController.cpp +++ b/src/TankController.cpp @@ -44,12 +44,12 @@ TankController* TankController::instance(const char* remoteLogName, const char* SD_TC::instance(); RemoteLogPusher::instance()->setRemoteLogName(remoteLogName); EEPROM_TC::instance(); + Keypad_TC::instance(); bool resetEEPROM = Keypad_TC::instance()->getKey() == 'C'; if (resetEEPROM) { EEPROM_TC::instance()->setEEPROMAccessEnabled(false); serial(F("EEPROM access disabled")); }; - Keypad_TC::instance(); LiquidCrystal_TC::instance(TANK_CONTROLLER_VERSION); DataLogger::instance(); DateTime_TC::rtc(); @@ -61,7 +61,11 @@ TankController* TankController::instance(const char* remoteLogName, const char* PHControl::instance(); PID_TC::instance(); pinMode(LED_BUILTIN, OUTPUT); - _instance->state = resetEEPROM ? (UIState*)new ResetEEPROM() : (UIState*)new MainMenu(); + // _instance->state = resetEEPROM ? (UIState*)new ResetEEPROM() : (UIState*)new MainMenu(); + _instance->state = new MainMenu(); + if (resetEEPROM) { + _instance->setNextState(new ResetEEPROM()); + } PushingBox::instance(pushingBoxID); GetTime::instance(tzOffsetHrs); serial(F("Free memory = %i"), _instance->freeMemory()); diff --git a/src/UIState/ResetEEPROM.h b/src/UIState/ResetEEPROM.h index ae0c495a5..f613472ba 100644 --- a/src/UIState/ResetEEPROM.h +++ b/src/UIState/ResetEEPROM.h @@ -14,9 +14,9 @@ class ResetEEPROM : public UIState { return true; } const __FlashStringHelper* name() { - return F("Erase EEPROM?"); + return F("ResetEEPROM"); } const __FlashStringHelper* prompt() { - return F("A: Erase D: Cancel"); + return F("A: Erase EEPROM"); }; }; diff --git a/src/Version.h b/src/Version.h index 859c93c1b..35ff7a50d 100644 --- a/src/Version.h +++ b/src/Version.h @@ -1 +1 @@ -#define VERSION "v25.4.1-12-g2e8+" +#define VERSION "v25.4.1-13-gb8f+" diff --git a/src/wrappers/EEPROM_TC.cpp b/src/wrappers/EEPROM_TC.cpp index 07d0f10c2..51e4c7c93 100644 --- a/src/wrappers/EEPROM_TC.cpp +++ b/src/wrappers/EEPROM_TC.cpp @@ -28,7 +28,7 @@ float EEPROM_TC::eepromReadFloat(uint16_t address) { byte* p = (byte*)(void*)&value; for (size_t i = 0; i < sizeof(value); i++) { *p++ = eepromAccessEnabled ? EEPROM.read(address++) - : 1; // if access is disabled, return 1s which is the default value for erased EEPROM + : 0xff; // if access is disabled, return 1s which is the default value for erased EEPROM } return value; } @@ -58,7 +58,7 @@ int32_t EEPROM_TC::eepromReadInt(uint16_t address) { byte* p = (byte*)(void*)&value; for (size_t i = 0; i < sizeof(value); i++) { *p++ = eepromAccessEnabled ? EEPROM.read(address++) - : 1; // if access is disabled, return 1s which is the default value for erased EEPROM + : 0xff; // if access is disabled, return 1s which is the default value for erased EEPROM } return value; } @@ -84,12 +84,12 @@ void EEPROM_TC::eepromWriteInt(uint16_t address, int32_t value) { } /** - * @brief resets EEPROM to factory default by writing 1 to all addresses, and reenables read/write functions + * @brief resets EEPROM to factory default by writing 1 to all bits, and reenables read/write functions * */ void EEPROM_TC::resetEEPROM() { for (uint16_t i = 0; i < EEPROM.length(); i++) { - EEPROM.update(i, 1); + EEPROM.update(i, 0xff); } eepromAccessEnabled = true; } From a827a8439ab5ccb362c76a278c5152e275814a06 Mon Sep 17 00:00:00 2001 From: John Foster Date: Wed, 8 Apr 2026 14:38:43 -0700 Subject: [PATCH 07/12] UI changes --- extras/device_client/lib/model/version.dart | 2 +- src/UIState/ResetEEPROM.cpp | 5 +++++ src/UIState/ResetEEPROM.h | 1 + src/Version.h | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/extras/device_client/lib/model/version.dart b/extras/device_client/lib/model/version.dart index ae1c5ad93..db95c3265 100644 --- a/extras/device_client/lib/model/version.dart +++ b/extras/device_client/lib/model/version.dart @@ -1 +1 @@ -const String gitVersion = 'v25.4.1-13-gb8f+'; +const String gitVersion = 'v25.4.1-14-g6a5+'; diff --git a/src/UIState/ResetEEPROM.cpp b/src/UIState/ResetEEPROM.cpp index 732d19232..4452856ab 100644 --- a/src/UIState/ResetEEPROM.cpp +++ b/src/UIState/ResetEEPROM.cpp @@ -26,3 +26,8 @@ void ResetEEPROM::handleKey(char key) { break; }; } + +void ResetEEPROM::start() { + LiquidCrystal_TC::instance()->writeLine(prompt(), 0); + LiquidCrystal_TC::instance()->writeLine(F("D: Cancel"), 1); +} diff --git a/src/UIState/ResetEEPROM.h b/src/UIState/ResetEEPROM.h index f613472ba..52f1ce3d7 100644 --- a/src/UIState/ResetEEPROM.h +++ b/src/UIState/ResetEEPROM.h @@ -13,6 +13,7 @@ class ResetEEPROM : public UIState { bool isInCalibration() { return true; } + void start() override; const __FlashStringHelper* name() { return F("ResetEEPROM"); } diff --git a/src/Version.h b/src/Version.h index 35ff7a50d..abc36fed0 100644 --- a/src/Version.h +++ b/src/Version.h @@ -1 +1 @@ -#define VERSION "v25.4.1-13-gb8f+" +#define VERSION "v25.4.1-14-g6a5+" From 5962baf5057ca4343fb078daf8d4134e0f65c1c5 Mon Sep 17 00:00:00 2001 From: John Foster Date: Thu, 9 Apr 2026 16:38:19 -0700 Subject: [PATCH 08/12] Overload Ethernet_TC::instance() --- src/TankController.cpp | 9 ++++----- src/wrappers/Ethernet_TC.cpp | 13 +++++++++---- src/wrappers/Ethernet_TC.h | 5 +++-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/TankController.cpp b/src/TankController.cpp index 449eeb02a..f9851bcde 100644 --- a/src/TankController.cpp +++ b/src/TankController.cpp @@ -45,15 +45,15 @@ TankController* TankController::instance(const char* remoteLogName, const char* RemoteLogPusher::instance()->setRemoteLogName(remoteLogName); EEPROM_TC::instance(); Keypad_TC::instance(); - bool resetEEPROM = Keypad_TC::instance()->getKey() == 'C'; - if (resetEEPROM) { + char key = Keypad_TC::instance()->getKey(); + if (key == '1') { EEPROM_TC::instance()->setEEPROMAccessEnabled(false); serial(F("EEPROM access disabled")); }; LiquidCrystal_TC::instance(TANK_CONTROLLER_VERSION); DataLogger::instance(); DateTime_TC::rtc(); - Ethernet_TC::instance(); + Ethernet_TC::instance(key == NO_KEY ? 60000 : 1); EthernetServer_TC::instance(); ThermalProbe_TC::instance(); ThermalControl::instance(); @@ -61,9 +61,8 @@ TankController* TankController::instance(const char* remoteLogName, const char* PHControl::instance(); PID_TC::instance(); pinMode(LED_BUILTIN, OUTPUT); - // _instance->state = resetEEPROM ? (UIState*)new ResetEEPROM() : (UIState*)new MainMenu(); _instance->state = new MainMenu(); - if (resetEEPROM) { + if (key == '1') { _instance->setNextState(new ResetEEPROM()); } PushingBox::instance(pushingBoxID); diff --git a/src/wrappers/Ethernet_TC.cpp b/src/wrappers/Ethernet_TC.cpp index 46287c902..f31069c3f 100644 --- a/src/wrappers/Ethernet_TC.cpp +++ b/src/wrappers/Ethernet_TC.cpp @@ -9,14 +9,12 @@ Ethernet_TC *Ethernet_TC::_instance = nullptr; // Establishes the Ethernet connection and sets class variables -Ethernet_TC::Ethernet_TC() { +Ethernet_TC::Ethernet_TC(long timeout) { pinMode(SD_SELECT_PIN, OUTPUT); digitalWrite(SD_SELECT_PIN, HIGH); readMac(); serial(F("Attempting to connect to Ethernet")); wdt_disable(); - int key = Keypad_TC::instance()->getKey(); - long timeout = key == NO_KEY ? 60000 : 1; if (Ethernet.begin(mac, timeout)) { IP = Ethernet.localIP(); serial(F("DHCP address is %i.%i.%i.%i"), IP[0], IP[1], IP[2], IP[3]); @@ -32,13 +30,20 @@ Ethernet_TC::Ethernet_TC() { wdt_enable(WDTO_8S); } +/** + * This method is used in testing. + */ Ethernet_TC *Ethernet_TC::instance(bool reset) { if (reset && _instance) { delete _instance; _instance = nullptr; } + return instance(); // Call the other instance() method to create the instance if it doesn't exist +} + +Ethernet_TC *Ethernet_TC::instance(long timeout) { if (_instance == nullptr) { - _instance = new Ethernet_TC; + _instance = new Ethernet_TC(timeout); } return _instance; } diff --git a/src/wrappers/Ethernet_TC.h b/src/wrappers/Ethernet_TC.h index e3a171da7..9753089c1 100644 --- a/src/wrappers/Ethernet_TC.h +++ b/src/wrappers/Ethernet_TC.h @@ -10,7 +10,8 @@ class Ethernet_TC { public: - static Ethernet_TC *instance(bool reset = false); + static Ethernet_TC *instance(bool reset); + static Ethernet_TC *instance(long timeout = 60000); IPAddress getIP() { return IP; }; @@ -27,7 +28,7 @@ class Ethernet_TC { void loop(); protected: - Ethernet_TC(); + Ethernet_TC(long timeout); private: static Ethernet_TC *_instance; From 9ac834778c8b58026bf21df8b7f976d9c214c384 Mon Sep 17 00:00:00 2001 From: John Foster Date: Thu, 30 Apr 2026 16:52:46 -0700 Subject: [PATCH 09/12] Claude's fix to reboot issue --- extras/device_client/lib/model/version.dart | 2 +- src/TankController.cpp | 22 ++++++++++++++++++++- src/UIState/ResetEEPROM.h | 8 ++++---- src/Version.h | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/extras/device_client/lib/model/version.dart b/extras/device_client/lib/model/version.dart index db95c3265..d505d7c53 100644 --- a/extras/device_client/lib/model/version.dart +++ b/extras/device_client/lib/model/version.dart @@ -1 +1 @@ -const String gitVersion = 'v25.4.1-14-g6a5+'; +const String gitVersion = 'v25.4.1-17-g80b+'; diff --git a/src/TankController.cpp b/src/TankController.cpp index f9851bcde..4a57968b4 100644 --- a/src/TankController.cpp +++ b/src/TankController.cpp @@ -28,6 +28,26 @@ const char TANK_CONTROLLER_VERSION[] = VERSION; +// ------------ Early Boot Watchdog Disable ------------ +/** + * Disable the watchdog timer immediately on boot, before main()/setup() runs. + * + * After a watchdog reset on AVR, the WDT remains enabled with whatever timeout + * triggered the reset (e.g. the 15 ms used by ResetEEPROM). The stock Mega2560 + * bootloader does not clear MCUSR or call wdt_disable(), and it takes longer + * than 15 ms to hand control to the sketch -- so the WDT fires again inside + * the bootloader, looping forever and appearing as a "freeze." Clearing MCUSR + * and disabling the WDT from .init3 runs before the C runtime / main() and + * breaks that loop. See avr-libc documentation. + */ +#if !defined(ARDUINO_CI_COMPILATION_MOCKS) +void disableWatchdogAtBoot(void) __attribute__((naked, used, section(".init3"))); +void disableWatchdogAtBoot(void) { + MCUSR = 0; + wdt_disable(); +} +#endif + // ------------ Class Methods ------------ /** * static variable to hold singleton @@ -53,7 +73,7 @@ TankController* TankController::instance(const char* remoteLogName, const char* LiquidCrystal_TC::instance(TANK_CONTROLLER_VERSION); DataLogger::instance(); DateTime_TC::rtc(); - Ethernet_TC::instance(key == NO_KEY ? 60000 : 1); + Ethernet_TC::instance(key == NO_KEY ? (long)60000 : (long)1); // if a key is held, use a short timeout EthernetServer_TC::instance(); ThermalProbe_TC::instance(); ThermalControl::instance(); diff --git a/src/UIState/ResetEEPROM.h b/src/UIState/ResetEEPROM.h index 52f1ce3d7..ebc76e6e8 100644 --- a/src/UIState/ResetEEPROM.h +++ b/src/UIState/ResetEEPROM.h @@ -9,15 +9,15 @@ class ResetEEPROM : public UIState { public: - void handleKey(char key); - bool isInCalibration() { + void handleKey(char key) override; + bool isInCalibration() override { return true; } void start() override; - const __FlashStringHelper* name() { + const __FlashStringHelper* name() override { return F("ResetEEPROM"); } - const __FlashStringHelper* prompt() { + const __FlashStringHelper* prompt() override { return F("A: Erase EEPROM"); }; }; diff --git a/src/Version.h b/src/Version.h index abc36fed0..078d9c1be 100644 --- a/src/Version.h +++ b/src/Version.h @@ -1 +1 @@ -#define VERSION "v25.4.1-14-g6a5+" +#define VERSION "v25.4.1-17-g80b+" From f49102044035a41648a92a04416a6d33c6a58eab Mon Sep 17 00:00:00 2001 From: John Foster Date: Thu, 30 Apr 2026 17:16:03 -0700 Subject: [PATCH 10/12] ResetEEPROM tests --- Makefile | 16 +++-- extras/device_client/lib/model/version.dart | 2 +- src/UIState/ResetEEPROM.h | 2 +- src/Version.h | 2 +- test/ResetEEPROMTest.cpp | 69 +++++++++++++++++++++ 5 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 test/ResetEEPROMTest.cpp diff --git a/Makefile b/Makefile index 2fc468dad..12d54359f 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ all : \ $(BIN)/PIDTest.cpp.bin \ $(BIN)/PushingBoxTest.cpp.bin \ $(BIN)/RemoteLogPusherTest.cpp.bin \ + $(BIN)/ResetEEPROMTest.cpp.bin \ $(BIN)/ResetPHCalibrationTest.cpp.bin \ $(BIN)/ResetThermalCalibrationTest.cpp.bin \ $(BIN)/SDTest.cpp.bin \ @@ -175,6 +176,15 @@ $(BIN)/PushingBoxTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/PushingBoxTest.cpp $ $(BIN)/RemoteLogPusherTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/RemoteLogPusherTest.cpp $(HEADERS) $(GPP_TEST) -o $(BIN)/RemoteLogPusherTest.cpp.bin $(TEST)/RemoteLogPusherTest.cpp -larduino +$(BIN)/ResetEEPROMTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/ResetEEPROMTest.cpp $(HEADERS) + $(GPP_TEST) -o $(BIN)/ResetEEPROMTest.cpp.bin $(TEST)/ResetEEPROMTest.cpp -larduino + +$(BIN)/ResetPHCalibrationTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/ResetPHCalibrationTest.cpp $(HEADERS) + $(GPP_TEST) -o $(BIN)/ResetPHCalibrationTest.cpp.bin $(TEST)/ResetPHCalibrationTest.cpp -larduino + +$(BIN)/ResetThermalCalibrationTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/ResetThermalCalibrationTest.cpp $(HEADERS) + $(GPP_TEST) -o $(BIN)/ResetThermalCalibrationTest.cpp.bin $(TEST)/ResetThermalCalibrationTest.cpp -larduino + $(BIN)/SDTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/SDTest.cpp $(HEADERS) $(GPP_TEST) -o $(BIN)/SDTest.cpp.bin $(TEST)/SDTest.cpp -larduino @@ -229,9 +239,6 @@ $(BIN)/SetKITest.cpp.bin: $(BIN)/libarduino.so $(TEST)/SetKITest.cpp $(HEADERS) $(BIN)/SetKPTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/SetKPTest.cpp $(HEADERS) $(GPP_TEST) -o $(BIN)/SetKPTest.cpp.bin $(TEST)/SetKPTest.cpp -larduino -$(BIN)/ResetPHCalibrationTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/ResetPHCalibrationTest.cpp $(HEADERS) - $(GPP_TEST) -o $(BIN)/ResetPHCalibrationTest.cpp.bin $(TEST)/ResetPHCalibrationTest.cpp -larduino - $(BIN)/SetPHTargetTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/SetPHTargetTest.cpp $(HEADERS) $(GPP_TEST) -o $(BIN)/SetPHTargetTest.cpp.bin $(TEST)/SetPHTargetTest.cpp -larduino @@ -241,9 +248,6 @@ $(BIN)/SetPHSineWaveTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/SetPHSineWaveTest $(BIN)/SetTankIDTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/SetTankIDTest.cpp $(HEADERS) $(GPP_TEST) -o $(BIN)/SetTankIDTest.cpp.bin $(TEST)/SetTankIDTest.cpp -larduino -$(BIN)/ResetThermalCalibrationTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/ResetThermalCalibrationTest.cpp $(HEADERS) - $(GPP_TEST) -o $(BIN)/ResetThermalCalibrationTest.cpp.bin $(TEST)/ResetThermalCalibrationTest.cpp -larduino - $(BIN)/SetThermalTargetTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/SetThermalTargetTest.cpp $(HEADERS) $(GPP_TEST) -o $(BIN)/SetThermalTargetTest.cpp.bin $(TEST)/SetThermalTargetTest.cpp -larduino diff --git a/extras/device_client/lib/model/version.dart b/extras/device_client/lib/model/version.dart index d505d7c53..994c528c7 100644 --- a/extras/device_client/lib/model/version.dart +++ b/extras/device_client/lib/model/version.dart @@ -1 +1 @@ -const String gitVersion = 'v25.4.1-17-g80b+'; +const String gitVersion = 'v25.4.1-18-g9ac+'; diff --git a/src/UIState/ResetEEPROM.h b/src/UIState/ResetEEPROM.h index ebc76e6e8..4fa13e4a2 100644 --- a/src/UIState/ResetEEPROM.h +++ b/src/UIState/ResetEEPROM.h @@ -2,7 +2,7 @@ * ResetEEPROM.h * * Asks whether to reset EEPROM to factory default, which is useful if the data is corrupted and causing crashes. This - * is accessed by holding the 'C' key on the keypad during startup. The device is rebooted after the selection is made. + * is accessed by holding the '1' key on the keypad during startup. The device is rebooted after the selection is made. */ #pragma once #include "UIState.h" diff --git a/src/Version.h b/src/Version.h index 078d9c1be..b1007c6e4 100644 --- a/src/Version.h +++ b/src/Version.h @@ -1 +1 @@ -#define VERSION "v25.4.1-17-g80b+" +#define VERSION "v25.4.1-18-g9ac+" diff --git a/test/ResetEEPROMTest.cpp b/test/ResetEEPROMTest.cpp new file mode 100644 index 000000000..753228749 --- /dev/null +++ b/test/ResetEEPROMTest.cpp @@ -0,0 +1,69 @@ +/** + * ResetEEPROMTest.cpp + * + * Tests for the ResetEEPROM UIState. These tests cover the behavior reachable + * from outside the 'A'/'D' branches: prompt rendering, state identity, and + * the no-op handling of every other key. + * + * The 'A' and 'D' branches are intentionally NOT exercised here: both end in + * wdt_enable(WDTO_15MS); + * do { } while (true); + * which the arduino_ci mocks cannot break out of -- entering them would hang + * the test process. Those branches are validated by manual hardware testing. + */ +#include +#include + +#include "Keypad_TC.h" +#include "LiquidCrystal_TC.h" +#include "ResetEEPROM.h" +#include "TankController.h" + +// globals for the singletons used in every test +TankController* tc = TankController::instance(); +LiquidCrystal_TC* lc = LiquidCrystal_TC::instance(); +Keypad* keypad = Keypad_TC::instance()->_getPuppet(); + +// reduce duplicate code and make it more explicit +void enterKey(char key) { + keypad->push_back(key); + tc->loop(); // recognize and apply the key entry +} + +unittest_setup() { + tc->setNextState(new ResetEEPROM(), true); +} + +// 1) Prompt is rendered on entry: line 0 is the question, line 1 is the cancel hint. +unittest(promptIsRenderedOnEntry) { + assertEqual("A: Erase EEPROM ", lc->getLines().at(0)); + assertEqual("D: Cancel ", lc->getLines().at(1)); +} + +// 2) State identity: stateName() reports "ResetEEPROM" while in this state. +unittest(stateNameIsResetEEPROM) { + assertEqual("ResetEEPROM", tc->stateName()); +} + +// 3) isInCalibration() returns true so background controllers/writers stay +// quiet while the user is deciding whether to wipe the EEPROM. +unittest(isInCalibrationIsTrue) { + assertTrue(tc->isInCalibration()); +} + +// 4) Keys other than 'A' and 'D' are no-ops: the state and the on-screen +// prompt are both unchanged. This pins down the current `default: break;` +// behavior so a future edit can't silently add (e.g.) a returnToMainMenu() +// that would let an accidental keypress drop the user out of the prompt. +unittest(unhandledKeysAreNoOps) { + const char unhandledKeys[] = {'0', '1', '2', '3', '4', '5', '6', + '7', '8', '9', 'B', 'C', '*', '#'}; + for (size_t i = 0; i < sizeof(unhandledKeys); ++i) { + enterKey(unhandledKeys[i]); + assertEqual("ResetEEPROM", tc->stateName()); + assertEqual("A: Erase EEPROM ", lc->getLines().at(0)); + assertEqual("D: Cancel ", lc->getLines().at(1)); + } +} + +unittest_main() From 62b5006a32c90094e184e438b1487f1f8fc41ca7 Mon Sep 17 00:00:00 2001 From: John Foster Date: Thu, 30 Apr 2026 20:48:07 -0700 Subject: [PATCH 11/12] Free space --- extras/scripts/build.sh | 2 +- extras/scripts/testAndBuild.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/scripts/build.sh b/extras/scripts/build.sh index 5963d9e59..f1024e1ad 100755 --- a/extras/scripts/build.sh +++ b/extras/scripts/build.sh @@ -1,5 +1,5 @@ #! /bin/bash bundle config set --local path 'vendor/bundle' bundle install -bundle exec arduino_ci.rb --min-free-space=5640 --skip-unittests 1> >(tee stdout.txt ) 2> >(tee stderr.txt >&2 ); result=$? +bundle exec arduino_ci.rb --min-free-space=5632 --skip-unittests 1> >(tee stdout.txt ) 2> >(tee stderr.txt >&2 ); result=$? exit "$result" diff --git a/extras/scripts/testAndBuild.sh b/extras/scripts/testAndBuild.sh index e88d16d02..4f164dd65 100755 --- a/extras/scripts/testAndBuild.sh +++ b/extras/scripts/testAndBuild.sh @@ -3,6 +3,6 @@ cp extras/scripts/p*-commit .git/hooks/ bundle config set --local path 'vendor/bundle' bundle install -bundle exec arduino_ci.rb --min-free-space=5640 1> >(tee stdout.txt ) 2> >(tee stderr.txt >&2 ) +bundle exec arduino_ci.rb --min-free-space=5632 1> >(tee stdout.txt ) 2> >(tee stderr.txt >&2 ) result="${PIPESTATUS[0]}" exit "$result" From 02e0aee4518f1d7a6aea9db260206383d677e946 Mon Sep 17 00:00:00 2001 From: John Foster Date: Thu, 30 Apr 2026 20:55:53 -0700 Subject: [PATCH 12/12] lint --- src/wrappers/Ethernet_TC.cpp | 2 +- test/ResetEEPROMTest.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wrappers/Ethernet_TC.cpp b/src/wrappers/Ethernet_TC.cpp index f31069c3f..3973dd757 100644 --- a/src/wrappers/Ethernet_TC.cpp +++ b/src/wrappers/Ethernet_TC.cpp @@ -38,7 +38,7 @@ Ethernet_TC *Ethernet_TC::instance(bool reset) { delete _instance; _instance = nullptr; } - return instance(); // Call the other instance() method to create the instance if it doesn't exist + return instance(); // Call the other instance() method to create the instance if it doesn't exist } Ethernet_TC *Ethernet_TC::instance(long timeout) { diff --git a/test/ResetEEPROMTest.cpp b/test/ResetEEPROMTest.cpp index 753228749..57e9b3688 100644 --- a/test/ResetEEPROMTest.cpp +++ b/test/ResetEEPROMTest.cpp @@ -56,8 +56,7 @@ unittest(isInCalibrationIsTrue) { // behavior so a future edit can't silently add (e.g.) a returnToMainMenu() // that would let an accidental keypress drop the user out of the prompt. unittest(unhandledKeysAreNoOps) { - const char unhandledKeys[] = {'0', '1', '2', '3', '4', '5', '6', - '7', '8', '9', 'B', 'C', '*', '#'}; + const char unhandledKeys[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'B', 'C', '*', '#'}; for (size_t i = 0; i < sizeof(unhandledKeys); ++i) { enterKey(unhandledKeys[i]); assertEqual("ResetEEPROM", tc->stateName());