mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 20:17:04 +03:00
use built-in Muse keys - release
This commit is contained in:
@@ -157,7 +157,7 @@ esp_err_t actrls_init(const char *profile_name) {
|
|||||||
|
|
||||||
// set infrared GPIO if any
|
// set infrared GPIO if any
|
||||||
parse_set_GPIO(set_ir_gpio);
|
parse_set_GPIO(set_ir_gpio);
|
||||||
|
|
||||||
if (!err) return actrls_init_json(profile_name, true);
|
if (!err) return actrls_init_json(profile_name, true);
|
||||||
else return err;
|
else return err;
|
||||||
}
|
}
|
||||||
@@ -508,11 +508,13 @@ static esp_err_t actrls_init_json(const char *profile_name, bool create) {
|
|||||||
char *config;
|
char *config;
|
||||||
const cJSON *button;
|
const cJSON *button;
|
||||||
|
|
||||||
if (!profile_name || !*profile_name) return ESP_OK;
|
if (!profile_name) return ESP_OK;
|
||||||
|
|
||||||
config = config_alloc_get_default(NVS_TYPE_STR, profile_name, NULL, 0);
|
config = config_alloc_get_str(profile_name, NULL, CONFIG_AUDIO_CONTROLS);
|
||||||
if(!config) return ESP_FAIL;
|
|
||||||
|
if (!config) return ESP_FAIL;
|
||||||
|
else if (!*config) return ESP_OK;
|
||||||
|
|
||||||
ESP_LOGD(TAG,"Parsing JSON structure %s", config);
|
ESP_LOGD(TAG,"Parsing JSON structure %s", config);
|
||||||
cJSON *buttons = cJSON_Parse(config);
|
cJSON *buttons = cJSON_Parse(config);
|
||||||
if (buttons == NULL) {
|
if (buttons == NULL) {
|
||||||
@@ -526,6 +528,7 @@ static esp_err_t actrls_init_json(const char *profile_name, bool create) {
|
|||||||
if(!cur_config) {
|
if(!cur_config) {
|
||||||
ESP_LOGE(TAG,"Config buffer was empty. ");
|
ESP_LOGE(TAG,"Config buffer was empty. ");
|
||||||
cJSON_Delete(buttons);
|
cJSON_Delete(buttons);
|
||||||
|
free(config);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
ESP_LOGD(TAG,"Processing button definitions. ");
|
ESP_LOGD(TAG,"Processing button definitions. ");
|
||||||
@@ -557,6 +560,7 @@ static esp_err_t actrls_init_json(const char *profile_name, bool create) {
|
|||||||
// the last init that completes will assigh the first json config object found, which will match
|
// the last init that completes will assigh the first json config object found, which will match
|
||||||
// the default config from nvs.
|
// the default config from nvs.
|
||||||
json_config = config_root;
|
json_config = config_root;
|
||||||
|
free(config);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ void app_main()
|
|||||||
|
|
||||||
if(!is_recovery_running){
|
if(!is_recovery_running){
|
||||||
ESP_LOGD(TAG,"Getting audio control mapping ");
|
ESP_LOGD(TAG,"Getting audio control mapping ");
|
||||||
char *actrls_config = config_alloc_get_default(NVS_TYPE_STR, "actrls_config", CONFIG_AUDIO_CONTROLS, 0);
|
char *actrls_config = config_alloc_get_default(NVS_TYPE_STR, "actrls_config", "", 0);
|
||||||
if (actrls_init(actrls_config) == ESP_OK) {
|
if (actrls_init(actrls_config) == ESP_OK) {
|
||||||
ESP_LOGD(TAG,"Initializing audio control buttons type %s", actrls_config);
|
ESP_LOGD(TAG,"Initializing audio control buttons type %s", actrls_config);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user