From 21e396366cbfefa097f0019196bdd42f8b669110 Mon Sep 17 00:00:00 2001 From: "Valentin V. Bartenev" Date: Fri, 15 May 2026 21:49:33 +0300 Subject: [PATCH] Web: fix trend min/max range to include both rx and tx for packets series The packets series is serialized as 3-element points [timestamp, rx, tx] by buildSeriesJson() since b64d57f, unlike other series which use [timestamp, value]. The min/max range display in renderTrendResult() was using p[1] for all series, which for packets only captured the rx delta, ignoring tx. Fix by selecting the mapper function based on the series key: for "packets", sum p[1] + p[2] (rx + tx); for all other series, use p[1] as before. This matches the existing pattern already used in drawSparkline() (line 1890). --- src/helpers/web/WebPanelServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/web/WebPanelServer.cpp b/src/helpers/web/WebPanelServer.cpp index 12706de2..b3805279 100644 --- a/src/helpers/web/WebPanelServer.cpp +++ b/src/helpers/web/WebPanelServer.cpp @@ -2074,7 +2074,7 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML( } const rangeEl = document.getElementById("head-range-" + key); if (rangeEl && points.length) { - const values = points.map((p) => p[1]).filter((v) => Number.isFinite(v)); + const values = points.map(key === "packets" ? ((p) => p[1] + p[2]) : ((p) => p[1])).filter((v) => Number.isFinite(v)); if (values.length) { rangeEl.textContent = "min " + formatTrendValue(key, Math.min(...values), false) + " / max " + formatTrendValue(key, Math.max(...values), false); }