Lehnte die Recovery ein Image ab, weil es bereits die laufende Version traegt, meldete die Firmware das als last_ota_error=trailer. Wer eine Lampe im Feld ausliest, haette dort einen Trailer-Fehler gesehen, wo in Wahrheit nichts passiert ist - und die Meldung in der Konsole lautete "update failed". Das bewusste Ueberspringen hat jetzt einen eigenen Zustand (nl_ota_skipped()), setzt keinen Fehlerwert und wird als "image already up to date" protokolliert. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
23 lines
1002 B
C
23 lines
1002 B
C
#ifndef NL_OTA_H
|
|
#define NL_OTA_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
void nl_ota_init(void);
|
|
/* Starts a download task for an http:// URL. 0 = started, -1 = busy or invalid. */
|
|
int nl_ota_start(const char *url);
|
|
/* Same, but for the boot recovery path (spec 8.3): an image whose trailer carries the running
|
|
* firmware version is rejected instead of flashed. The rescue station stays up while a whole
|
|
* batch of lamps migrates, so without this check every boot would re-flash the same image
|
|
* forever. A deliberate re-flash of the same version stays possible over the REST API. */
|
|
int nl_ota_start_recovery(const char *url);
|
|
bool nl_ota_busy(void);
|
|
/* True when the last recovery attempt deliberately skipped an image whose version already
|
|
matches the running firmware - that is not a failure and sets no last_ota_error. */
|
|
bool nl_ota_skipped(void);
|
|
/* NULL, or one of: download, crc, trailer, device_mismatch, hash, busy */
|
|
const char *nl_ota_last_error(void);
|
|
void nl_ota_set_error(const char *e);
|
|
|
|
#endif
|