Plane radar pr #329
No reviewers
Labels
No labels
bug
conflicts
documentation
DO NOT MERGE
duplicate
enhancement
good first issue
hardware
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
greg/info-orbs!329
Loading…
Reference in a new issue
No description provided.
Delete branch "havedill/plane-radar-pr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a Plane Radar widget that shows live nearby aircraft on the center orb and detail views on the other four orbs. Inspired by ESP32-Plane-Radar.
Data sources (no API keys required):
Disabled by default (
WIDGET_OFF) so existing builds are unchanged.Configuration (
config.h)Add to your
config.h(seeconfig.h.template):#define INCLUDE_PLANE_RADAR WIDGET_ON // WIDGET_ON | WIDGET_OFF | WIDGET_DISABLED
Optional overrides (defaults in
config.system.h):PLANE_RADAR_LAT48.4284PLANE_RADAR_LON-123.3656PLANE_RADAR_RANGE_INDEX10=5 mi,1=10 mi,2=15 mi,3=25 mi (inner ring label)PLANE_RADAR_FETCH_INTERVAL_SEC3PLANE_RADAR_CYCLE_DELAY180PLANE_RADAR_UNITS_METRICplaneLat,planeLon,planeFetchSec,planeCycleSec,planeUnitsMetric, enable/disable).Pull request overview
Adds a new Plane Radar widget to the firmware widget carousel, fetching live nearby aircraft via ADS-B and enriching details with route lookups, with optional per-widget carousel cycle timing.
Changes:
PlaneRadarWidget(radar center orb + detail orbs), including range cycling persisted to NVS.AdsbClient) and route (RouteClient) HTTP clients with lightweight caching/prefetch.main.cppplus configuration defaults/templates.Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
INCLUDE_PLANE_RADAR != WIDGET_DISABLED.getWidgetCyclePageDelayMs()optional override hook.💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -0,0 +220,4 @@s_aircraft[n].lat = plane["lat"].as<float>();s_aircraft[n].lon = plane["lon"].as<float>();s_aircraft[n].noseDeg = pickNoseHeading(plane);The lat/lon presence check is too strict: it only accepts values where plane["lat"]/plane["lon"] are is(). ArduinoJson commonly stores numbers as double/int, so valid aircraft can be skipped. You already have readJsonFloat() for this.
@ -0,0 +190,4 @@*dxKm = static_cast<float>(lon - centerLon) * kKmPerDeg;*dyKm = static_cast<float>(lat - centerLat) * kKmPerDeg;*distKm = sqrtf((*dxKm) * (*dxKm) + (*dyKm) * (*dyKm));}offsetKmFromCenter() converts longitude degrees to km using a constant kKmPerDeg, but longitude distance varies by cos(latitude). This will noticeably distort aircraft positions/distances (especially at the default ~48° lat) and can mis-rank “closest” aircraft.
@ -0,0 +754,4 @@strncpy(out->callsign, plane.callsign, sizeof(out->callsign) - 1);strncpy(out->desc, plane.desc[0] != '\0' ? plane.desc : plane.type, sizeof(out->desc) - 1);RouteClient::formatRoute(plane.callsign, out->route, sizeof(out->route));strncpy(out->alt, plane.alt, sizeof(out->alt) - 1);buildDetailSnapshot() uses strncpy(..., sizeof(buf)-1) but never writes the trailing '\0'. If the source string length equals the max (e.g., 8-char callsign, 35-char desc), out->callsign/out->desc/out->alt may be unterminated and later passed to String(next.callsign)/String(next.desc), causing out-of-bounds reads.
@ -0,0 +809,4 @@strncpy(m_slotCallsign[slot], next.callsign, sizeof(m_slotCallsign[slot]) - 1);} else {m_slotCallsign[slot][0] = '\0';}m_slotCallsign[slot] is populated with strncpy(..., sizeof-1) but not explicitly null-terminated. If next.callsign is at the max length, m_slotCallsign can become unterminated and later strncmp() calls may read past the buffer.
@ -0,0 +35,4 @@out[0] = '\0';if (outLen == 0 || in == nullptr) {return;}normalizeCallsign() writes out[0] = '\0' before checking outLen. If outLen==0, this is an out-of-bounds write (even though current callers pass a non-zero size).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.