Browse Source

ACTRLS_SLEEP should be last (indexed array) and red led is not default for parsing

philippe44 1 year ago
parent
commit
28ecad4652

+ 2 - 2
components/services/audio_controls.c

@@ -58,11 +58,11 @@ static const actrls_config_map_t actrls_config_map[] =
 // BEWARE: the actions below need to stay aligned with the corresponding enum to properly support json parsing
 //   along with the actrls_t controls in LMS_controls, bt_sink and raop_sink
 #define EP(x) [x] = #x  /* ENUM PRINT */
-static const char * actrls_action_s[ ] = { EP(ACTRLS_SLEEP),EP(ACTRLS_POWER),EP(ACTRLS_VOLUP),EP(ACTRLS_VOLDOWN),EP(ACTRLS_TOGGLE),EP(ACTRLS_PLAY),
+static const char * actrls_action_s[ ] = { EP(ACTRLS_POWER),EP(ACTRLS_VOLUP),EP(ACTRLS_VOLDOWN),EP(ACTRLS_TOGGLE),EP(ACTRLS_PLAY),
 									EP(ACTRLS_PAUSE),EP(ACTRLS_STOP),EP(ACTRLS_REW),EP(ACTRLS_FWD),EP(ACTRLS_PREV),EP(ACTRLS_NEXT),
 									EP(BCTRLS_UP),EP(BCTRLS_DOWN),EP(BCTRLS_LEFT),EP(BCTRLS_RIGHT), 
 									EP(BCTRLS_PS0),EP(BCTRLS_PS1),EP(BCTRLS_PS2),EP(BCTRLS_PS3),EP(BCTRLS_PS4),EP(BCTRLS_PS5),EP(BCTRLS_PS6),EP(BCTRLS_PS7),EP(BCTRLS_PS8),EP(BCTRLS_PS9),
-									EP(KNOB_LEFT),EP(KNOB_RIGHT),EP(KNOB_PUSH),
+									EP(KNOB_LEFT),EP(KNOB_RIGHT),EP(KNOB_PUSH), EP(ACTRLS_SLEEP),
 									""} ;
 									
 static const char * TAG = "audio controls";

+ 2 - 2
components/services/audio_controls.h

@@ -11,12 +11,12 @@
 #include "buttons.h"
 
 // BEWARE: this is the index of the array of action below (change actrls_action_s as well!)
-typedef enum { 	ACTRLS_NONE = -1, ACTRLS_SLEEP, ACTRLS_POWER, ACTRLS_VOLUP, ACTRLS_VOLDOWN, ACTRLS_TOGGLE, ACTRLS_PLAY, 
+typedef enum { 	ACTRLS_NONE = -1, ACTRLS_POWER, ACTRLS_VOLUP, ACTRLS_VOLDOWN, ACTRLS_TOGGLE, ACTRLS_PLAY, 
 				ACTRLS_PAUSE, ACTRLS_STOP, ACTRLS_REW, ACTRLS_FWD, ACTRLS_PREV, ACTRLS_NEXT, 
 				BCTRLS_UP, BCTRLS_DOWN, BCTRLS_LEFT, BCTRLS_RIGHT, 
 				BCTRLS_PS0,BCTRLS_PS1,BCTRLS_PS2,BCTRLS_PS3,BCTRLS_PS4,BCTRLS_PS5,BCTRLS_PS6,BCTRLS_PS7,BCTRLS_PS8,BCTRLS_PS9,
 				KNOB_LEFT, KNOB_RIGHT, KNOB_PUSH,
-				ACTRLS_REMAP, ACTRLS_MAX 
+				ACTRLS_REMAP, ACTRLS_SLEEP, ACTRLS_MAX 
 		} actrls_action_e;
 
 typedef void (*actrls_handler)(bool pressed);

+ 2 - 1
components/services/led.c

@@ -283,7 +283,8 @@ void set_led_gpio(int gpio, char *value) {
     struct led_config_s *config;
 
 	if (strcasestr(value, "green")) config = &green;
-    else config = &red;
+    else if (strcasestr(value, "red"))config = &red;
+    else return;
 
     config->gpio = gpio;
     char *p = value;