From 48ec4be5fe4f74abd306083b57b15432dc12208a Mon Sep 17 00:00:00 2001
From: Frans Veldman <develop@thefloatinglab.world>
Date: Sun, 30 Mar 2025 00:31:43 +0000
Subject: [PATCH] Code maintenance improvements.

---
 HotWaterManager.h   | 20 +++++++++++++-------
 HotWaterManager.ino |  7 +++++--
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/HotWaterManager.h b/HotWaterManager.h
index 0cdd259..0dfb810 100644
--- a/HotWaterManager.h
+++ b/HotWaterManager.h
@@ -1,15 +1,21 @@
 // ****** Hardware Model definitions ********
 
-#define ARDUINO_            0                               // Use this one if you want to build this project around an Arduino
-#define HWV_1_0             1                               // Hardware version 1.0 of the Thermal Optimizer board (only a few were made)
-#define HWV_1_1             2                               // Hardware version 1.1 of the Thermal Optimizer board
-#define HWV_1_2             3                               // Hardware version 1.2 of the Thermal Optimizer board
+// Do not change these definitions! The numerical order is important!
+#define ARDUINO_            0
+#define HWV_1_0             1
+#define HWV_1_1             2
+#define HWV_1_2             3
 
 // ********* Hardware Model ************
-#define HWMODEL             ARDUINO_                        // Change this into the hardware model you want to compile for
+// Uncomment ONE of the following:
+#define HWMODEL             ARDUINO_                        // Use this one if you want to build this project around an Arduino
+//#define HWMODEL             HWV_1_0                        // Use this one if you want to build this project for a ThermalOptimizer board v1.0
+//#define HWMODEL             HWV_1_1                        // Use this one if you want to build this project for a ThermalOptimizer board v1.1
+//#define HWMODEL             HWV_1_2                        // Use this one if you want to build this project for a ThermalOptimizer board v1.2
 
-// Debug definitions, leave commented for production!
-//#define SIMTEMP               713                         // Use this to test the program without actual temperature sensors connected. 713 simulates 71.3 Celcius
+// ******** Debug definitions **********
+// Leave commented for production!
+//#define SIMTEMP               683                         // Use this to test the program without actual temperature sensors connected. 683 simulates 68.3 Celcius
 //#define SIMVOLT               141                         // Use this to test the program for a specific voltage. 141 simulates 14.1
 //#define USEDEFAULT            1                           // declutter the EPROM, use the defaults
 
diff --git a/HotWaterManager.ino b/HotWaterManager.ino
index b66c42c..d934afa 100644
--- a/HotWaterManager.ino
+++ b/HotWaterManager.ino
@@ -342,8 +342,8 @@ void setup() {
 
 #ifndef USEDEFAULT
     eeprom_read_block((void*)&rom, (void*)0, sizeof(rom));  // These are the configuration settings.
-    brightness(rom.brightness);
 #endif
+    brightness(rom.brightness);
 
     // Prime the "history" of the temperature. Make sure we start with a downward trend
     delay(1500);
@@ -684,6 +684,9 @@ void processmodes() {
 
     // Update the temperature trend arrow
     lcd.setCursor(13,0);
+#ifdef SIMTEMP
+    lcd.write(6);                                           // Simulate upward trend
+#else
     if(readtemp(0)-lastTemperature>=TRENDDELTA) {
         lcd.write(6);                                       // Trend is going up
         lastTemperature=readtemp(0);
@@ -692,7 +695,7 @@ void processmodes() {
         lcd.write(5);                                       // Trend is going down
         lastTemperature=readtemp(0);
     }
-    
+#endif    
     lcd.setCursor(14,0);
 
     if(hwv && hwv_timer) {                                  // If the hot water valve is selected...