Yes. that will work.Ritu21 wrote: ↑Tue Jun 04, 2019 5:31 amIn your code, you are first checking the present partition and accordingly changing the other partition, But I want to change to factory app, be it any partition. So, my code would be something like below:
esp_partition_t partition;
memset(&partition, 0, sizeof(esp_partition_t));
const esp_partition_t *partition1 = esp_ota_get_boot_partition();
if (partition1 == NULL) {
return FIRMWARE_UPDATE_FAIL;
}
if ((partition1->subtype == ESP_PARTITION_SUBTYPE_APP_OTA_0) || (partition1->subtype == ESP_PARTITION_SUBTYPE_APP_OTA_1)){
partition.type = ESP_PARTITION_TYPE_APP;
partition.subtype = ESP_PARTITION_SUBTYPE_APP_FACTORY;
partition.address = OTA_PARTITION_0_ADDR; /*why are you using ota_0 partition address*/
partition.size = OTA_PARTITION_SIZE; /*wht are you using ota partition size*/
strcpy(partition.label, "FACTORY_APP");
partition.encrypted = FAIL;
dest = OTA_PARTITION_0_ADDR;
}
else printf("Already running factory app\n");
Please check the above code and confirm.
Also, please let me know the GPIO configuration for this.I will be using pin 33/GPIO21.
Thanks
Ritu
Also for GPIO Configuration, You can use standard GPIO APIs to configure and use it as per your requirement.