diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 717b0857..f4efdc1e 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -318,10 +318,11 @@ PROGMEM const char* const custom_reset_string[] = { #define LED_MODE_FOLLOW 2 // LED will follow state of linked relay (check RELAY#_LED) #define LED_MODE_FOLLOW_INVERSE 3 // LED will follow the opposite state of linked relay (check RELAY#_LED) #define LED_MODE_FINDME 4 // LED will be ON if all relays are OFF -#define LED_MODE_MIXED 5 // A mixed between WIFI and FINDME +#define LED_MODE_FINDME_WIFI 5 // A mixture between WIFI and FINDME #define LED_MODE_ON 6 // LED always ON #define LED_MODE_OFF 7 // LED always OFF -#define LED_MODE_STATUS 8 // If any relay is ON, LED will be ON, otherwise OFF +#define LED_MODE_RELAY 8 // If any relay is ON, LED will be ON, otherwise OFF +#define LED_MODE_RELAY_WIFI 9 // A mixture between WIFI and RELAY, the reverse of MIXED // ----------------------------------------------------------------------------- // WIFI diff --git a/code/espurna/data/index.html.gz b/code/espurna/data/index.html.gz index 5435ee7b..64f3b982 100644 Binary files a/code/espurna/data/index.html.gz and b/code/espurna/data/index.html.gz differ diff --git a/code/espurna/led.ino b/code/espurna/led.ino index 983f112e..abcbce0e 100644 --- a/code/espurna/led.ino +++ b/code/espurna/led.ino @@ -191,7 +191,7 @@ void ledLoop() { } - if (_ledMode(i) == LED_MODE_MIXED) { + if (_ledMode(i) == LED_MODE_FINDME_WIFI) { if (wifiConnected()) { if (relayStatus(_leds[i].relay-1)) { @@ -213,6 +213,28 @@ void ledLoop() { } + if (_ledMode(i) == LED_MODE_RELAY_WIFI) { + + if (wifiConnected()) { + if (relayStatus(_leds[i].relay-1)) { + if (WiFi.getMode() == WIFI_AP) { + _ledBlink(i, 100, 900); + } else { + _ledBlink(i, 100, 4900); + } + } else { + if (WiFi.getMode() == WIFI_AP) { + _ledBlink(i, 900, 100); + } else { + _ledBlink(i, 4900, 100); + } + } + } else { + _ledBlink(i, 500, 500); + } + + } + // Relay-based modes, update only if relays have been updated if (!_led_update) continue; @@ -235,7 +257,7 @@ void ledLoop() { _ledStatus(i, status); } - if (_ledMode(i) == LED_MODE_STATUS) { + if (_ledMode(i) == LED_MODE_RELAY) { bool status = false; for (unsigned char k=0; kLED mode @@ -298,10 +299,11 @@
This setting defines the behaviour of the main LED in the board.
When in "WiFi status" it will blink at 1Hz when trying to connect. If successfully connected it will briefly blink every 5 seconds if in STA mode or every second if in AP mode.
+ When in "Relay status" mode the LED will be ON whenever any relay is ON, and OFF otherwise. This is global status notification.
When in "MQTT managed" mode you will be able to set the LED state sending a message to "<base_topic>/led/0/set" with a payload of 0, 1 or 2 (to toggle it).
When in "Find me" mode the LED will be ON when all relays are OFF. This is meant to locate switches at night.
- When in "Status" mode the LED will be ON whenever any relay is ON, and OFF otherwise. This is global status notification.
- When in "Mixed" mode it will follow the WiFi status but will stay mostly on when relays are OFF, and mostly OFF when any of them is ON.
+ When in "Relay & WiFi" mode it will follow the WiFi status but will stay mostly off when relays are OFF, and mostly ON when any of them is ON.
+ When in "Find me & WiFi" mode is the opposite of the "Relay & WiFi", it will follow the WiFi status but will stay mostly on when relays are OFF, and mostly OFF when any of them is ON.
"Always ON" and "Always OFF" modes are self-explanatory.