Software factory reset
Posted: Wed Dec 14, 2022 11:26 am
Hello, I am writing factory reset functionality using the software.
and below is my code.
questions:
1-> Am I doing right?
2-> I am using OTA API for setting boot partition it is right?
3-> Do I need to write 0xFF to OTA data partition?
or any suggestions or comments from any member.
and below is my code.
Code: Select all
esp_partition_iterator_t pi = esp_partition_find(
ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, NULL);
if (pi != NULL)
{
const esp_partition_t *factory = esp_partition_get(pi);
esp_partition_iterator_release(pi);
esp_err_t err = esp_ota_set_boot_partition(factory);
if (err == ESP_OK)
esp_restart();
else
printf("Boot partition not set successful\n");
}
else
printf("Factory partition not found:\n");
1-> Am I doing right?
2-> I am using OTA API for setting boot partition it is right?
3-> Do I need to write 0xFF to OTA data partition?
or any suggestions or comments from any member.