diff --git a/components/platform_console/app_recovery/recovery.c b/components/platform_console/app_recovery/recovery.c index 1c3eb7fec..e91bc0163 100644 --- a/components/platform_console/app_recovery/recovery.c +++ b/components/platform_console/app_recovery/recovery.c @@ -30,7 +30,6 @@ const __attribute__((section(".rodata_desc"))) esp_app_desc_t esp_app_desc = { extern void register_ledvu_config(void); void register_optional_cmd(void) { - register_ledvu_config(); } int main(int argc, char **argv){ diff --git a/components/platform_console/app_squeezelite/cmd_squeezelite.c b/components/platform_console/app_squeezelite/cmd_squeezelite.c index 88000a8f6..654dbc6e5 100644 --- a/components/platform_console/app_squeezelite/cmd_squeezelite.c +++ b/components/platform_console/app_squeezelite/cmd_squeezelite.c @@ -46,7 +46,6 @@ extern void register_ledvu_config(void); void register_optional_cmd(void) { register_rotary_config(); - register_ledvu_config(); register_audio_config(); } diff --git a/components/platform_console/cmd_config.c b/components/platform_console/cmd_config.c index 578aa3cd0..a7143f224 100644 --- a/components/platform_console/cmd_config.c +++ b/components/platform_console/cmd_config.c @@ -690,6 +690,12 @@ static int do_cspot_config(int argc, char **argv){ static int do_ledvu_cmd(int argc, char **argv){ ledvu_struct_t ledvu={ .type = "WS2812", .gpio = -1, .length = 0, .clk = -1}; + + if(is_ledvu_config_locked()) { + cmd_send_messaging(argv[0],MESSAGING_ERROR,"LED Strip Configuration is locked on this platform\n"); + return 1; + } + esp_err_t err=ESP_OK; int nerrors = arg_parse(argc, argv,(void **)&ledvu_args); if (ledvu_args.clear->count) { @@ -1500,6 +1506,9 @@ void register_config_cmd(void){ if(!is_spdif_config_locked()){ register_spdif_config(); } + if (is_ledvu_config_locked()){ + register_ledvu_config(); + } register_optional_cmd(); } diff --git a/components/services/accessors.c b/components/services/accessors.c index 5901680e3..bba9a0e57 100644 --- a/components/services/accessors.c +++ b/components/services/accessors.c @@ -103,6 +103,19 @@ bool is_spdif_config_locked(){ return false; } +/**************************************************************************************** + * + */ +bool is_ledvu_config_locked(){ +#if ( defined CONFIG_LED_VU_CONFIG ) + if(strlen(CONFIG_LED_VU_CONFIG) > 0){ + return true; + } +#endif + return false; +} + + /**************************************************************************************** * Set pin from config string */ @@ -983,9 +996,9 @@ cJSON * get_ledvu_GPIO(cJSON * list){ cJSON * llist = list?list:cJSON_CreateArray(); const ledvu_struct_t *ledvu= config_ledvu_get(); - add_gpio_for_value(llist,"gpio",ledvu->gpio, "led_vu", false); + add_gpio_for_value(llist,"gpio",ledvu->gpio, "led_vu", is_ledvu_config_locked()); if (ledvu->clk >= 0) - add_gpio_for_value(llist,"clk",ledvu->clk, "led_vu", false); + add_gpio_for_value(llist,"clk",ledvu->clk, "led_vu", is_ledvu_config_locked()); return llist; } diff --git a/components/services/accessors.h b/components/services/accessors.h index 82827046b..34c44ae6a 100644 --- a/components/services/accessors.h +++ b/components/services/accessors.h @@ -124,4 +124,5 @@ bool are_statistics_enabled(); const rotary_struct_t * config_rotary_get(); esp_err_t config_rotary_set(rotary_struct_t * rotary); const ledvu_struct_t * config_ledvu_get(); -esp_err_t config_ledvu_set(ledvu_struct_t * ledvu); \ No newline at end of file +esp_err_t config_ledvu_set(ledvu_struct_t * ledvu); +bool is_ledvu_config_locked(); \ No newline at end of file