fix some buttons snafu & power off led on suspend

This commit is contained in:
philippe44
2023-09-16 19:42:31 -07:00
parent bb185d76dc
commit 66b88d186a
4 changed files with 19 additions and 5 deletions

View File

@@ -24,6 +24,7 @@
#include "led.h"
#include "globdefs.h"
#include "accessors.h"
#include "services.h"
#define MAX_LED 8
#define BLOCKTIME 10 // up to portMAX_DELAY
@@ -276,6 +277,14 @@ bool led_config(int idx, gpio_num_t gpio, int color, int bright, led_type_t type
return true;
}
/****************************************************************************************
*
*/
static void led_suspend(void) {
led_off(LED_GREEN);
led_off(LED_RED);
}
/****************************************************************************************
*
*/
@@ -326,6 +335,9 @@ void led_svc_init(void) {
led_config(LED_GREEN, green.gpio, green.color, green.bright, green.type);
led_config(LED_RED, red.gpio, red.color, red.bright, red.type);
// make sure we switch off all leds (useful for gpio expanders)
services_sleep_setsuspend(led_suspend);
ESP_LOGI(TAG,"Configuring LEDs green:%d (on:%d rmt:%d %d%% ), red:%d (on:%d rmt:%d %d%% )",
green.gpio, green.color, green.type, green.bright,