mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-13 23:17:03 +03:00
Improve UI status handling during OTA
This commit is contained in:
@@ -59,7 +59,7 @@ void process_autoexec(){
|
||||
|
||||
if(str_flag !=NULL ){
|
||||
autoexec_flag=atoi(str_flag);
|
||||
ESP_LOGI(TAG,"autoexec flag value found with value %u", autoexec_flag);
|
||||
ESP_LOGI(TAG,"autoexec flag value found with value %u, from string value: %s", autoexec_flag, str_flag);
|
||||
if(autoexec_flag == 1) {
|
||||
do {
|
||||
snprintf(autoexec_name,sizeof(autoexec_name)-1,"autoexec%u",i++);
|
||||
|
||||
@@ -99,6 +99,29 @@ esp_err_t store_nvs_value_len(nvs_type_t type, const char *key, void * data,
|
||||
nvs_close(nvs);
|
||||
return err;
|
||||
}
|
||||
|
||||
void * get_nvs_value_alloc_default(nvs_type_t type, const char *key, void * default_value, size_t blob_size) {
|
||||
|
||||
void * current_value = get_nvs_value_alloc(type, key);
|
||||
if(current_value == NULL && default_value != NULL){
|
||||
if(type == NVS_TYPE_BLOB && blob_size == 0){
|
||||
ESP_LOGE(TAG,"Unable to store default value for BLOB object' blob size was not specified");
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
esp_err_t err = store_nvs_value_len(type, key, default_value, blob_size);
|
||||
if(err!=ESP_OK){
|
||||
ESP_LOGE(TAG,"Unable to store default nvs value. Error: %s",esp_err_to_name(err));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(current_value == NULL){
|
||||
current_value = get_nvs_value_alloc(type, key);
|
||||
}
|
||||
return current_value;
|
||||
}
|
||||
|
||||
void * get_nvs_value_alloc(nvs_type_t type, const char *key) {
|
||||
nvs_handle nvs;
|
||||
esp_err_t err;
|
||||
|
||||
@@ -10,6 +10,7 @@ esp_err_t store_nvs_value(nvs_type_t type, const char *key, void * data);
|
||||
esp_err_t get_nvs_value(nvs_type_t type, const char *key, void*value, const uint8_t buf_size);
|
||||
void * get_nvs_value_alloc(nvs_type_t type, const char *key);
|
||||
esp_err_t erase_nvs(const char *key);
|
||||
void * get_nvs_value_alloc_default(nvs_type_t type, const char *key, void * default_value, size_t blob_size);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user