Distribute master OTA images to slaves over ESP-NOW.

After UART OTA the master reads the staged partition in 4 KiB blocks (200 B ESP-NOW chunks), waits for per-slave block ACKs, and fixes the final partial block. Slaves reuse ota_uart; send pacing and logging improve reliability.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-19 01:00:56 +02:00
co-authored by Cursor
parent 4bf43d8a5e
commit 9b7bda8551
13 changed files with 835 additions and 33 deletions
+15 -2
View File
@@ -2,6 +2,7 @@
#define OTA_UART_H
#include "esp_err.h"
#include "esp_partition.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
@@ -39,7 +40,19 @@ ota_feed_result_t ota_uart_feed(const uint8_t *data, size_t len);
uint32_t ota_uart_bytes_written(void);
/** Flush remainder, esp_ota_end, set boot partition on success. */
esp_err_t ota_uart_finish(bool *success_out);
/**
* Flush remainder and esp_ota_end. When set_boot is false, the staged image
* remains readable via ota_uart_get_staged_image() until ota_uart_apply_boot().
*/
esp_err_t ota_uart_finish(bool set_boot, bool *success_out);
/** Staged partition after ota_uart_finish(false, …); valid until apply_boot or abort. */
bool ota_uart_get_staged_image(const esp_partition_t **partition_out,
uint32_t *size_out);
/** Set boot partition to the last staged image (after slave distribution). */
esp_err_t ota_uart_apply_boot(void);
void ota_uart_clear_staged(void);
#endif