FwUpdate: manifest check and verify run in loop(), not in the command handler

This commit is contained in:
tth committed 2026-11-13 00:23:05 +01:00
1 parent aaca10958e
commit 228e7a129b
2 files changed
+41 -12

No files matched your search

+8
View File
@@ -52,12 +52,19 @@ public:
private:
enum State : uint8_t { IDLE, RECEIVING, READY, FAILED };
// Heavy work (ed25519, sha256 of the running image, the dry run) is never done
// inside a command handler: over the mesh that runs deep in the packet path,
// and on x1 (13. 11. 2026) the manifest check there overflowed the stack --
// hardfault in RadioLib's SPI code moments later. The handler queues it,
// loop() runs it with a shallow stack, `fw status` reports the result.
enum Job : uint8_t { JOB_NONE, JOB_MANIFEST, JOB_VERIFY };
void cmdStatus(char *reply);
void cmdBegin(const char *arg, char *reply);
void cmdWrite(const char *arg, char *reply);
void cmdMissing(char *reply);
void cmdVerify(char *reply);
void doVerify();
void cmdApply(uint32_t sender_timestamp, const char *arg, char *reply);
void cmdBootloader(char *reply);
uint16_t battMinMv();
@@ -72,6 +79,7 @@ private:
uint32_t _raw_size = 0;
uint16_t _crc = 0;
uint8_t _format = 0;
Job _job = JOB_NONE;
bool _manifest_ok = false;
bool _base_known = false;
uint8_t _base_sha[32];