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:
MarekZegare4
2026-06-14 13:21:59 +02:00
co-authored by Claude Sonnet 4.6
parent 1521be3803
commit 151892e1ce
9 changed files with 76 additions and 134 deletions
@@ -39,11 +39,8 @@ public:
display.setCursor(cw + 2, y);
display.print(ITEMS[idx]);
}
display.setColor(DisplayDriver::LIGHT);
if (_scroll > 0)
{ display.setCursor(display.width() - cw, start_y); display.print("^"); }
if (_scroll + vis < ITEM_COUNT)
{ display.setCursor(display.width() - cw, start_y + (vis - 1) * item_h); display.print("v"); }
display.drawScrollArrows(start_y, start_y + (vis - 1) * item_h,
_scroll > 0, _scroll + vis < ITEM_COUNT);
return 500;
}