ESP32-OTA-Updater
|
Class for performing Over-The-Air (OTA) updates on ESP32 devices, with Github Actions and Releases. More...
#include <ESP32_OTA_Updater.h>
Public Member Functions | |
ESP32_OTA_Updater (const char *rootCertificate, const char *current_version) | |
Constructor for the ESP32_OTA_Updater class. | |
bool | begin (const char *owner, const char *repo, const char *firmware_path, const char *api_key) |
Initializes the ESP32 OTA Updater. | |
bool | begin (const char *owner, const char *repo, const char *firmware_path) |
Initializes the ESP32 OTA Updater. | |
bool | available () |
Checks if a firmware update is available. | |
bool | downloadAndInstall () |
Downloads and installs the firmware update. Use 'reboot()' for the esp to reboot and the update to take effect! | |
void | reboot () |
Initiates a reboot of the esp32, which effectively finished a previously installed update. | |
ESP32_OTA_Updater_Error | getErrorCode () |
Get the error code. | |
String | getErrorDescription () |
Returns the description of the last error that occurred. | |
void | setDebug (Print *debugStream) |
Sets the debug output stream for logging messages. | |
Class for performing Over-The-Air (OTA) updates on ESP32 devices, with Github Actions and Releases.
This class checks for new Github Releases compares the semantic version and downloads/installs the firmware update. For now the System automatically uses the LittleFS file system, but a custom fs:FS can be specified on begin().
ESP32_OTA_Updater::ESP32_OTA_Updater | ( | const char * | rootCertificate, |
const char * | current_version | ||
) |
Constructor for the ESP32_OTA_Updater class.
This constructor initializes the OTA updater with the specified root certificates for secure HTTPS communication.
rootCertificate | The root certificates for GitHub's HTTPS server and Githubs Download Server. |
current_version | The semantic version of the fimware currently installed, should be "v.0.0.0" or "0.0.0" |
bool ESP32_OTA_Updater::available | ( | ) |
Checks if a firmware update is available.
This function checks if a new firmware update is available by comparing the current version with the version specified in the firmware update file.
bool ESP32_OTA_Updater::begin | ( | const char * | owner, |
const char * | repo, | ||
const char * | firmware_path | ||
) |
Initializes the ESP32 OTA Updater.
owner | The owner of the repository where the firmware is build an released. |
repo | The name of the repository where the firmware is build an released. |
firmware_path | The path to the firmware binary file on the Github Release -> the asset name. |
bool ESP32_OTA_Updater::begin | ( | const char * | owner, |
const char * | repo, | ||
const char * | firmware_path, | ||
const char * | api_key | ||
) |
Initializes the ESP32 OTA Updater.
owner | The owner of the repository where the firmware is build an released. |
repo | The name of the repository where the firmware is build an released. |
firmware_path | The path to the firmware binary file on the Github Release -> the asset name. |
gh_api_key | The (Fine Grained) Github Personal Access Token. |
bool ESP32_OTA_Updater::downloadAndInstall | ( | ) |
Downloads and installs the firmware update. Use 'reboot()' for the esp to reboot and the update to take effect!
This function downloads the firmware update file from the specified URL and installs it on the ESP32 device.
available()
returns true). ESP32_OTA_Updater_Error ESP32_OTA_Updater::getErrorCode | ( | ) |
Get the error code.
This function returns the error code associated with the last operation performed by the ESP32 OTA Updater.
String ESP32_OTA_Updater::getErrorDescription | ( | ) |
Returns the description of the last error that occurred.
This function returns a string containing the description of the last error that occurred during the execution of the program.
void ESP32_OTA_Updater::setDebug | ( | Print * | debugStream | ) |
Sets the debug output stream for logging messages.
debugStream | A pointer to a Print object, e.g. Serial. Pass NULL to disable debug logging. |