diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 263f5f713..314097235 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -1901,6 +1901,7 @@ void CmndSetLedPwmOff(void) } else { Settings.ledpwm_off = XdrvMailbox.payload; } + UpdateLedPowerAll(); } ResponseCmndNumber(Settings.ledpwm_off); } @@ -1915,6 +1916,7 @@ void CmndSetLedPwmOn(void) } else { Settings.ledpwm_on = XdrvMailbox.payload; } + UpdateLedPowerAll(); } ResponseCmndNumber(Settings.ledpwm_on); } diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index ba4b0fb1d..5a28b76d6 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -336,6 +336,13 @@ void SetPowerOnState(void) blink_powersave = power; } +void UpdateLedPowerAll() +{ + for (uint32_t i = 0; i < leds_present; i++) { + SetLedPowerIdx(i, bitRead(led_power, i)); + } +} + void SetLedPowerIdx(uint32_t led, uint32_t state) { if (!PinUsed(GPIO_LEDLNK) && (0 == led)) { // Legacy - LED1 is link led only if LED2 is present @@ -400,10 +407,8 @@ void SetLedLink(uint32_t state) uint32_t led_pin = Pin(GPIO_LEDLNK); uint32_t led_inv = ledlnk_inverted; if (99 == led_pin) { // Legacy - LED1 is status - led_pin = Pin(GPIO_LED1); - led_inv = bitRead(led_inverted, 0); - } - if (led_pin < 99) { + SetLedPowerIdx(0, state); + } else if (led_pin < 99) { if (state) { state = 1; } digitalWrite(led_pin, (led_inv) ? !state : state); } diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index ecf1127ec..92e3169b2 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -1,4 +1,4 @@ -/* + /* tasmota.ino - Tasmota firmware for iTead Sonoff, Wemos and NodeMCU hardware Copyright (C) 2020 Theo Arends