GPIO Based Factory Reset

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: GPIO Based Factory Reset

Postby Ritesh » Tue Jun 04, 2019 9:21 am

Ritu21 wrote:
Tue Jun 04, 2019 5:31 am
In 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
Yes. that will work.

Also for GPIO Configuration, You can use standard GPIO APIs to configure and use it as per your requirement.
Regards,
Ritesh Prajapati

Ritu21
Posts: 123
Joined: Sat Aug 04, 2018 9:58 am

Re: GPIO Based Factory Reset

Postby Ritu21 » Tue Jun 04, 2019 9:25 am

Thank you Ritesh.
I will try this and will let you know.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: GPIO Based Factory Reset

Postby Ritesh » Wed Jun 05, 2019 3:40 am

Ritu21 wrote:
Tue Jun 04, 2019 9:25 am
Thank you Ritesh.
I will try this and will let you know.
Most Welcome. Let me know if need any further help regarding that.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: Google [Bot] and 151 guests