Track receiver duplicate batches in web and OLED

This commit is contained in:
2026-02-13 20:03:15 +01:00
parent 1981a91415
commit 78a880e56f
4 changed files with 54 additions and 14 deletions

View File

@@ -274,6 +274,9 @@ static void init_sender_statuses() {
g_sender_statuses[i] = {};
g_sender_statuses[i].has_data = false;
g_sender_statuses[i].last_update_ts_utc = 0;
g_sender_statuses[i].rx_batches_total = 0;
g_sender_statuses[i].rx_batches_duplicate = 0;
g_sender_statuses[i].rx_last_duplicate_ts_utc = 0;
g_sender_statuses[i].last_data.short_id = EXPECTED_SENDER_IDS[i];
snprintf(g_sender_statuses[i].last_data.device_id, sizeof(g_sender_statuses[i].last_data.device_id), "dd3-%04X", EXPECTED_SENDER_IDS[i]);
g_sender_faults_remote[i] = {};
@@ -1261,6 +1264,22 @@ static void receiver_loop() {
}
bool duplicate = sender_idx >= 0 && g_last_batch_id_rx[sender_idx] == batch_id;
if (sender_idx >= 0) {
SenderStatus &status = g_sender_statuses[sender_idx];
if (status.rx_batches_total < UINT32_MAX) {
status.rx_batches_total++;
}
if (duplicate) {
if (status.rx_batches_duplicate < UINT32_MAX) {
status.rx_batches_duplicate++;
}
uint32_t duplicate_ts = time_get_utc();
if (duplicate_ts == 0) {
duplicate_ts = batch.t_last;
}
status.rx_last_duplicate_ts_utc = duplicate_ts;
}
}
send_batch_ack(batch_id, batch.n);
if (duplicate) {
goto receiver_loop_done;