/** * ota_update.h - pull firmware updates from this repo's Gitea releases. * * Manual only: nothing checks or installs by itself. The `ota` serial console * drives it today; the planned password-gated Diagnostics screen will call the * same functions (wiki/pages/open-questions.md #12). * * ota status running version, slot, rollback state * ota check ask Gitea for the latest release, compare versions * ota install [force] download, verify signature, flash idle slot, reboot * ota rollback boot the previous slot * * Safety: * - refused unless the vehicle is parked (engine off, output shaft still, lever * not in a drive gear) - checked before the download AND again before the * boot slot is switched. Silent bus (bench / ignition off) counts as parked. * - image must match the signed manifest (sha256 + ECDSA P-256 over * "target|version|sha256"); otherwise the idle slot is never activated. * - a new image must run OTA_CONFIRM_MS before it is marked valid; a reset * or crash before that makes the bootloader fall back to the old slot. * * Needs Wi-Fi joined to a network with internet (Settings screen). Joining an * AP moves the radio channel; the ESP-NOW link to Controller B follows it. * See wiki/pages/ota-updates.md. */ #ifndef OTA_UPDATE_H #define OTA_UPDATE_H #include namespace Ota { /** Log version/slot; note if this boot is an unconfirmed new image. Call early in setup(). */ void init(); /** Confirms a freshly installed image once it has run long enough. Call from loop(). */ void tick(); /** Console entry point (`ota ...`). Returns false if the line isn't an ota command. */ bool handleCommand(const char* line); /** Firmware version baked in at build time ("dev" for local builds). */ const char* version(); } // namespace Ota #endif // OTA_UPDATE_H