From 0f4c20bdce9c9e28bad73022f6ece89e4b6b144b Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Tue, 19 Dec 2023 15:11:51 +0100 Subject: [PATCH 1/2] updated TempSender and LCDReceiver Signed-off-by: Stephan Richter --- Software/LCDReceiver/LCDReceiver.ino | 36 +++++++++++++++------------- Software/TempSender/TempSender.ino | 6 +++-- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Software/LCDReceiver/LCDReceiver.ino b/Software/LCDReceiver/LCDReceiver.ino index 436abf5..8a4edba 100644 --- a/Software/LCDReceiver/LCDReceiver.ino +++ b/Software/LCDReceiver/LCDReceiver.ino @@ -23,36 +23,38 @@ #define LCD_D6 12 #define LCD_D7 13 - - // initialize the library by associating any needed LCD interface pin with the arduino pin number it is connected to LiquidCrystal lcd(LCD_RS, LCD_EN, LCD_D4, LCD_D5, LCD_D6, LCD_D7); - void setup() { Serial.begin(115200); init485(Max485_RO,Max485_RE,Max485_DE,Max485_DI); // library initialization: - invert485polarity(true); // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. - Serial.println(PROGRAM); - lcd.print(PROGRAM); + printMessage(PROGRAM); +} +void printMessage(String s){ + Serial.println(s); + lcd.clear(); + int line = 0; + int col = 0; + auto cstr = s.c_str(); + for (int i=0;i16) { - lcd.setCursor(0, 1); - s=s.substring(16); - s.trim(); - lcd.print(s); - } + printMessage(get485message()); } } diff --git a/Software/TempSender/TempSender.ino b/Software/TempSender/TempSender.ino index 82d927c..f2e306d 100644 --- a/Software/TempSender/TempSender.ino +++ b/Software/TempSender/TempSender.ino @@ -12,7 +12,7 @@ #include #include -#define PROGRAM "RS485-Nano 2.0 / TempSender 1.2" +#define VERSION "1.2" #define BTN_INT 2 // button interrupt pin #define Max485_RO 3 // read-output of Max485 @@ -64,7 +64,9 @@ void setup(){ attachInterrupt(digitalPinToInterrupt(BTN_INT),isr,CHANGE); // Print a message to the LCD. - Serial.println(PROGRAM); + String s = "{nano:"+String(ID)+",revision:2.0,TempSender:"+VERSION+"}"; + Serial.println(s); + send485(s.c_str()); #ifdef LOG_TO_SERIAL Serial.println("14 15 16 17 18 19 20 21"); #endif From 0244d026c9d2da0bce1e6e340899c09fa18bd4c9 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Tue, 19 Dec 2023 15:21:45 +0100 Subject: [PATCH 2/2] minor improvement Signed-off-by: Stephan Richter --- Software/TempSender/TempSender.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Software/TempSender/TempSender.ino b/Software/TempSender/TempSender.ino index f2e306d..7bd0221 100644 --- a/Software/TempSender/TempSender.ino +++ b/Software/TempSender/TempSender.ino @@ -40,7 +40,7 @@ boolean raw_states[8]; boolean states[8]; unsigned long capacitor[8]; unsigned long times[8]; -unsigned long sensor_time = PERIOD; +unsigned long sensor_time = 0; void setup(){