mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-03 10:46:12 +00:00
refactor(ui): extract shared helpers, dedup screens, GPS shutdown via provider
Pull repeated UI idioms into DisplayDriver and remove duplicated logic: - DisplayDriver: add drawScrollArrows() and drawInvertedHeader(); replaces 11 copy-pasted scroll-arrow blocks across 5 screens and 3 inverted title-bar blocks (NearbyScreen x2, NavView). Standardises the detail-view separator. - useImperial(): single source on UITask; NearbyScreen/TrailScreen delegate instead of each re-reading NodePrefs.units_imperial. - NearbyScreen: extract saveSelectedWaypoint() (two identical blocks -> one); drop the redundant local label buffer (WaypointStore truncates). - UITask::shutdown(): power GPS off through LocationProvider::stop() instead of poking PIN_GPS_EN directly — centralises enable/reset-pin + active-level logic. Net -58 lines. Verified: GAT562 (SSD1306) and WioTrackerL1Eink (GxEPD) solo builds compile clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
1521be3803
commit
151892e1ce
@@ -24,14 +24,7 @@ inline void draw(DisplayDriver& d,
|
||||
const int hdr = d.headerH();
|
||||
|
||||
// Title bar: label, inverted (matches the Nearby/discover detail style).
|
||||
char title[24];
|
||||
d.translateUTF8ToBlocks(title, (label && label[0]) ? label : "Navigate", sizeof(title));
|
||||
d.setColor(DisplayDriver::LIGHT);
|
||||
d.fillRect(0, 0, d.width(), hdr - 1);
|
||||
d.setColor(DisplayDriver::DARK);
|
||||
d.drawTextEllipsized(2, 1, d.width() - 4, title);
|
||||
d.setColor(DisplayDriver::LIGHT);
|
||||
d.fillRect(0, hdr - 1, d.width(), d.sepH());
|
||||
d.drawInvertedHeader((label && label[0]) ? label : "Navigate");
|
||||
|
||||
if (!own_valid) {
|
||||
d.drawTextCentered(cx, hdr + (d.height() - hdr) / 2 - d.getLineHeight(), "No GPS fix");
|
||||
|
||||
Reference in New Issue
Block a user