mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 19:02:00 +00:00
refactor: one copy of shared logic and widgets; GPS is asked for, not switched on silently
Duplicates found between the L1 and L2 frontends, and inside the L2 one:
- geo::fmtLocShare / fmtLatLon / turnDeg / isAhead (GeoUtils.h): the [LOC]
text was built in five places, the turn angle and its "ahead" threshold in
both navigations, coordinates by hand in nine. Tested.
- LiveShareEngine::setEnabled: live share was switched in three places.
- L1 waypoint share uses WaypointModel::shareText; Trail's "Share my pos"
goes through UITask::quickShareMyLocation, so it now sends to a running
live-share session as the home Map page does.
- L2 Widgets.h: switchCreate (one switch size, was four), switchRow with a
state and callback (16 hand-wired copies), switchRowOpens (Bluetooth, WiFi,
GPS), primaryButton (one height for Save / Measure / New area / Update).
GPS: with it off, starting the trail, live share or track back, sharing or
marking a position, or centring the map asks first ("GPS is off") on both
L1 and L2; Cancel leaves it undone. A share or a mark waits for a fresh fix
(a switched-off module may still report its last one), which also fixes the
L1 "Share my pos" sending a stale position. SOS still turns the GPS on itself.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -404,7 +404,12 @@ public:
|
||||
void pinPopup(bool channel, uint8_t ch_idx, const uint8_t* pub_key);
|
||||
void pinTo(int slot);
|
||||
void setGps(bool on);
|
||||
bool ensureGps(); // true with a fix; else turns GPS on / says it's waiting
|
||||
// What needs the GPS while it's off: asked first ("GPS is off"), then done
|
||||
// once it's turned on (GpsScreen.h).
|
||||
enum GpsAsk : uint8_t { GA_TRAIL, GA_SHARE, GA_TRACKBACK, GA_CENTRE, GA_FIX };
|
||||
bool gpsAsked(GpsAsk what); // true: it was off, the question is up
|
||||
bool ensureGps(GpsAsk what); // true with a fix; else asks, or says it's waiting
|
||||
void gpsAskDone(GpsAsk what);
|
||||
|
||||
// Kept for main.cpp's sim hooks (ui-new API).
|
||||
void openContactDM(const ContactInfo& ci) { openDM(ci.id.pub_key); }
|
||||
|
||||
Reference in New Issue
Block a user