From 617822b493005417f23073f5a0efa48167aac2d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Tue, 3 Jan 2023 15:00:23 +0100 Subject: [PATCH] config blink FIX --- src/config.cpp | 9 ++++++--- src/display/Color.cpp | 4 ++++ src/display/Color.h | 4 ++++ src/main.cpp | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index d6eabe3..fb388a4 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -30,18 +30,21 @@ void config_set_dirty() { } void config_loop() { - if (notify && millis() - lastDirtyMillis <= WRITE_DELAY_MS + 1000) { + if (notify && millis() - lastDirtyMillis > WRITE_DELAY_MS + 2000) { notify = false; - display.set(0, 0, RED); + } + if (notify) { + bool blink = ((millis() - lastDirtyMillis) / 100) % 2 == 0; + display.set(0, 0, blink ? MAGENTA : BLACK); } if (!dirty) { return; } - if (millis() - lastDirtyMillis <= 30000) { return; } + dirty = false; notify = true; diff --git a/src/display/Color.cpp b/src/display/Color.cpp index d949c29..9ccf021 100644 --- a/src/display/Color.cpp +++ b/src/display/Color.cpp @@ -12,6 +12,10 @@ const Color BLUE = {____, ____, FULL}; const Color YELLOW = {FULL, FULL, ____}; +const Color MAGENTA = {FULL, ____, FULL}; + +const Color TURQUOISE = {____, FULL, FULL}; + Color gray(uint8_t brightness) { return {brightness, brightness, brightness}; } diff --git a/src/display/Color.h b/src/display/Color.h index c0852a9..2faeafc 100644 --- a/src/display/Color.h +++ b/src/display/Color.h @@ -25,4 +25,8 @@ extern const Color BLUE; extern const Color YELLOW; +extern const Color MAGENTA; + +extern const Color TURQUOISE; + #endif diff --git a/src/main.cpp b/src/main.cpp index c8c4525..2d03460 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,9 +22,9 @@ void setup() { void loop() { serial_loop(); - config_loop(); wifi_loop(); server_loop(); mode_loop(); + config_loop(); display.loop(); }