From d408bada073546f81493a31a92f4cc6dbfcc4158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Martin?= Date: Sun, 4 Oct 2026 22:29:20 +0200 Subject: [PATCH] M2 step 4: GNSS mark in the Status Bar; the clock follows the Fix Q61: a muted G while searching (or the receiver is silent), G with a 2D Fix, G and the satellite count with a 3D Fix; nothing when GNSS is off. Verified on the device by a window: 3D Fix, 9 of 11 satellites used (GPS, GLONASS, BeiDou), HDOP 1.3, Status Bar "G9", and "gnss: clock set". Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT --- src/main.cpp | 8 ++++++++ src/ui/widgets.cpp | 6 ++++++ src/ui/widgets.h | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 071a5da..814420d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -91,6 +91,14 @@ static StatusInfo currentStatus() { s.sdLevel = storageState.level; s.compose = keyMapper.pendingCompose(); s.unread = irc->totalUnread(); + if (gnssService && gnssService->on()) { + const auto& g = gnssService->state(); + bool fresh = gnssService->receiving(millis()); + s.gnss = !fresh || g.fix == gnss::FixType::None ? StatusInfo::Gnss::Searching + : g.fix == gnss::FixType::TwoD ? StatusInfo::Gnss::TwoD + : StatusInfo::Gnss::ThreeD; + s.gnssSatellites = g.satellitesUsed; + } using WifiState = WifiController::State; switch (wifi->state()) { case WifiState::Connected: { diff --git a/src/ui/widgets.cpp b/src/ui/widgets.cpp index d5707f0..507984d 100644 --- a/src/ui/widgets.cpp +++ b/src/ui/widgets.cpp @@ -48,6 +48,12 @@ void statusBar(Canvas& c, const StatusInfo& info) { case StatusInfo::Wifi::Monitoring: right("MON", kAccent); break; case StatusInfo::Wifi::None: break; } + switch (info.gnss) { // Q61: muted while searching, normal with a Fix, the count with a 3D Fix + case StatusInfo::Gnss::Searching: right("G", kMuted); break; + case StatusInfo::Gnss::TwoD: right("G", kText); break; + case StatusInfo::Gnss::ThreeD: right("G" + std::to_string(info.gnssSatellites), kText); break; + case StatusInfo::Gnss::None: break; + } if (info.compose) right(std::string("opt ") + (info.compose == '*' ? "" : std::string(1, info.compose)), kAccent); c.setTextDatum(top_left); } diff --git a/src/ui/widgets.h b/src/ui/widgets.h index 1a8a7a2..d30f24d 100644 --- a/src/ui/widgets.h +++ b/src/ui/widgets.h @@ -24,11 +24,13 @@ struct StatusInfo { enum class Wifi { None, Searching, Connected, Monitoring } wifi = Wifi::None; int wifiBars = 0; // 0..3 when Connected int unread = 0; // unread messages across Services + enum class Gnss { None, Searching, TwoD, ThreeD } gnss = Gnss::None; // None: GNSS off (Q61) + int gnssSatellites = 0; // used in the Fix bool operator==(const StatusInfo& o) const { return title == o.title && batteryPercent == o.batteryPercent && clock == o.clock && sdPresent == o.sdPresent && sdLevel == o.sdLevel && compose == o.compose && wifi == o.wifi && - wifiBars == o.wifiBars && unread == o.unread; + wifiBars == o.wifiBars && unread == o.unread && gnss == o.gnss && gnssSatellites == o.gnssSatellites; } bool operator!=(const StatusInfo& o) const { return !(*this == o); } };