浏览代码

Bug fix: rebooting to squeezelite now works

Sebastien 5 年之前
父节点
当前提交
aa81f39712
共有 3 个文件被更改,包括 8 次插入1 次删除
  1. 6 0
      components/cmd_system/cmd_system.c
  2. 1 0
      components/cmd_system/cmd_system.h
  3. 1 1
      components/wifi-manager/http_server.c

+ 6 - 0
components/cmd_system/cmd_system.c

@@ -142,6 +142,12 @@ static int restart(int argc, char **argv)
     guided_boot(ESP_PARTITION_SUBTYPE_APP_FACTORY);
 	return 0; // return fail.  This should never return... we're rebooting!
 }
+esp_err_t guided_restart_ota(){
+    guided_boot(ESP_PARTITION_SUBTYPE_APP_OTA_0);
+    // If we're still alive, then there may not be an ota partition to boot from
+    guided_boot(ESP_PARTITION_SUBTYPE_APP_FACTORY);
+	return ESP_FAIL; // return fail.  This should never return... we're rebooting!
+}
 esp_err_t guided_factory(){
 	guided_boot(ESP_PARTITION_SUBTYPE_APP_FACTORY);
 	return ESP_FAIL; // return fail.  This should never return... we're rebooting!

+ 1 - 0
components/cmd_system/cmd_system.h

@@ -15,6 +15,7 @@ extern "C" {
 // Register system functions
 void register_system();
 esp_err_t guided_factory();
+esp_err_t guided_restart_ota();
 
 #ifdef __cplusplus
 }

+ 1 - 1
components/wifi-manager/http_server.c

@@ -480,7 +480,7 @@ 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); /* 200 ok */
 				}
 				else if(strstr(line, "POST /reboot.json ")){
-					esp_restart();
+					guided_restart_ota();
 				}
 				else if(strstr(line, "POST /recovery.json ")){
 					guided_factory();