mirror of
https://github.com/MeshCore-Beacon/beacon-web.git
synced 2026-10-17 13:29:55 +00:00
stats: read renamed telemetry airtime fields (airtimeTxSecs/RxSecs)
This commit is contained in:
@@ -258,7 +258,7 @@ export function ObserverTab({ range, selectedObserverId, onSelectObserver, wsMan
|
||||
option={airtime}
|
||||
isLoading={telemetry.isLoading}
|
||||
isError={telemetry.isError}
|
||||
isEmpty={missing((p) => p.airtimeTxPct, (p) => p.airtimeRxPct)}
|
||||
isEmpty={missing((p) => p.airtimeTxSecs, (p) => p.airtimeRxSecs)}
|
||||
/>
|
||||
<div className="grid grid-cols-1 gap-3.5 lg:grid-cols-2">
|
||||
<ChartCard title="Battery" height={168} option={battery} isLoading={telemetry.isLoading} isError={telemetry.isError} isEmpty={missing((p) => p.batteryMv)} />
|
||||
|
||||
@@ -324,8 +324,8 @@ export function airtimeOption(points: TelemetryPoint[], c: ChartColors, bucketMs
|
||||
xAxis: timeAxis(c),
|
||||
yAxis: percentAxis(c),
|
||||
series: [
|
||||
{ name: "RX", type: "line", stack: "air", smooth: true, symbol: "none", connectNulls: true, data: airtimePctSeries(points, "airtimeRxPct", bucketMs), lineStyle: { width: 1, color: c.green }, areaStyle: { color: withAlpha(c.green, 0.35) }, itemStyle: { color: c.green } },
|
||||
{ name: "TX", type: "line", stack: "air", smooth: true, symbol: "none", connectNulls: true, data: airtimePctSeries(points, "airtimeTxPct", bucketMs), lineStyle: { width: 1, color: c.primary }, areaStyle: { color: withAlpha(c.primary, 0.35) }, itemStyle: { color: c.primary } },
|
||||
{ name: "RX", type: "line", stack: "air", smooth: true, symbol: "none", connectNulls: true, data: airtimePctSeries(points, "airtimeRxSecs", bucketMs), lineStyle: { width: 1, color: c.green }, areaStyle: { color: withAlpha(c.green, 0.35) }, itemStyle: { color: c.green } },
|
||||
{ name: "TX", type: "line", stack: "air", smooth: true, symbol: "none", connectNulls: true, data: airtimePctSeries(points, "airtimeTxSecs", bucketMs), lineStyle: { width: 1, color: c.primary }, areaStyle: { color: withAlpha(c.primary, 0.35) }, itemStyle: { color: c.primary } },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ export function hasTelemetry(points: TelemetryPoint[]): boolean {
|
||||
return points.some(
|
||||
(p) =>
|
||||
live(p.batteryMv) ||
|
||||
live(p.airtimeTxPct) ||
|
||||
live(p.airtimeRxPct) ||
|
||||
live(p.airtimeTxSecs) ||
|
||||
live(p.airtimeRxSecs) ||
|
||||
live(p.noiseFloorDb) ||
|
||||
live(p.uptimeSeconds) ||
|
||||
live(p.queueLength) ||
|
||||
@@ -59,9 +59,9 @@ function pct(seconds: number, windowSeconds: number): number {
|
||||
return Math.round(((seconds * 100) / windowSeconds) * 1000) / 1000;
|
||||
}
|
||||
|
||||
type AirtimeKey = "airtimeRxPct" | "airtimeTxPct";
|
||||
type AirtimeKey = "airtimeRxSecs" | "airtimeTxSecs";
|
||||
|
||||
// The values are on-air seconds despite the field name: cumulative on raw 1h points, per-bucket on
|
||||
// The values are on-air seconds: cumulative on raw 1h points, per-bucket on
|
||||
// bucketed ones. Chart the increase as a percent of the elapsed time, clamped at 0 on counter resets.
|
||||
export function airtimePctSeries(points: TelemetryPoint[], key: AirtimeKey, bucketMs: number | null): [number, number | null][] {
|
||||
if (bucketMs != null) {
|
||||
@@ -88,7 +88,7 @@ export function latestAirtimePct(points: TelemetryPoint[], bucketMs: number | nu
|
||||
const s = airtimePctSeries(points, key, bucketMs);
|
||||
return s.length ? s[s.length - 1]![1] : null;
|
||||
};
|
||||
return { rx: last("airtimeRxPct"), tx: last("airtimeTxPct") };
|
||||
return { rx: last("airtimeRxSecs"), tx: last("airtimeTxSecs") };
|
||||
}
|
||||
|
||||
// The server skips empty buckets; fill them so a quiet stretch draws as zero instead of a skipped line.
|
||||
|
||||
@@ -99,8 +99,8 @@ export interface ScopeStats {
|
||||
export interface TelemetryPoint {
|
||||
t: number; // epoch ms
|
||||
batteryMv: number | null;
|
||||
airtimeTxPct: number | null; // on-air seconds despite the name: cumulative on 1h points, per-bucket otherwise
|
||||
airtimeRxPct: number | null;
|
||||
airtimeTxSecs: number | null; // cumulative since boot on 1h points, per-bucket delta otherwise
|
||||
airtimeRxSecs: number | null;
|
||||
noiseFloorDb: number | null;
|
||||
uptimeSeconds: number | null;
|
||||
queueLength: number | null;
|
||||
|
||||
Reference in New Issue
Block a user