Log ACK transmit and reject cases

- Add debug log for ACK TX with batch/sender/receiver ids
- Log rejected ACKs to help diagnose mismatched ids or batches
This commit is contained in:
2026-02-04 00:35:01 +01:00
parent fde4719a50
commit 4e06f7a96d

View File

@@ -497,6 +497,9 @@ static void send_batch_ack(uint16_t batch_id, uint16_t sender_id) {
write_u16_le(&ack.payload[0], batch_id); write_u16_le(&ack.payload[0], batch_id);
write_u16_le(&ack.payload[2], sender_id); write_u16_le(&ack.payload[2], sender_id);
write_u16_le(&ack.payload[4], g_short_id); write_u16_le(&ack.payload[4], g_short_id);
if (SERIAL_DEBUG_MODE) {
serial_debug_printf("ack: tx batch_id=%u sender=%u receiver=%u", batch_id, sender_id, g_short_id);
}
lora_send(ack); lora_send(ack);
lora_receive_continuous(); lora_receive_continuous();
} }
@@ -851,6 +854,9 @@ static void sender_loop() {
g_last_acked_batch_id = ack_id; g_last_acked_batch_id = ack_id;
serial_debug_printf("ack: ok batch_id=%u", ack_id); serial_debug_printf("ack: ok batch_id=%u", ack_id);
finish_inflight_batch(); finish_inflight_batch();
} else if (SERIAL_DEBUG_MODE) {
serial_debug_printf("ack: reject batch_id=%u sender=%u receiver=%u exp_batch=%u exp_sender=%u",
ack_id, ack_sender, ack_receiver, g_last_sent_batch_id, g_short_id);
} }
} }
} }