Skip to content

feat(telemetry): add live web dashboard - #3

Open
TheLostLeo wants to merge 5 commits into
mainfrom
feature/telemetry
Open

TheLostLeo wants to merge 5 commits into
mainfrom
feature/telemetry

Conversation

@TheLostLeo

Copy link
Copy Markdown
Collaborator

Change the Front end to react

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical deployment, telemetry integration, build, and mission-control issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 4 High severity · 4 Medium severity

Open (8)
What changed in this PR

Migrates the telemetry dashboard from legacy static HTML/CSS/JavaScript to React, Vite, TypeScript, and Tailwind.

Changes:

  • Adds typed telemetry polling, mock handling, charts, reusable components, and a 3D attitude view.
  • Adds frontend build, styling, PostCSS, and Docker configuration.
  • Replaces the legacy dashboard assets and logic.
File Description
telemetry/​live-web-dashboard/​vite.config.ts Vite React configuration
telemetry/​live-web-dashboard/​tsconfig.node.json Vite TypeScript configuration
telemetry/​live-web-dashboard/​tsconfig.json Application TypeScript settings
telemetry/​live-web-dashboard/​tailwind.config.js Tailwind theme configuration
telemetry/​live-web-dashboard/​style.css Removed legacy stylesheet
telemetry/​live-web-dashboard/​src/​types/​telemetry.ts Telemetry type definitions
telemetry/​live-web-dashboard/​src/​styles.css Global Tailwind styles
telemetry/​live-web-dashboard/​src/​main.tsx React entrypoint
telemetry/​live-web-dashboard/​src/​hooks/​useTelemetry.ts Telemetry polling and state mapping
telemetry/​live-web-dashboard/​src/​data/​telemetry.ts Vehicle and chart metadata
telemetry/​live-web-dashboard/​src/​components/​TopBar.tsx Dashboard header
telemetry/​live-web-dashboard/​src/​components/​TelemetryChart.tsx Telemetry charts
telemetry/​live-web-dashboard/​src/​components/​SbcStatusCard.tsx SBC metrics card
telemetry/​live-web-dashboard/​src/​components/​Panel.tsx Shared panel components
telemetry/​live-web-dashboard/​src/​components/​NavSignalBox.tsx Navigation and signal card
telemetry/​live-web-dashboard/​src/​components/​LinkCard.tsx Link health card
telemetry/​live-web-dashboard/​src/​components/​FlightStatusCard.tsx Flight status card
telemetry/​live-web-dashboard/​src/​components/​ChartPanel.tsx Chart panel wrapper
telemetry/​live-web-dashboard/​src/​components/​BatteryBox.tsx Battery card
telemetry/​live-web-dashboard/​src/​components/​AttitudeScene.tsx Three.js attitude visualization
telemetry/​live-web-dashboard/​src/​components/​AttitudeIndicator.tsx Attitude panel
telemetry/​live-web-dashboard/​src/​components/​AltitudeCard.tsx Altitude card
telemetry/​live-web-dashboard/​src/​App.tsx Main dashboard layout
telemetry/​live-web-dashboard/​postcss.config.js PostCSS configuration
telemetry/​live-web-dashboard/​package.json Frontend dependencies and scripts
telemetry/​live-web-dashboard/​index.html React HTML shell
telemetry/​live-web-dashboard/​Dockerfile Frontend container setup
telemetry/​live-web-dashboard/​app.js Removed legacy dashboard logic
.gitignore Ignores generated frontend artifacts

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread telemetry/live-web-dashboard/index.html
Comment on lines +39 to +44
<main className="flex flex-1 flex-col gap-2 p-2.5">
<div className="grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-12">
<BatteryBox battery={t.battery} className="min-h-[150px] xl:col-span-3 xl:h-[164px]" />
<NavSignalBox nav={t.nav} className="min-h-[150px] xl:col-span-4 xl:h-[164px]" />
<AltitudeCard altitude={t.altitude} className="min-h-[150px] xl:col-span-2 xl:h-[164px]" />
<LinkCard link={t.link} className="min-h-[150px] xl:col-span-3 xl:h-[164px]" />
Comment thread telemetry/live-web-dashboard/src/components/FlightStatusCard.tsx Outdated

const SAMPLES = 64;
const TICK_MS = 260;
const LIVE_ENDPOINT = "http://192.168.4.1/telemetry.json";

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No code change needed for this one. The dashboard no longer defaults to the Pi /api/telemetry server path. It prompts for the ESP32 IP and polls http://<esp-ip>/telemetry.json; the ESP32 firmware registers that route and returns the live JSON snapshot. Mock fallback data has also been removed.

Comment thread telemetry/live-web-dashboard/src/App.tsx Outdated
heading,
sats: clamp(Math.round(num(raw.satellites, prev.nav.sats)), 0, 32),
hdop: num(raw.hdop, prev.nav.hdop),
rssi: Math.round(num(raw.rc_rssi, prev.nav.rssi)),
Comment on lines +319 to +320
diskUsed: clamp(num(sbc.disk_percent, prev.sbc.diskUsed), 0, 100),
diskTotal: prev.sbc.diskTotal,
Comment thread telemetry/live-web-dashboard/src/hooks/useTelemetry.ts Outdated
Signed-off-by: TheLostLeo <thelostleo224@gmail.com>
@TheLostLeo

