From 85b955a9c8ea6356ab03ada175a7161b141eabb4 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Mon, 14 Oct 2024 22:10:23 +0200 Subject: [PATCH] minor improvements Signed-off-by: Stephan Richter --- Taupunkt/Taupunkt.ino | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Taupunkt/Taupunkt.ino b/Taupunkt/Taupunkt.ino index 82be2c5..b7630fd 100644 --- a/Taupunkt/Taupunkt.ino +++ b/Taupunkt/Taupunkt.ino @@ -3,9 +3,10 @@ // load library for DHT22 sensor #include -#define TRESHOLD 2 +#define TRESHOLD 1 #define HYSTERESIS 1 #define MIN_OUT_TEMP 5 // °C +#define ALLOWED_HUMIDITY 50 // % #define RELAY_PIN 5 @@ -79,16 +80,8 @@ byte off[8] = { 0b11111 }; - -void setup() { - // set up the LCD - lcd.begin(16, 4); - lcd.createChar(0, degree); - lcd.createChar(1, tau); - lcd.createChar(2, on); - lcd.createChar(3, off); - - // prepare "table" on LCD +void table(){ + // prepare "table" on LCD lcd.setCursor(0,0); lcd.print(" IN OUT"); @@ -106,7 +99,17 @@ void setup() { lcd.print(" . . "); lcd.write((int)0); lcd.print("C"); +} + +void setup() { + // set up the LCD + lcd.begin(16, 4); + lcd.createChar(0, degree); + lcd.createChar(1, tau); + lcd.createChar(2, on); + lcd.createChar(3, off); + table(); // set up the relay pinMode(RELAY_PIN,OUTPUT); @@ -177,6 +180,8 @@ void loop() { outside_temp = dht22outside.getTemperature(); outside_humi = dht22outside.getHumidity(); outside_state = dht22outside.getLastError(); + int secs = millis()/1000; + if (secs % 3600 < 3) table(); boolean inside_error = false, outside_error = false; @@ -244,7 +249,7 @@ void loop() { if (inside_error || outside_error || outside_temp < MIN_OUT_TEMP){ relayOff(); } else { - if (tau_inside > tau_outside + TRESHOLD + HYSTERESIS) { + if (inside_humi > ALLOWED_HUMIDITY && tau_inside > tau_outside + TRESHOLD + HYSTERESIS) { relayOn(); } if (tau_inside < tau_outside + TRESHOLD) {