diff --git a/components/cmd_system/cmd_system.c b/components/cmd_system/cmd_system.c index 12337782..b73e845a 100644 --- a/components/cmd_system/cmd_system.c +++ b/components/cmd_system/cmd_system.c @@ -6,7 +6,7 @@ software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -//#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE +#define LOG_LOCAL_LEVEL ESP_LOG_INFO #include #include #include @@ -128,6 +128,7 @@ esp_err_t guided_boot(esp_partition_subtype_t partition_subtype) } else { + ESP_LOGD(TAG, "Found partition. Getting info."); partition = (esp_partition_t *) esp_partition_get(it); ESP_LOGD(TAG, "Releasing partition iterator"); esp_partition_iterator_release(it); diff --git a/components/squeezelite-ota/cmd_ota.c b/components/squeezelite-ota/cmd_ota.c index bd517d34..9b20c6b3 100644 --- a/components/squeezelite-ota/cmd_ota.c +++ b/components/squeezelite-ota/cmd_ota.c @@ -27,7 +27,7 @@ #include "sdkconfig.h" static const char * TAG = "platform_esp32"; -extern esp_err_t start_ota(const char * bin_url, bool bFromAppMain); +extern esp_err_t start_ota(const char * bin_url); static struct { struct arg_str *url; struct arg_end *end; @@ -45,7 +45,7 @@ static int perform_ota_update(int argc, char **argv) esp_err_t err=ESP_OK; ESP_LOGI(TAG, "Starting ota: %s", url); - start_ota(url,false); + start_ota(url); if (err != ESP_OK) { ESP_LOGE(TAG, "%s", esp_err_to_name(err)); diff --git a/components/squeezelite-ota/squeezelite-ota.c b/components/squeezelite-ota/squeezelite-ota.c index 0c7b8dd0..c5208a57 100644 --- a/components/squeezelite-ota/squeezelite-ota.c +++ b/components/squeezelite-ota/squeezelite-ota.c @@ -640,7 +640,7 @@ esp_err_t process_recovery_ota(const char * bin_url){ return ESP_OK; } -esp_err_t start_ota(const char * bin_url, bool bFromAppMain) +esp_err_t start_ota(const char * bin_url) { // uint8_t * config_alloc_get_default(NVS_TYPE_BLOB, "certs", server_cert_pem_start , server_cert_pem_end-server_cert_pem_start); #if RECOVERY_APPLICATION diff --git a/components/squeezelite-ota/squeezelite-ota.h b/components/squeezelite-ota/squeezelite-ota.h index a5f4ef31..b2fd5667 100644 --- a/components/squeezelite-ota/squeezelite-ota.h +++ b/components/squeezelite-ota/squeezelite-ota.h @@ -21,7 +21,7 @@ #define OTA_FLASH_ERASE_BLOCK (uint32_t)512000 #define OTA_STACK_SIZE 5120 #define OTA_TASK_PRIOTITY 6 -esp_err_t start_ota(const char * bin_url, bool bFromAppMain); +esp_err_t start_ota(const char * bin_url); const char * ota_get_status(); uint8_t ota_get_pct_complete(); diff --git a/components/wifi-manager/http_server.c b/components/wifi-manager/http_server.c index 43755e14..2e96b0d1 100644 --- a/components/wifi-manager/http_server.c +++ b/components/wifi-manager/http_server.c @@ -533,26 +533,20 @@ void http_server_netconn_serve(struct netconn *conn) { ESP_LOGI(TAG, "http_server_netconn_serve: done serving DELETE /connect.json"); } else if(strstr(line, "POST /reboot_ota.json ")) { - ESP_LOGI(TAG, "http_server_netconn_serve: POST reboot.json"); + ESP_LOGI(TAG, "http_server_netconn_serve: POST reboot_ota.json"); netconn_write(conn, http_ok_json_no_cache_hdr, sizeof(http_ok_json_no_cache_hdr) - 1, NETCONN_NOCOPY); /* 200 ok */ - netconn_close(conn); - netconn_delete(conn); wifi_manager_reboot(OTA); - ESP_LOGI(TAG, "http_server_netconn_serve: done serving POST reboot.json"); + ESP_LOGI(TAG, "http_server_netconn_serve: done serving POST reboot_ota.json"); } else if(strstr(line, "POST /reboot.json ")) { ESP_LOGI(TAG, "http_server_netconn_serve: POST reboot.json"); netconn_write(conn, http_ok_json_no_cache_hdr, sizeof(http_ok_json_no_cache_hdr) - 1, NETCONN_NOCOPY); /* 200 ok */ - netconn_close(conn); - netconn_delete(conn); wifi_manager_reboot(RESTART); ESP_LOGI(TAG, "http_server_netconn_serve: done serving POST reboot.json"); } else if(strstr(line, "POST /recovery.json ")) { ESP_LOGI(TAG, "http_server_netconn_serve: POST recovery.json"); netconn_write(conn, http_ok_json_no_cache_hdr, sizeof(http_ok_json_no_cache_hdr) - 1, NETCONN_NOCOPY); /* 200 ok */ - netconn_close(conn); - netconn_delete(conn); wifi_manager_reboot(RECOVERY); ESP_LOGI(TAG, "http_server_netconn_serve: done serving POST recovery.json"); } diff --git a/components/wifi-manager/wifi_manager.c b/components/wifi-manager/wifi_manager.c index f2d1a345..92648c0c 100644 --- a/components/wifi-manager/wifi_manager.c +++ b/components/wifi-manager/wifi_manager.c @@ -1464,17 +1464,21 @@ void wifi_manager( void * pvParameters ){ break; case ORDER_RESTART_OTA: + ESP_LOGD(TAG, "Calling guided_restart_ota."); guided_restart_ota(); break; case ORDER_RESTART_OTA_URL: - start_ota(msg.param,false); + ESP_LOGD(TAG, "Calling start_ota."); + start_ota(msg.param); free(msg.param); break; case ORDER_RESTART_RECOVERY: + ESP_LOGD(TAG, "Calling guided_factory."); guided_factory(); break; case ORDER_RESTART: + ESP_LOGD(TAG, "Calling simple_restart."); simple_restart(); break; default: diff --git a/main/esp_app_main.c b/main/esp_app_main.c index d66c014b..dcf144fe 100644 --- a/main/esp_app_main.c +++ b/main/esp_app_main.c @@ -316,7 +316,7 @@ void app_main() taskYIELD(); } ESP_LOGI(TAG,"Updating firmware from link: %s",fwurl); - start_ota(fwurl, true); + start_ota(fwurl); #else ESP_LOGE(TAG,"Restarted to application partition. We're not going to perform OTA!"); #endif