From 6af6a6ac76f21e9d044ffeb923865a8375640b62 Mon Sep 17 00:00:00 2001 From: Ollo Date: Sun, 12 Dec 2021 16:47:40 +0100 Subject: [PATCH] Use red led to visualize button presses --- src/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 63bcc1d..4075751 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -209,6 +209,7 @@ void onHomieEvent(const HomieEvent &event) digitalWrite(WITTY_RGB_R, LOW); if (!i2cEnable.get()) { /** keep green LED activated to power I2C sensor */ digitalWrite(WITTY_RGB_G, LOW); + log(MQTT_LEVEL_INFO, F("I2C powersupply deactivated"), MQTT_LOG_I2CINIT); } digitalWrite(WITTY_RGB_B, LOW); strip.fill(strip.Color(0,0,128)); @@ -227,6 +228,9 @@ void onHomieEvent(const HomieEvent &event) case HomieEventType::OTA_SUCCESSFUL: ESP.restart(); break; + case HomieEventType::WIFI_CONNECTED: + digitalWrite(WITTY_RGB_B, HIGH); + break; default: break; } @@ -440,7 +444,6 @@ void setup() strip.setPixelColor(0, strip.Color(0,0,128)); } strip.show(); - digitalWrite(WITTY_RGB_B, HIGH); } else { digitalWrite(WITTY_RGB_R, HIGH); strip.fill(strip.Color(128,0,0)); @@ -470,6 +473,7 @@ void loop() } } else { mButtonPressed=0U; + digitalWrite(WITTY_RGB_R, LOW); } if (mButtonPressed > BUTTON_MAX_CYCLE) {