Copy link
Copy Markdown
Collaborator Author

@copilot review the new commit 2b93a3a. The dashboard was moved to telemetry/live-web-dashboard, the Pi code now focuses on MAVLink -> NRF, and ESP32 exposes JSON for the web dashboard.

Co-authored-by: TheLostLeo <166975150+TheLostLeo@users.noreply.github.com>

Copilot AI commented Sep 21, 2026

Copy link
Copy Markdown

@copilot review the new commit 2b93a3a. The dashboard was moved to telemetry/live-web-dashboard, the Pi code now focuses on MAVLink -> NRF, and ESP32 exposes JSON for the web dashboard.

Reviewed 2b93a3a with the updated ESP32 JSON architecture in mind and pushed follow-up fixes in ce38d9c: TypeScript build compatibility (moduleResolution: "Bundler"), explicit ReactNode typing, corrected PID chart timing labels (64 s / 1 Hz), RSSI healthy-threshold logic for percent units, and SBC uptime formatting from seconds.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +18 to +20
from sbc_monitor import SBCMonitor
from mavlink_manager import MAVLinkManager
from radio_tx_module import RadioTXModule
Comment thread telemetry/README.md Outdated
Comment on lines 15 to 16
### `handheld-nrf-monitor/pi-code/main.py`
Entry point for the Raspberry Pi companion server. It starts the MAVLink manager, SBC monitor, web dashboard server, NRF24L01+ transmitter, and autonomous grid-search module.
Comment thread telemetry/README.md Outdated
npm run build
```

Then start the Raspberry Pi companion server. It will serve `telemetry/live-web-dashboard/dist/index.html` and the generated `dist/assets/*` files. For local development, run Vite instead:
Comment on lines +62 to +66
const char* WIFI_STA_SSID = "gamma";
const char* WIFI_STA_PASSWORD = "gammared";
const char* WIFI_HOSTNAME = "drone-esp32";
const char* WIFI_FALLBACK_AP_SSID = "DroneTelemetryESP32";
const char* WIFI_FALLBACK_AP_PASSWORD = "drone12345";
Comment on lines +18 to +20
from sbc_monitor import SBCMonitor
from mavlink_manager import MAVLinkManager
from radio_tx_module import RadioTXModule
import type { SbcState } from "../types/telemetry";

function formatUptime(ticks: number): string {
const seconds = ticks * 4;
Comment thread telemetry/live-web-dashboard/src/components/TopBar.tsx Outdated
Comment on lines +323 to +331
setState((prev) => fromLive(prev, raw, endpoint, latencyMs));
} catch (error) {
failures += 1;
const detail = errorText(error);
setState((prev) =>
failures >= OFFLINE_AFTER_FAILURES
? markJsonOffline(prev, endpoint, detail)
: markJsonDegraded(prev, endpoint, detail, failures)
);
Comment thread telemetry/README.md Outdated
Comment on lines +24 to +25
### `handheld-nrf-monitor/pi-code/modules/web_dashboard_module.py`
Runs the HTTP/WebSocket server, serves the built dashboard from `live-web-dashboard/dist/`, exposes telemetry APIs, and forwards mission-control requests to the grid-search module. If `dist/` is missing, it returns a build-required error instead of serving Vite source files.
Comment on lines +13 to +14
dim: "#8b9aab",
faint: "#5c6a7a"
@InvictusRex

Copy link
Copy Markdown
Owner

@copilot i want a review on the latest commit

Copilot AI commented Sep 22, 2026

Copy link
Copy Markdown

@copilot i want a review on the latest commit

Reviewed the latest commit (b7b0655). I found one critical issue still open: the Pi mission/control HTTP server is enabled by default, bound to 0.0.0.0, and exposes /api/arm + /api/mode without auth (telemetry/handheld-nrf-monitor/pi-code/main.py:57-67, .../modules/web_dashboard_module.py:61-63, 217-227). Any host on the same network can send flight-control commands. I recommend defaulting web control off (or localhost-only) and requiring authentication before enabling arm/mode endpoints.

@TheLostLeo

Copy link
Copy Markdown
Collaborator Author

fix the issues

@InvictusRex

Copy link
Copy Markdown
Owner

@copilot Find the issues in the latest commit from @TheLostLeo

Copilot AI commented Sep 29, 2026

Copy link
Copy Markdown

@copilot Find the issues in the latest commit from @TheLostLeo

I reviewed @TheLostLeo’s latest commit (2c9e357) and found two high-confidence issues:

  1. telemetry/handheld-nrf-monitor/pi-code/main.py:24-30 — removing --no-web/--web-port is a breaking CLI change; existing service scripts using those flags will now fail at startup with “unrecognized arguments”.
  2. telemetry/handheld-nrf-monitor/pi-code/main.py:49-56 (+ deletion of pi-code/modules/web_dashboard_module.py and pi-code/modules/grid_search_module.py) — runtime mission-control /api/mission/* capability is fully removed, which breaks integrations relying on those endpoints.

If you want, I can push a minimal compatibility fix next (deprecated no-op flags + opt-in legacy API mode).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants