FwUpdate phase 1: only in FW_OTA images, manifest layout 2, no downgrade over the mesh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c93f5d906d
commit
0b38eab008
7 files changed
+1107
-12
No files matched your search
@@ -12,6 +12,7 @@
|
||||
//
|
||||
// dfu [uf2|serial|ota] reboot into the bootloader (local console only)
|
||||
// fw ... admin-pushed firmware update, see helpers/FwUpdate.h
|
||||
// (only with -D FW_OTA=1: the experimental -ota images)
|
||||
// set radio.silence <min> radio silence watchdog, 0/off = disabled (#6)
|
||||
// get radio.silence threshold, backoff, quiet time, stage
|
||||
// get radio.reboots reboots done by the watchdog, survives power loss
|
||||
@@ -26,13 +27,19 @@
|
||||
#include <Arduino.h>
|
||||
#include <Mesh.h>
|
||||
#include <helpers/CommonCLI.h>
|
||||
#ifdef FW_OTA
|
||||
#include <helpers/FwUpdate.h>
|
||||
#endif
|
||||
#include <helpers/RadioSilenceWatchdog.h>
|
||||
#include <helpers/radiolib/RadioLibWrappers.h>
|
||||
|
||||
class NodeMaintenance {
|
||||
public:
|
||||
#ifdef FW_OTA
|
||||
NodeMaintenance(mesh::MainBoard& board, RadioLibWrapper& radio) : _board(board), _radio(radio), _fw(board) { }
|
||||
#else
|
||||
NodeMaintenance(mesh::MainBoard& board, RadioLibWrapper& radio) : _board(board), _radio(radio) { }
|
||||
#endif
|
||||
|
||||
// Prints (and latches for `get boot`) the reset reason and the hardfault record.
|
||||
// The record is cleared once read, so call it once, as early as Serial is up.
|
||||
@@ -48,8 +55,13 @@ public:
|
||||
// Binary request from a logged-in client (REQ_TYPE_FW_OTA, firmware chunks).
|
||||
// Returns the reply length, 0 = no reply. Admins only.
|
||||
int handleRequest(bool admin, const uint8_t* req, int len, uint8_t* reply, int reply_max) {
|
||||
#ifdef FW_OTA
|
||||
if (!admin || len < 1 || req[0] != REQ_TYPE_FW_OTA) return 0;
|
||||
return _fw.handleBinary(req, len, reply, reply_max);
|
||||
#else
|
||||
(void)admin; (void)req; (void)len; (void)reply; (void)reply_max;
|
||||
return 0; // a classic image: no firmware update, the request is dropped
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -66,7 +78,9 @@ private:
|
||||
NodePrefs* _prefs = NULL;
|
||||
CommonCLICallbacks* _callbacks = NULL;
|
||||
|
||||
#ifdef FW_OTA
|
||||
FwUpdate _fw;
|
||||
#endif
|
||||
RadioSilenceWatchdog _silence;
|
||||
uint32_t _silence_reboots = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user