From 330b3e7649e33191c14d86fb624ddaf8aa69e3d9 Mon Sep 17 00:00:00 2001 From: Marcus Date: Wed, 8 May 2024 18:38:54 +0200 Subject: [PATCH] firmware wip - Notification about Maintenance Mode on display --- Arduino/CanGrow/CanGrow.ino | 129 +++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 59 deletions(-) diff --git a/Arduino/CanGrow/CanGrow.ino b/Arduino/CanGrow/CanGrow.ino index e1d5f9f..37659fd 100644 --- a/Arduino/CanGrow/CanGrow.ino +++ b/Arduino/CanGrow/CanGrow.ino @@ -1355,67 +1355,78 @@ void displayScreens() { } display.setCursor(0,0); + + if(MaintenanceMode == true) { + display.drawBitmap(0, 0, bmpCanGrow_Logo, 128, 32, WHITE); + display.display(); + display.setCursor(0,32); + display.println("Maintenance mode active"); + display.print("Time left: "); + display.print(MaintenanceDuration - ((millis() - MaintenanceStarted) / 1000)); + display.println("s"); + } else { // in this switch case the single screens gets defined - switch(ScreenToDisplay) { - case 0: - display.print("Humidity: "); - display.print(valHumidity); - display.println(" %"); - display.println(""); - display.print("Temperature: "); - display.print(valTemperature); - display.println(" C"); - display.println(""); - display.print("Moisture: "); - display.print(valSoilmoisture); - display.println(" %"); - display.println(""); - if(UsePump == true) { - display.print("Pump Waterlvl: "); - switch(valWaterlevel) { - case 0: - display.println("OK"); - break; - case 1: - display.println("Warn"); - break; - case 2: - display.println("Crit"); - break; + switch(ScreenToDisplay) { + case 0: + display.print("Humidity: "); + display.print(valHumidity); + display.println(" %"); + display.println(""); + display.print("Temperature: "); + display.print(valTemperature); + display.println(" C"); + display.println(""); + display.print("Moisture: "); + display.print(valSoilmoisture); + display.println(" %"); + display.println(""); + if(UsePump == true) { + display.print("Pump Waterlvl: "); + switch(valWaterlevel) { + case 0: + display.println("OK"); + break; + case 1: + display.println("Warn"); + break; + case 2: + display.println("Crit"); + break; + } } - } - break; - - case 1: - display.print("LED: "); - display.print(PinLEDPWM * 100 / 255); - display.println(" %"); - display.print("State: "); - display.println(digitalRead(PinLED)); - display.println(""); - display.print("FAN: "); - display.print(PinFANPWM * 100 / 255); - display.println(" %"); - display.print("State: "); - display.println(digitalRead(PinFAN)); - display.println(""); - display.print("Pump state: "); - display.println(digitalRead(PinPUMP)); - break; - - case 2: - // display Logo - display.drawBitmap(0, 0, bmpCanGrow_Logo, 128, 32, WHITE); - display.display(); - display.setCursor(0,32); - display.println(GrowName); - display.print("DoG: "); - display.print(DayOfGrow); - display.print(", "); - display.println(timeClient.getFormattedTime()); - display.print("IP: "); - display.println(WiFi.localIP()); - break; + break; + + case 1: + display.print("LED: "); + display.print(PinLEDPWM * 100 / 255); + display.println(" %"); + display.print("State: "); + display.println(digitalRead(PinLED)); + display.println(""); + display.print("FAN: "); + display.print(PinFANPWM * 100 / 255); + display.println(" %"); + display.print("State: "); + display.println(digitalRead(PinFAN)); + display.println(""); + display.print("Pump state: "); + display.println(digitalRead(PinPUMP)); + break; + + case 2: + // display Logo + display.drawBitmap(0, 0, bmpCanGrow_Logo, 128, 32, WHITE); + display.display(); + display.setCursor(0,32); + display.println(GrowName); + display.print("DoG: "); + display.print(DayOfGrow); + display.print(", "); + display.println(timeClient.getFormattedTime()); + display.print("IP: "); + display.println(WiFi.localIP()); + break; + } } ScreenIterationPassed++; display.display();