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).
このコミットが含まれているのは:
Valentin V. Bartenev
2026-05-15 21:49:33 +03:00
コミット 21e396366c
+1 -1
ファイルの表示
@@ -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);
}