mirror of
https://github.com/ratspeak/ratdeck.git
synced 2026-10-16 14:40:02 +00:00
GPS time sync, status bar clock, configurable UTC offset
- Enable UBlox MIA-M10Q GPS on T-Deck Plus (HAS_GPS true) - Custom zero-dependency NMEA parser (NMEAParser.h) with XOR checksum - GPSManager: baud auto-detect (115200/38400/9600, 10s timeout), settimeofday() sync every 60s, NVS time/position persistence - GPS Time enabled by default, GPS Location disabled by default (user must explicitly opt in via Settings) - Replace status bar connectivity bars with clock display (top-left) - Default 12h format without AM/PM, configurable 24h in Settings - Add GPS/Time settings category: GPS Time, GPS Location, UTC Offset (-12 to +14), 24h Time toggle - Fix hardcoded UTC-5 NTP timezone to use configurable utcOffset - Change status bar brand text to "Ratspeak.org"
This commit is contained in:
@@ -368,6 +368,37 @@ void LvSettingsScreen::buildItems() {
|
||||
return String(modes[constrain((int)s.wifiMode, 0, 2)]);
|
||||
}});
|
||||
|
||||
// GPS & Time
|
||||
int gpsStart = idx;
|
||||
#if HAS_GPS
|
||||
_items.push_back({"GPS Time", SettingType::TOGGLE,
|
||||
[&s]() { return s.gpsTimeEnabled ? 1 : 0; },
|
||||
[&s](int v) { s.gpsTimeEnabled = (v != 0); },
|
||||
[](int v) { return v ? String("ON") : String("OFF"); }});
|
||||
idx++;
|
||||
_items.push_back({"GPS Location", SettingType::TOGGLE,
|
||||
[&s]() { return s.gpsLocationEnabled ? 1 : 0; },
|
||||
[&s](int v) { s.gpsLocationEnabled = (v != 0); },
|
||||
[](int v) { return v ? String("ON") : String("OFF"); }});
|
||||
idx++;
|
||||
#endif
|
||||
_items.push_back({"UTC Offset", SettingType::INTEGER,
|
||||
[&s]() { return (int)s.utcOffset; }, [&s](int v) { s.utcOffset = (int8_t)v; },
|
||||
[](int v) { char buf[8]; snprintf(buf, sizeof(buf), "UTC%+d", v); return String(buf); },
|
||||
-12, 14, 1});
|
||||
idx++;
|
||||
_items.push_back({"24h Time", SettingType::TOGGLE,
|
||||
[&s]() { return s.use24HourTime ? 1 : 0; },
|
||||
[&s](int v) { s.use24HourTime = (v != 0); },
|
||||
[](int v) { return v ? String("ON") : String("OFF"); }});
|
||||
idx++;
|
||||
_categories.push_back({"GPS/Time", gpsStart, idx - gpsStart,
|
||||
[&s]() {
|
||||
char buf[16];
|
||||
snprintf(buf, sizeof(buf), "UTC%+d", s.utcOffset);
|
||||
return String(buf);
|
||||
}});
|
||||
|
||||
// Audio
|
||||
int audioStart = idx;
|
||||
_items.push_back({"Audio", SettingType::TOGGLE,
|
||||
@@ -1133,6 +1164,7 @@ void LvSettingsScreen::snapshotRebootSettings() {
|
||||
_rebootSnap.wifiSTASSID = s.wifiSTASSID;
|
||||
_rebootSnap.wifiSTAPassword = s.wifiSTAPassword;
|
||||
_rebootSnap.bleEnabled = s.bleEnabled;
|
||||
_gpsSnapEnabled = s.gpsTimeEnabled;
|
||||
}
|
||||
|
||||
bool LvSettingsScreen::rebootSettingsChanged() const {
|
||||
@@ -1195,6 +1227,12 @@ void LvSettingsScreen::applyAndSave() {
|
||||
if (_tcpChangeCb) _tcpChangeCb();
|
||||
}
|
||||
|
||||
// Apply GPS toggle live (start/stop GPS UART)
|
||||
if (s.gpsTimeEnabled != _gpsSnapEnabled) {
|
||||
_gpsSnapEnabled = s.gpsTimeEnabled;
|
||||
if (_gpsChangeCb) _gpsChangeCb(s.gpsTimeEnabled);
|
||||
}
|
||||
|
||||
// Check if reboot-required settings changed
|
||||
if (rebootSettingsChanged()) {
|
||||
_rebootNeeded = true;
|
||||
|
||||
Reference in New Issue
Block a user