ESP32 OTA回退

Kwingesp32
Posts: 6
Joined: Fri Nov 30, 2018 3:11 pm

ESP32 OTA回退

Postby Kwingesp32 » Wed Dec 12, 2018 10:17 am

想知道ESP32通过OTA升级后,镜像写入到OTA0和1分区,怎么让ESP32从factory分区启动来达到恢复出厂设置的目的。希望有大佬帮解决下,谢谢。

ESP_@In逍遥子
Posts: 132
Joined: Thu Nov 15, 2018 2:06 am

Re: ESP32 OTA回退

Postby ESP_@In逍遥子 » Mon Dec 17, 2018 1:38 pm

  1.     esp_err_t ret = ESP_OK;
  2.     const esp_partition_t *partition = NULL;
  3.  
  4.     partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP,
  5.                                          ESP_PARTITION_SUBTYPE_APP_FACTORY, NULL);
  6.  
  7.     if (partition == NULL) {
  8.         partition = esp_ota_get_next_update_partition(NULL);
  9.     }
  10.  
  11.     ret = esp_ota_set_boot_partition(partition);
  12.     esp_restart();
你试一试,有问题,在回复讨论

Kwingesp32
Posts: 6
Joined: Fri Nov 30, 2018 3:11 pm

Re: ESP32 OTA回退

Postby Kwingesp32 » Thu Dec 27, 2018 1:28 pm

感谢,我有时间试一下,刚看到

Who is online

Users browsing this forum: No registered users and 157 guests