From 839f31d48578dc5b5fea310b628902d111f9658c Mon Sep 17 00:00:00 2001 From: Philippe G Date: Wed, 26 Jan 2022 15:09:25 -0800 Subject: [PATCH] fix target config priority between NVS and dedicated builds --- components/targets/targets.c | 2 +- main/esp_app_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/targets/targets.c b/components/targets/targets.c index 89574e4d..9f54d364 100644 --- a/components/targets/targets.c +++ b/components/targets/targets.c @@ -4,7 +4,7 @@ const struct target_s *target_set[] = { &target_muse, NULL }; void target_init(char *target) { - for (int i = 0; target_set[i]; i++) if (strcasestr(target_set[i]->model, target)) { + for (int i = 0; *target && target_set[i]; i++) if (strcasestr(target_set[i]->model, target)) { target_set[i]->init(); break; } diff --git a/main/esp_app_main.c b/main/esp_app_main.c index 76856ee1..04579215 100644 --- a/main/esp_app_main.c +++ b/main/esp_app_main.c @@ -449,7 +449,7 @@ void app_main() ESP_LOGI(TAG,"Initializing display"); display_init("SqueezeESP32"); MEMTRACE_PRINT_DELTA(); - char *target = config_alloc_get_default(NVS_TYPE_STR, "target", CONFIG_TARGET, 0); + char *target = config_alloc_get_str("target", CONFIG_TARGET, NULL); if (target) { target_init(target); free(target);