This commit is contained in:
2026-08-31 23:12:28 -04:00
parent 2152b8f727
commit 089be9564b
13 changed files with 147 additions and 39 deletions
+6 -2
View File
@@ -144,8 +144,12 @@ void write_struct_to_last_page(tx_rx_data_struct tx_data_in)
{
uint8_t page_val = get_last_page();
uint8_t next_page_val;
if (page_val == 255) {
next_page_val = 1;
if (page_val >= EEPROM_MAX_PAGE) {
// Spool full (~2.6 days of failed sends). Overwrite the newest spooled
// packet: one packet is lost either way, and this keeps the depth
// truthful -- the old wrap to page 1 stranded 254 packets the counter
// no longer admitted to.
next_page_val = EEPROM_MAX_PAGE;
} else {
next_page_val = page_val + 1;
}