Skip to content

Commit 2af276b

Browse files
authored
doc: add ota reset at the beginning of the app
1 parent 41b1dab commit 2af276b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,19 @@ Change offset for other apps:
5050
## Updating apps to fallback to bootloader
5151

5252
The bootloader is using OTA mechanism. It's necessary to add following code to the application
53-
in order to reboot to bootloader:
53+
in order to reboot to bootloader.
54+
55+
Put the following code to main, before starting the rest of the application:
56+
```
57+
#include "esp_ota_ops.h"
58+
59+
const esp_partition_t* factory_partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, NULL);
60+
if (factory_partition != NULL) {
61+
esp_ota_set_boot_partition(factory_partition);
62+
}
63+
```
64+
65+
Here's more elaborate version which can be put somwhere into application, like reaction on back button:
5466

5567
```
5668
// Get the partition structure for the factory partition

0 commit comments

Comments
 (0)