Add RX reject reasons to telemetry and UI

BACKWARD-INCOMPATIBLE: MeterBatch schema bumped to v2 with err_rx_reject.
- Track and log RX reject reasons (CRC/protocol/role/payload/length/id/batch)
- Include rx_reject in sender telemetry JSON and receiver web UI
- Add lora_receive reject reason logging under SERIAL_DEBUG_MODE
This commit is contained in:
2026-02-04 01:01:49 +01:00
parent 0e7214d606
commit 1024aa3dd0
10 changed files with 143 additions and 27 deletions

View File

@@ -10,6 +10,17 @@ enum class FaultType : uint8_t {
TimeSync = 4
};
enum class RxRejectReason : uint8_t {
None = 0,
CrcFail = 1,
BadProtocol = 2,
WrongRole = 3,
WrongPayloadType = 4,
LengthMismatch = 5,
DeviceIdMismatch = 6,
BatchIdMismatch = 7
};
struct FaultCounters {
uint32_t meter_read_fail;
uint32_t decode_fail;
@@ -33,6 +44,7 @@ struct MeterData {
uint32_t err_decode;
uint32_t err_lora_tx;
FaultType last_error;
uint8_t rx_reject_reason;
};
struct SenderStatus {
@@ -42,3 +54,4 @@ struct SenderStatus {
};
void init_device_ids(uint16_t &short_id, char *device_id, size_t device_id_len);
const char *rx_reject_reason_text(RxRejectReason reason);