diff --git a/examples/companion_radio/Trail.h b/examples/companion_radio/Trail.h index 356666ae..9639a5b5 100644 --- a/examples/companion_radio/Trail.h +++ b/examples/companion_radio/Trail.h @@ -6,8 +6,9 @@ #include // RAM-only GPS trail ring buffer. -// Storage cost: 256 × 12 B = 3 KB. The trail survives auto-off (only the -// display blanks) but is lost on reboot — user explicitly snapshots to a +// Storage cost: CAPACITY(512) × sizeof(TrailPoint)(16 B, padded) = 8 KB, +// always resident (UITask::_trail member). The trail survives auto-off (only +// the display blanks) but is lost on reboot — user explicitly snapshots to a // LittleFS slot before powering down to keep it. struct TrailPoint { @@ -265,7 +266,7 @@ public: "%s", w.lat_1e6 / 1.0e6, w.lon_1e6 / 1.0e6, esc); if (len > 0) { - if ((size_t)len > sizeof(buf)) len = sizeof(buf); + if ((size_t)len >= sizeof(buf)) len = sizeof(buf) - 1; // truncated: emit chars only, not the NUL n += out.write((const uint8_t*)buf, (size_t)len); } if (w.ts > 1000000000UL) { // append