diff --git a/src/components/panels/NetworkHealthTelemetryPanel.tsx b/src/components/panels/NetworkHealthTelemetryPanel.tsx index 02b6efa..9f11f6e 100644 --- a/src/components/panels/NetworkHealthTelemetryPanel.tsx +++ b/src/components/panels/NetworkHealthTelemetryPanel.tsx @@ -3,16 +3,6 @@ import React, { useEffect, useState } from "react"; import ROSLIB from "roslib"; import { useROS } from "@/ros/ROSContext"; -import { - BarChart, - Bar, - XAxis, - YAxis, - Tooltip, - ResponsiveContainer, - Cell, - LabelList, -} from "recharts"; const dotStyle = (up: boolean): React.CSSProperties => ({ width: 12, @@ -177,23 +167,45 @@ const NetworkHealthTelemetryPanel: React.FC = () => { const toMbps = (bitsPerSecond: number) => bitsPerSecond / 1_000_000; - const throughputData = [ + const telemetryRows = [ { - name: "TX", - Throughput: toMbps(stats.throughputTx), - Capacity: toMbps(stats.bandwidthTx), + name: "Signal Strength", + value: stats.signalStrength.toFixed(2), + unit: "dBm", + good: stats.signalStrength > -70 && stats.signalStrength < -20, }, { - name: "RX", - Throughput: toMbps(stats.throughputRx), - Capacity: toMbps(stats.bandwidthRx), + name: "Noise Floor", + value: stats.noiseFloor.toFixed(2), + unit: "dBm", + good: stats.noiseFloor < -85, + }, + { + name: "CCQ TX", + value: stats.ccqTx.toFixed(2), + unit: "%", + good: stats.ccqTx >= 90, + }, + { + name: "Downlink", + value: `${toMbps(stats.throughputTx).toFixed(2)} / ${toMbps( + stats.bandwidthTx + ).toFixed(2)}`, + unit: "Mbps", + good: + stats.bandwidthTx > 0 && + stats.throughputTx / stats.bandwidthTx < 0.8, + }, + { + name: "Uplink", + value: `${toMbps(stats.throughputRx).toFixed(2)} / ${toMbps( + stats.bandwidthRx + ).toFixed(2)}`, + unit: "Mbps", + good: + stats.bandwidthRx > 0 && + stats.throughputRx / stats.bandwidthRx < 0.8, }, - ]; - - const telemetryRows = [ - { name: "Signal Strength", value: stats.signalStrength.toFixed(2), unit: "dBm" }, - { name: "Noise Floor", value: stats.noiseFloor.toFixed(2), unit: "dBm" }, - { name: "CCQ TX", value: stats.ccqTx.toFixed(2), unit: "%" }, ]; return ( @@ -212,13 +224,13 @@ const NetworkHealthTelemetryPanel: React.FC = () => { - - - @@ -226,11 +238,11 @@ const NetworkHealthTelemetryPanel: React.FC = () => { {pingRows.map((r) => ( - - + - @@ -243,75 +255,32 @@ const NetworkHealthTelemetryPanel: React.FC = () => {
+ Host + RTT (ms) + Status
{r.name} + {r.name} {r.rttMs === -1 ? "Offline" : r.rttMs} +
- - + {telemetryRows.map((row) => ( - - + + ))}
+ Metric + Value + Status +
{row.name} + {row.name} {row.value} {row.unit} + +
- -
-
- - - Math.max(1, Math.floor(dataMax * 1.2))]} - stroke="#ccc" - tick={{ fill: "#ccc" }} - /> - - - - - - {throughputData.map((entry, index) => ( - 0 && entry.Throughput / entry.Capacity > 0.85 - ? "#ef4444" - : "#3b82f6" - } - /> - ))} - - - -
-
); };