diff --git a/src/features/stats/ObserverTab.tsx b/src/features/stats/ObserverTab.tsx index 639fb06..a90fe0a 100644 --- a/src/features/stats/ObserverTab.tsx +++ b/src/features/stats/ObserverTab.tsx @@ -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)} />
p.batteryMv)} /> diff --git a/src/features/stats/chartOptions.ts b/src/features/stats/chartOptions.ts index ca5d790..b4154fd 100644 --- a/src/features/stats/chartOptions.ts +++ b/src/features/stats/chartOptions.ts @@ -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 } }, ], }; } diff --git a/src/features/stats/transforms.ts b/src/features/stats/transforms.ts index 4f76bc2..cf8fd4d 100644 --- a/src/features/stats/transforms.ts +++ b/src/features/stats/transforms.ts @@ -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. diff --git a/src/features/stats/types.ts b/src/features/stats/types.ts index 3d4138e..628d787 100644 --- a/src/features/stats/types.ts +++ b/src/features/stats/types.ts @@ -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;