diff --git a/.cproject b/.cproject index 5397f9f0..2fccfbb4 100644 --- a/.cproject +++ b/.cproject @@ -3,9 +3,9 @@ - + - + @@ -29,38 +29,37 @@ - + - + - + - + + - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - make - - -j6 - - all - - true - - true - - true - - - - - - make - - -j6 - - size-components - - true - - true - - true - - - - - - make - - -j6 - - make -j8 EXTRA_CFLAGS="-D RECOVERY_APPLICATION=1" - - true - - true - - true - - - - - - python - - ${IDF_PATH}/tools/windows/eclipse_make.py -j8 app PROJECT_NAME="recovery.custom" EXTRA_CFLAGS=" -DRECOVERY_APPLICATION=1" - - recovery -======= - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - make - - -j8 - - all - - true - - false - - true - - - - - - make - - -j2 - - size-components - - true - - true - - true - - - - - - make - - -j2 - - flash - - true - - true - - true - - - - - - make - - -j8 PROJECT_NAME="recovery.custom" EXTRA_CFLAGS=" -DRECOVERY_APPLICATION=1" - - app ->>>>>>> refs/remotes/origin/Over_The_Air_Update - - true - - false - - true - - - - python + make - ${IDF_PATH}/tools/windows/eclipse_make.py -j8 + app diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 460b38fd..3b4dfb24 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -1,7 +1,7 @@ - + @@ -9,9 +9,15 @@ - + - + + + + + + + diff --git a/components/cmd_nvs/cmd_nvs.c b/components/cmd_nvs/cmd_nvs.c index bebe9157..dcb5faf5 100644 --- a/components/cmd_nvs/cmd_nvs.c +++ b/components/cmd_nvs/cmd_nvs.c @@ -47,7 +47,7 @@ static const type_str_pair_t type_str_pair[] = { static const size_t TYPE_STR_PAIR_SIZE = sizeof(type_str_pair) / sizeof(type_str_pair[0]); static const char *ARG_TYPE_STR = "type can be: i8, u8, i16, u16 i32, u32 i64, u64, str, blob"; -char current_namespace[16] = "squeezelite-esp32"; +char current_namespace[] = "squeezelite-esp32"; static const char * TAG = "platform_esp32"; static struct { @@ -97,7 +97,17 @@ static nvs_type_t str_to_type(const char *type) return NVS_TYPE_ANY; } +static const char *type_to_str(nvs_type_t type) +{ + for (int i = 0; i < TYPE_STR_PAIR_SIZE; i++) { + const type_str_pair_t *p = &type_str_pair[i]; + if (p->type == type) { + return p->str; + } + } + return "Unknown"; +} static esp_err_t store_blob(nvs_handle nvs, const char *key, const char *str_values) { uint8_t value; diff --git a/components/wifi-manager/.gitignore b/components/wifi-manager/.gitignore new file mode 100644 index 00000000..e1a40b3c --- /dev/null +++ b/components/wifi-manager/.gitignore @@ -0,0 +1 @@ +/.code.js.swp diff --git a/components/wifi-manager/http_server.c b/components/wifi-manager/http_server.c index 4939e44c..e78d0147 100644 --- a/components/wifi-manager/http_server.c +++ b/components/wifi-manager/http_server.c @@ -44,6 +44,7 @@ static const char array_separator[]=","; /* @brief task handle for the http server */ static TaskHandle_t task_http_server = NULL; +extern char current_namespace[]; /** * @brief embedded binary data. @@ -318,7 +319,7 @@ void http_server_netconn_serve(struct netconn *conn) { int lenA=0; char * last_parm=save_ptr; char * next_parm=save_ptr; - char * last_parm_name[41]={0}; + char last_parm_name[41]={0}; uint8_t autoexec_flag=0; bool bErrorFound=false; @@ -355,7 +356,6 @@ void http_server_netconn_serve(struct netconn *conn) { netconn_write(conn, http_ok_json_no_cache_hdr, sizeof(http_ok_json_no_cache_hdr) - 1, NETCONN_NOCOPY); //200ok } - } else{ netconn_write(conn, http_503_hdr, sizeof(http_503_hdr) - 1, NETCONN_NOCOPY); diff --git a/components/wifi-manager/wifi_manager.c b/components/wifi-manager/wifi_manager.c index 5d6f5e08..abd1e726 100644 --- a/components/wifi-manager/wifi_manager.c +++ b/components/wifi-manager/wifi_manager.c @@ -54,7 +54,9 @@ Contains the freeRTOS task and all necessary support #include "lwip/err.h" #include "lwip/netdb.h" #include "lwip/ip4_addr.h" -#include "app_update/include/esp_ota_ops.h" +#include "esp_ota_ops.h" +#include "esp_app_format.h" + #ifndef SQUEEZELITE_ESP32_RELEASE_URL #define SQUEEZELITE_ESP32_RELEASE_URL "https://github.com/sle118/squeezelite-esp32/releases" @@ -98,7 +100,7 @@ struct wifi_settings_t wifi_settings = { }; const char wifi_manager_nvs_namespace[] = "espwifimgr"; -char current_namespace[16] = "squeezelite-esp32"; +extern char current_namespace[]; EventGroupHandle_t wifi_manager_event_group; @@ -259,7 +261,7 @@ esp_err_t wifi_manager_save_autoexec_config(char * value, char * name, int len){ esp_err = nvs_set_str(handle, name, value); if (esp_err != ESP_OK){ - ESP_LOGE(TAG,"Unable to save value %s=%s",name,val); + ESP_LOGE(TAG,"Unable to save value %s=%s",name,value); nvs_close(handle); return esp_err; } @@ -272,7 +274,7 @@ esp_err_t wifi_manager_save_autoexec_config(char * value, char * name, int len){ nvs_close(handle); - ESP_LOGD(TAG, "wifi_manager_wrote %s=%s with length %i", name, val, len); + ESP_LOGD(TAG, "wifi_manager_wrote %s=%s with length %i", name, value, len); return ESP_OK; @@ -405,15 +407,13 @@ void wifi_manager_clear_ip_info_json(){ void wifi_manager_generate_ip_info_json(update_reason_code_t update_reason_code){ wifi_config_t *config = wifi_manager_get_wifi_sta_config(); if(config){ - const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\""; #if RECOVERY_APPLICATION - "\"ota_dsc\":\"%s\", \"ota_pct\":%d"; + const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\", \"ota_dsc\":\"%s\", \"ota_pct\":%d}\n"; +#else + const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\"}\n"; #endif - "}\n"; memset(ip_info_json, 0x00, JSON_IP_INFO_SIZE); - - app_desc_t* app_desc=esp_ota_get_app_description(void); - + const esp_app_desc_t* desc = esp_ota_get_app_description(); /* to avoid declaring a new buffer we copy the data directly into the buffer at its correct address */ strcpy(ip_info_json, "{\"ssid\":"); json_print_string(config->sta.ssid, (unsigned char*)(ip_info_json+strlen(ip_info_json)) ); @@ -434,8 +434,8 @@ void wifi_manager_generate_ip_info_json(update_reason_code_t update_reason_code) netmask, gw, (int)update_reason_code, - app_desc->project_name, - app_desc->version + desc->project_name, + desc->version #if RECOVERY_APPLICATION @@ -450,7 +450,10 @@ void wifi_manager_generate_ip_info_json(update_reason_code_t update_reason_code) "0", "0", "0", - (int)update_reason_code + (int)update_reason_code, + desc->project_name, + desc->version + #if RECOVERY_APPLICATION ,"", 0