https://github.com/lexus2k/esp_ota_upgrade
Improved ESP OTA Upgrade component
https://github.com/lexus2k/esp_ota_upgrade
esp32 esp32-idf esp32-ota ota ota-firmware-updates ota-server ota-update ota-updater
Last synced: about 1 month ago
JSON representation
Improved ESP OTA Upgrade component
- Host: GitHub
- URL: https://github.com/lexus2k/esp_ota_upgrade
- Owner: lexus2k
- License: mit
- Created: 2021-10-21T05:38:38.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-23T08:37:18.000Z (about 3 years ago)
- Last Synced: 2025-02-28T19:38:27.789Z (about 2 months ago)
- Topics: esp32, esp32-idf, esp32-ota, ota, ota-firmware-updates, ota-server, ota-update, ota-updater
- Language: CSS
- Homepage:
- Size: 14.6 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ESP OTA enhanced upgrade
Improved ESP OTA Upgrade component
# How to use
## How to add FW upgrade function to your web-server on the IoT device

```.cpp
static void on_upgrade_start(void)
{
// Here you can do anything before upgrade process is started
}static void on_upgrade_end(bool success)
{
if ( success )
{
}
else
{
}
}static bool before_upgrade_check(httpd_req_t *req)
{
// Do, whatever you need to do to make sure that sender is allowed to upgrade IoT device
uint8_t authenticated = validate_session(req, "POST"); // This is an example function
if ( !authenticated)
{
// Do, whatever you want to do in case Upgrade is cancelled
redirect_to_login_page(req, false);
return false;
}
return true;
}...
// Registers /fwupdate URI
register_httpd_ota_handler(server, before_upgrade_check, on_upgrade_start, on_upgrade_end );
...```
## Initiate self-upgrade by the device itself
```.cpp
static void on_upgrade_start(void)
{
// Here you can do anything before upgrade process is started
}static void on_upgrade_end(bool success)
{
if ( success )
{
}
else
{
}
}bool on_validate_version(const char * new_ver)
{
// Validate here the version
return true;
}...
http_client_ota_upgrade( "https://path/to/version/file.txt", // Can be NULL if you don't have version file with the name
"https://path/to/new/firmware.bin",
on_validate_version,
on_upgrade_start,
on_upgrade_end );
...```