Files
MeshCoreTel-firmware/examples
Valentin V. Bartenev e11d14e6cc Fix: expand HistorySample::recv_errors from uint16_t to uint32_t
The error_rate graph showed all zeros after ~65535 receive errors had
accumulated.  Root cause was a two-part bug:

1. In MyMesh::updateStatsHistory(), recv_errors was clamped to 0xFFFF
   via min<uint32_t>(..., 0xFFFF).  Once the counter reached 65535,
   every subsequent sample stored the same constant value, making the
   per-interval delta always zero and therefore error_rate always zero.

2. HistorySample::recv_errors was declared as uint16_t while the
   underlying counter (n_recv_errors) is uint32_t.  parseSummaryLine()
   also truncated the restored value back to uint16_t.

Fix:
- Remove the clamp in MyMesh::updateStatsHistory(); assign
  getPacketsRecvErrors() (uint32_t) directly.
- Change HistorySample::recv_errors from uint16_t to uint32_t,
  moving it next to the other uint32_t fields.
- Update both parseSummaryLine() code paths to cast recv_errors to
  uint32_t instead of uint16_t.

The archive format is unchanged: recv_errors is written as %u and
read back into an unsigned local, which is correct for a 32-bit
value on ESP32.
2026-05-20 19:53:12 +03:00
..