From 185c2a743c0bd70f66177c554cb8a7ef500eb348 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Thu, 30 Dec 2021 20:29:33 +0100 Subject: [PATCH] different display times for temperature and others --- include/display.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/display.h b/include/display.h index 82a3a53..bb0d310 100644 --- a/include/display.h +++ b/include/display.h @@ -7,16 +7,18 @@ #include "ntp_time.h" #define DISPLAY_ADDRESS 0x70 -#define BRIGHTNESS 0 +#define BRIGHTNESS_NIGHT 0 +#define BRIGHTNESS_DAY 11 #define BRIGHTNESS_STEP 1 -#define DISPLAY_TIME 5000 +#define DISPLAY_TIME 2000 +#define DISPLAY_TEMP_TIME 5000 namespace Display { void displayColon(); Task tDisplay(500, TASK_FOREVER, displayColon, &ts, true); - uint8_t brightness = BRIGHTNESS; + uint8_t brightness = BRIGHTNESS_NIGHT; int currentHour = -1; int currentMin = -1; @@ -49,9 +51,9 @@ namespace Display { void adjustBrightness() { if (currentHour > 8 && currentHour < 17) { - brightness = 11; + brightness = BRIGHTNESS_DAY; } else { - brightness = BRIGHTNESS; + brightness = BRIGHTNESS_NIGHT; } clockDisplay.setBrightness(brightness); } @@ -60,7 +62,6 @@ namespace Display { if (colonOn) { if (currentHour != hour()) { currentHour = hour(); - Display::adjustBrightness(); if (currentHour == 8) Wifi::reconnect(); } if (currentMin != minute()) { @@ -86,7 +87,7 @@ namespace Display { clockDisplay.printFloat(value, 1); clockDisplay.writeDisplay(); drawTime(); - tDisplay.enableDelayed(DISPLAY_TIME); + tDisplay.enableDelayed(DISPLAY_TEMP_TIME); } void displayValue(uint8_t value) {