different display times for temperature and others

This commit is contained in:
Nicu Hodos 2021-12-30 20:29:33 +01:00
parent f26a0f7a7d
commit 185c2a743c

View File

@ -7,16 +7,18 @@
#include "ntp_time.h" #include "ntp_time.h"
#define DISPLAY_ADDRESS 0x70 #define DISPLAY_ADDRESS 0x70
#define BRIGHTNESS 0 #define BRIGHTNESS_NIGHT 0
#define BRIGHTNESS_DAY 11
#define BRIGHTNESS_STEP 1 #define BRIGHTNESS_STEP 1
#define DISPLAY_TIME 5000 #define DISPLAY_TIME 2000
#define DISPLAY_TEMP_TIME 5000
namespace Display { namespace Display {
void displayColon(); void displayColon();
Task tDisplay(500, TASK_FOREVER, displayColon, &ts, true); Task tDisplay(500, TASK_FOREVER, displayColon, &ts, true);
uint8_t brightness = BRIGHTNESS; uint8_t brightness = BRIGHTNESS_NIGHT;
int currentHour = -1; int currentHour = -1;
int currentMin = -1; int currentMin = -1;
@ -49,9 +51,9 @@ namespace Display {
void adjustBrightness() { void adjustBrightness() {
if (currentHour > 8 && currentHour < 17) { if (currentHour > 8 && currentHour < 17) {
brightness = 11; brightness = BRIGHTNESS_DAY;
} else { } else {
brightness = BRIGHTNESS; brightness = BRIGHTNESS_NIGHT;
} }
clockDisplay.setBrightness(brightness); clockDisplay.setBrightness(brightness);
} }
@ -60,7 +62,6 @@ namespace Display {
if (colonOn) { if (colonOn) {
if (currentHour != hour()) { if (currentHour != hour()) {
currentHour = hour(); currentHour = hour();
Display::adjustBrightness();
if (currentHour == 8) Wifi::reconnect(); if (currentHour == 8) Wifi::reconnect();
} }
if (currentMin != minute()) { if (currentMin != minute()) {
@ -86,7 +87,7 @@ namespace Display {
clockDisplay.printFloat(value, 1); clockDisplay.printFloat(value, 1);
clockDisplay.writeDisplay(); clockDisplay.writeDisplay();
drawTime(); drawTime();
tDisplay.enableDelayed(DISPLAY_TIME); tDisplay.enableDelayed(DISPLAY_TEMP_TIME);
} }
void displayValue(uint8_t value) { void displayValue(uint8_t value) {