Stabelized OTA Update with Retries

This commit is contained in:
2026-06-06 17:15:55 +02:00
parent 99956e3362
commit f89ea3cbe3
3 changed files with 163 additions and 30 deletions
+10 -2
View File
@@ -28,6 +28,8 @@ typedef enum {
typedef enum {
OTA_FEED_OK = 0,
OTA_FEED_BLOCK_WRITTEN,
OTA_FEED_SEQ_DUP,
OTA_FEED_SEQ_GAP,
OTA_FEED_ERROR,
} ota_feed_result_t;
@@ -41,8 +43,14 @@ int ota_uart_prepare(uint32_t total_size);
void ota_uart_abort(void);
/** Append up to 200 bytes; flushes 4 KiB blocks to flash when full. */
ota_feed_result_t ota_uart_feed(const uint8_t *data, size_t len);
/**
* Append up to 200 bytes with strict seq checking (0, 1, 2, …).
* Duplicates (seq < expected) return OTA_FEED_SEQ_DUP; gaps return OTA_FEED_SEQ_GAP.
*/
ota_feed_result_t ota_uart_feed_chunk(uint32_t seq, const uint8_t *data, size_t len);
/** True when a full 4 KiB block is in flash (used to re-ACK host block retries). */
bool ota_uart_block_ready_for_reack(void);
uint32_t ota_uart_bytes_written(void);