Repository navigation
Add configurable compass heading to rotate the radar display - #111
Open
nicolasluckie wants to merge 1 commit into
Open
nicolasluckie wants to merge 1 commit into
nicolasluckie wants to merge 1 commit into
Conversation
Adds a "Compass heading the top of the display faces" field to the Wi-Fi portal that rotates the entire radar (N/E/S/W labels, crosshairs, aircraft, runways) to match how the device is physically mounted. 0° = north at top (default), 90° = east at top, etc. The cardinal labels stay upright but move around the bezel edge. Aircraft nose/track bearings and runway positions are rotated into the screen frame. The heading is stored in preferences
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add configurable compass heading to rotate the radar display
250°
0 (Default)
What
Adds a "Compass heading the top of the display faces (deg, 0-359)" field to the Wi-Fi/LAN setup portal. The whole radar rotates so the map matches how the device is physically mounted:
0(default) keeps north at the top, so behaviour is unchanged for existing users.90puts east at the top,180south,270west.Why
The device is often placed where its top doesn't face north (desk, windowsill, wall mount). Today the map is always north-up, so planes appear on the wrong side of the display relative to the real sky. This lets the display match the room.
How
radar_range.{h,cpp}: new persistedheadingDeg()(NVS keynorthDegin the existingplaneradarnamespace),saveHeadingFromPortal(),rotateKmForHeading()andscreenBearingDeg(). sin/cos are cached when the heading changes. Input wraps modulo 360, and invalid input keeps the previous value. The heading is reset by the existing 3 s BOOT wipe (unitsReset()).radar_display.cpp/runway_overlay.cpp: the rotation is applied once, inoffsetKmFromCenter(), so aircraft, rim dots, runways and airport labels all follow. Aircraft nose/track angles usescreenBearingDeg().radar_display.cpp: crosshairs and cardinal labels are placed by angle. Each label is positioned from its measured width/height so it stays inside the round bezel at any angle.wifi_setup.cpp: new number field plus a short hint, registered next to lat/lon.radar_theme.h: replacedkCardinalNorthOffsetY/kCardinalSouthOffsetY(now unused) with a singlekCardinalRadialOffsetPxtuning constant.README.md: documented the new field and the label behaviour.Testing
pio run -e superminibuilds cleanly.<value used in photo>and confirmed N/E/S/W, spokes, aircraft and rim dots all rotate consistently and labels stay upright (photo below).0looks the same as before.>Notes for review
kCardinalRadialOffsetPxinradar_theme.hnudges them if you prefer the old look.5km) intentionally stays at 3 o'clock and does not rotate.