feat: update led-driver app files over ESP-NOW
tools/driver_ota.py (make ota-drivers) pushes the driver's .py files through the controller, one file per POST /drivers/ota/file. Drivers skip files they already have, and the rest are committed together. - one target: acked unicast, two chunks in flight - several targets: each file is broadcast once, then each driver is asked for its missing chunks and repaired by unicast - rel: rel_send_seq, rel_wait and rel_send_wait, plus a callback for the drivers' 0x26 status replies - commands are retried, because status replies are not acked - broadcast chunks are paced 50 ms apart: faster broadcast left C3 drivers unable to receive until reset - bench results in docs/BENCH_TEST.md, endpoints in docs/API.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1c222771a5
commit
32c0ecfa76
13 files changed
+862
-9
No files matched your search
+15
@@ -13,6 +13,7 @@
|
||||
// digest [4C][22][ver u16] (broadcast)
|
||||
// resync [4C][23][ver u16] (driver -> us)
|
||||
// echo [4C][24][beat_idx u16] (driver -> us, bench)
|
||||
// ota [4C][26][sess u16][op][code] + arg (driver -> us, see drv_ota.h)
|
||||
#define REL_FRAG_MAX 238 // inner packet bytes per frame; 4C 03/04 wrappers plus an envelope fit in one
|
||||
#define REL_MAX_FRAGS 32
|
||||
|
||||
@@ -34,6 +35,16 @@ esp_err_t rel_init(void);
|
||||
// acked or given up on. commit makes the driver adopt the current state version.
|
||||
esp_err_t rel_send(const uint8_t *mac, const void *data, size_t len, bool commit, int repeat);
|
||||
|
||||
// rel_send that also returns the sequence number, for rel_wait
|
||||
esp_err_t rel_send_seq(const uint8_t *mac, const void *data, size_t len, bool commit, int repeat, uint16_t *seq);
|
||||
|
||||
// Block until the unicast message (mac, seq) is fully acked (ESP_OK), given up on (ESP_FAIL)
|
||||
// or timeout_ms passes (ESP_ERR_TIMEOUT). Only the last few outcomes are kept, so wait soon after sending.
|
||||
esp_err_t rel_wait(const uint8_t *mac, uint16_t seq, int timeout_ms);
|
||||
|
||||
// Unicast send, retried while the radio queue is full, then rel_wait
|
||||
esp_err_t rel_send_wait(const uint8_t *mac, const void *data, size_t len, int timeout_ms);
|
||||
|
||||
// A broadcast state change happened: advance the version drivers compare in digests
|
||||
void rel_bump_ver(void);
|
||||
uint16_t rel_ver(void);
|
||||
@@ -43,6 +54,10 @@ void rel_set_resync_cb(rel_resync_cb_t cb);
|
||||
// A driver announced itself at boot: a 0x4C ANNOUNCE packet or its JSON hello (called from the rel task)
|
||||
typedef void (*rel_announce_cb_t)(const uint8_t mac[6], const uint8_t *pkt, int len);
|
||||
void rel_set_announce_cb(rel_announce_cb_t cb);
|
||||
|
||||
// A driver's OTA status reply (0x26), called from the rel task
|
||||
typedef void (*rel_ota_status_cb_t)(const uint8_t mac[6], const uint8_t *pkt, int len);
|
||||
void rel_set_ota_status_cb(rel_ota_status_cb_t cb);
|
||||
void rel_stats(rel_stats_t *out);
|
||||
|
||||
// Milliseconds since the driver last acked; -1 if never. fails = consecutive unacked messages
|
||||
|
||||
Reference in new issue
Block a user