Firmware OTA updates in C for IoT devices
#include <WiFi.h>
#include <iot_ota.h>
#define FIRMWARE_ID "<firmware id>"
void setup () {
Serial.begin(115200);
WiFi.begin("<wifi ssid>", "<wifi pass>");
while (WiFi.status() != WL_CONNECTED) {
Serial.println("Connecting");
delay(500);
}
ota_updates(FIRMWARE_ID);
}
void loop () {
Serial.println("Hello World!");
delay(1000);
}
See include/iot_ota.h
for the public API.
ota_set_server(url)
Set a custom server, in case you self-host your own.
By default, it uses https://ota.leet.ar with no guarantees for now.
ota_updates(firmware_id)
Run updates on background. It also generates and saves a random device ID.
When you pass a firmware id, it always gets saved in the NVS.
Later you can pass NULL, and it will reuse the one already saved.
MIT