touch: the T-Deck and the M9 find their GPS speed (Auto)

T-Deck Plus receivers talk 38400 or 9600 depending on the unit, and newer
ThinkNode M9s 115200, so owners had to find Settings > GPS > Serial speed.
Both boards now build their GPS on WadaNmeaLocationProvider with the UART
probe the Pager, T-Deck Pro and P4 use: it tries 9600, 19200, 38400, 57600
and 115200 until a sentence with a valid checksum arrives, and locks there.

Unlike those boards it runs only while the user has not picked a speed
(CAP_GPS_BAUD_FIND): Serial speed gets an Auto tile, the default, and a picked
speed is used as it is. The speed Auto finds is kept in its own NVS key
(gps_bd_fd), apart from the user's choice and outside the settings blob, so
an older firmware never reads it as a choice; touchPrefsGetGpsBaud returns it
when nothing is picked, so the core opens the UART at the right speed on the
next start. It is written once per change of receiver, from the loop task.

The T-Deck also gets the provider's u-blox GNSS stop/start while GPS rests
(it has no enable line); receivers that do not speak UBX ignore it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaj SchittecatandClaude Opus 5.5 committed 2026-10-26 11:45:09 +01:00
1 parent 3864292cd9
commit 32533c45dc
24 files changed
+11472 -11367

No files matched your search

+2 -1
View File
@@ -1690,7 +1690,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2183,3 +2182,5 @@ Powering off… press reset to wake Изключване… натиснете r
Low Low
F11 on the keyboard steps through these too. Клавишът F11 на клавиатурата също превключва тези нива.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Авто
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart.
+2 -1
View File
@@ -1707,7 +1707,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2199,3 +2198,5 @@ Powering off… press reset to wake Vypínání… probudíte stisknutím reset
Low Low
F11 on the keyboard steps through these too. Klávesa F11 na klávesnici přepíná tyto úrovně také.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Auto
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart.
+2 -1
View File
@@ -1686,7 +1686,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2181,3 +2180,5 @@ Powering off… press reset to wake Schaltet aus… Reset drücken zum Aufwecken
Low Low
F11 on the keyboard steps through these too. F11 auf der Tastatur schaltet ebenfalls durch diese Stufen.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Auto
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto probiert die üblichen Geschwindigkeiten, bis das GPS antwortet, und behält die, die funktioniert. Nur eine Geschwindigkeit wählen, wenn Auto keine findet. Gilt nach einem Neustart.
+2 -1
View File
@@ -1690,7 +1690,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2183,3 +2182,5 @@ Powering off… press reset to wake Απενεργοποίηση… πατήστ
Low Low
F11 on the keyboard steps through these too. Το F11 στο πληκτρολόγιο εναλλάσσει επίσης αυτά τα επίπεδα.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Αυτόματα
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart.
+2 -1
View File
@@ -1690,7 +1690,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2183,3 +2182,5 @@ Powering off… press reset to wake Apagando… pulsa reset para despertar
Low Low
F11 on the keyboard steps through these too. F11 en el teclado también recorre estos niveles.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Auto
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto prueba las velocidades habituales hasta que el GPS responde y se queda con la que funciona. Elegir una velocidad solo si Auto no la encuentra. Se aplica tras reiniciar.
+2 -1
View File
@@ -1689,7 +1689,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2182,3 +2181,5 @@ Powering off… press reset to wake Extinction… appuyez sur reset pour réveil
Low Low
F11 on the keyboard steps through these too. F11 sur le clavier parcourt aussi ces niveaux.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Auto
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto essaie les vitesses courantes jusqu'à ce que le GPS réponde et garde celle qui fonctionne. Choisir une vitesse seulement si Auto n'en trouve pas. S'applique après un redémarrage.
+2 -1
View File
@@ -1701,7 +1701,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2193,3 +2192,5 @@ Powering off… press reset to wake Kikapcsolás… az ébresztéshez nyomja meg
Low Low
F11 on the keyboard steps through these too. A billentyűzet F11 gombja is végiglépked ezeken.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Auto
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart.
+2 -1
View File
@@ -1689,7 +1689,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2182,3 +2181,5 @@ Powering off… press reset to wake Spegnimento… premi reset per riattivare
Low Low
F11 on the keyboard steps through these too. Anche F11 sulla tastiera scorre questi livelli.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Auto
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto prova le velocità comuni finché il GPS risponde e tiene quella che funziona. Scegliere una velocità solo se Auto non la trova. Vale dopo un riavvio.
+2 -1
View File
@@ -1687,7 +1687,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2181,3 +2180,5 @@ Powering off… press reset to wake Uitschakelen… druk op reset om te wekken
Low Low
F11 on the keyboard steps through these too. F11 op het toetsenbord loopt hier ook doorheen.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Auto
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto probeert de gangbare snelheden tot de GPS antwoordt en houdt de snelheid die werkt. Kies alleen een snelheid als Auto er geen vindt. Geldt na een herstart.
+2 -1
View File
@@ -1707,7 +1707,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2195,3 +2194,5 @@ Powering off… press reset to wake Powering off… press reset to wake
Low Low
F11 on the keyboard steps through these too. F11 on the keyboard steps through these too.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Auto
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart.
+2 -1
View File
@@ -1689,7 +1689,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2183,3 +2182,5 @@ Powering off… press reset to wake Desligando… pressione reset para acordar
Low Low
F11 on the keyboard steps through these too. F11 no teclado também alterna entre estes níveis.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Auto
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto testa as velocidades comuns até o GPS responder e fica com a que funciona. Escolha uma velocidade só se o Auto não encontrar. Vale após reiniciar.
+2 -1
View File
@@ -1691,7 +1691,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2184,3 +2183,5 @@ Powering off… press reset to wake Se opreşte… apasă reset pentru trezire
Low Low
F11 on the keyboard steps through these too. Tasta F11 de pe tastatură trece și ea prin aceste niveluri.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Auto
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart.
+2 -1
View File
@@ -1690,7 +1690,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2183,3 +2182,5 @@ Powering off… press reset to wake Выключение… нажмите reset
Low Low
F11 on the keyboard steps through these too. Клавиша F11 на клавиатуре тоже переключает эти уровни.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Авто
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart.
+2 -1
View File
@@ -1690,7 +1690,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2183,3 +2182,5 @@ Powering off… press reset to wake Гашење… притисните reset
Low Low
F11 on the keyboard steps through these too. Тастер F11 на тастатури такође пролази кроз ове нивое.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Ауто
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart.
+2 -1
View File
@@ -1690,7 +1690,6 @@ Text console Text console
Text size Text size
Text size saved, restarting to apply it… Text size saved, restarting to apply it…
The MQTT bridge is not in this build. The MQTT bridge is not in this build.
The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart. The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.
The arrows and Enter always work. These letters are extra: tap a row, then press a key. The arrows and Enter always work. These letters are extra: tap a row, then press a key.
The tab keys, over the navigation bar's icons. The tab keys, over the navigation bar's icons.
The touchscreen ignores taps until you unlock. The touchscreen ignores taps until you unlock.
@@ -2183,3 +2182,5 @@ Powering off… press reset to wake Вимкнення… натисніть res
Low Low
F11 on the keyboard steps through these too. Клавіша F11 на клавіатурі теж перемикає ці рівні.
Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again. Wi-Fi was switched off because the device crashed while it was on. Turn it on in Settings > Wi-Fi to try again.
Auto Авто
Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart. Auto tries the common speeds until the GPS answers and keeps the one that works. Pick a speed only if Auto does not find it. Applies after a restart.
+14 -5
View File
@@ -54,6 +54,10 @@ class WadaNmeaLocationProvider : public LocationProvider {
uint32_t _active_baud = 0;
uint32_t _probe_deadline_ms = 0;
bool _stream_locked = false;
// Probe only while the user has not picked a speed, and keep what it finds apart
// from that choice (CAP_GPS_BAUD_FIND boards). Off: the probe always runs and the
// speed it finds becomes the setting (CAP_GPS_BAUD_AUTO boards).
bool _keep_choice = false;
bool _ubx_standby = false; // rest in software standby (setUbxStandby)
uint8_t _wake_tries = 0;
uint32_t _wake_check_ms = 0; // when begin() looks for the stream again (0: not waiting)
@@ -119,8 +123,10 @@ class WadaNmeaLocationProvider : public LocationProvider {
if (!_probe_serial || _stream_locked) return;
_stream_locked = true;
_probe_deadline_ms = 0;
if (touchPrefsGetGpsBaud(_probe_default_baud) != _active_baud)
(void)touchPrefsSetGpsBaud(_active_baud);
if (touchPrefsGetGpsBaud(_probe_default_baud) == _active_baud) return;
// One write per change of receiver, from the loop task (a valid sentence, not input).
if (_keep_choice) touchPrefsSetGpsBaudFound(_active_baud);
else (void)touchPrefsSetGpsBaud(_active_baud);
}
public:
@@ -151,8 +157,9 @@ public:
WadaNmeaLocationProvider(HardwareSerial& ser, mesh::RTCClock* clock,
int pin_reset, int pin_en, int serial_rx, int serial_tx,
uint32_t default_baud)
uint32_t default_baud, bool keep_choice = false)
: WadaNmeaLocationProvider(static_cast<Stream&>(ser), clock, pin_reset, pin_en) {
_keep_choice = keep_choice;
_probe_serial = &ser;
_probe_rx = (int8_t)serial_rx;
_probe_tx = (int8_t)serial_tx;
@@ -195,8 +202,10 @@ public:
if (_probe_serial) {
_active_baud = touchPrefsGetGpsBaud(_probe_default_baud);
_probe_cursor = 0;
_stream_locked = false;
_probe_deadline_ms = millis() + BAUD_PROBE_START_MS;
// A speed the user picked is used as it is: no probe, nothing saved.
const bool probe = !(_keep_choice && touchPrefsGpsBaudChosen());
_stream_locked = !probe;
_probe_deadline_ms = probe ? millis() + BAUD_PROBE_START_MS : 0;
nudgeReceiver();
}
ubxGnss(true);
+23 -3
View File
@@ -2885,11 +2885,31 @@ bool touchPrefsSetSetupDone(bool done) {
return ok;
}
// The speed the GPS probe last locked on while the user had not picked one. Its own
// key, outside the settings blob, so an older firmware never reads it as a choice.
static const char* LK_GPS_BAUD_FOUND = "gps_bd_fd";
static bool gpsBaudSane(uint32_t baud) { return baud >= 4800 && baud <= 921600; }
uint32_t touchPrefsGetGpsBaud(uint32_t fallback) {
if (!s_begun) touchPrefsBegin();
// 0 = never set -> caller's compile-time default. A real configured baud is
// always non-zero, so this preserves the old "absent key -> fallback" result.
return s_cfg.gps_baud != 0 ? s_cfg.gps_baud : fallback;
// 0 = never set -> the speed the probe found, else the caller's compile-time
// default. A real configured baud is always non-zero, so this preserves the
// old "absent key -> fallback" result where nothing was ever found.
if (s_cfg.gps_baud != 0) return s_cfg.gps_baud;
const uint32_t found = s_prefs.isKey(LK_GPS_BAUD_FOUND) ? s_prefs.getUInt(LK_GPS_BAUD_FOUND, 0) : 0;
return gpsBaudSane(found) ? found : fallback;
}
bool touchPrefsGpsBaudChosen() {
if (!s_begun) touchPrefsBegin();
return s_cfg.gps_baud != 0;
}
void touchPrefsSetGpsBaudFound(uint32_t baud) {
if (!s_begun) touchPrefsBegin();
if (!gpsBaudSane(baud)) return;
if (s_prefs.isKey(LK_GPS_BAUD_FOUND) && s_prefs.getUInt(LK_GPS_BAUD_FOUND, 0) == baud) return;
prefsPutUInt(LK_GPS_BAUD_FOUND, baud);
}
bool touchPrefsSetGpsBaud(uint32_t baud) {
+7 -1
View File
@@ -777,7 +777,13 @@ bool touchPrefsSetSetupDone(bool done);
* override lets the user match their hardware without a rebuild. Read at GPS
* init; `fallback` is the compile-time default. Applied on reboot. */
uint32_t touchPrefsGetGpsBaud(uint32_t fallback);
bool touchPrefsSetGpsBaud(uint32_t baud);
bool touchPrefsSetGpsBaud(uint32_t baud); // 0 = no choice ("Auto")
/** Whether the user picked a speed (touchPrefsSetGpsBaud with a non-zero baud). */
bool touchPrefsGpsBaudChosen();
/** The speed the probe locked on while nothing was picked (CAP_GPS_BAUD_FIND
* boards). touchPrefsGetGpsBaud returns it when there is no choice, so the next
* start opens the UART at the right speed. Written only when it changes. */
void touchPrefsSetGpsBaudFound(uint32_t baud);
/** Mesh signal auto-discover probe. When ON (default), the firmware periodically
* sends a flood advert so nearby repeaters re-broadcast it and we can measure
+13 -4
View File
@@ -18245,8 +18245,14 @@ static void buildDisplayPage() {
static void gpsBaudPickCb(lv_event_t* e) {
if (lv_event_get_code(e) != LV_EVENT_CLICKED) return;
const int i = setChoiceIndex(e);
#if CAP_GPS_BAUD_FIND
// Tile 0 is Auto: no choice, so the probe finds the speed (0 clears the choice).
if (i < 0 || i > kGpsBaudCount) return;
touchPrefsSetGpsBaud(i == 0 ? 0 : kGpsBaudOpts[i - 1]);
#else
if (i < 0 || i >= kGpsBaudCount) return;
touchPrefsSetGpsBaud(kGpsBaudOpts[i]);
#endif
setChoicePick(lv_obj_get_parent(lv_event_get_current_target(e)), i);
if (g_lv.task) g_lv.task->showAlert(TR("Applies after a restart."), 1600);
}
@@ -18315,15 +18321,18 @@ static void buildGpsPage() {
#endif
int picked = 0;
for (int i = 0; i < kGpsBaudCount; i++) if (kGpsBaudOpts[i] == cur) { picked = i; break; }
#if CAP_GPS_BAUD_FIND
const char* bauds[] = { TR("Auto"), "9600", "19200", "38400", "57600", "115200" };
setChoiceRow(c, "Serial speed", "Auto tries the common speeds until the GPS answers and keeps the one that "
"works. Pick a speed only if Auto does not find it. Applies after a restart.",
bauds, kGpsBaudCount + 1, touchPrefsGpsBaudChosen() ? picked + 1 : 0, gpsBaudPickCb);
#elif CAP_GPS_BAUD_AUTO
const char* bauds[] = { "9600", "19200", "38400", "57600", "115200" };
#if CAP_GPS_BAUD_AUTO
setChoiceRow(c, "Serial speed", "Found automatically: when the GPS does not answer at this speed, the device "
"tries the others and keeps the one that works. This is where it starts.",
bauds, kGpsBaudCount, picked, gpsBaudPickCb);
#elif defined(HAS_TDECK_GT911) && !defined(HAS_TDECK_PRO)
setChoiceRow(c, "Serial speed", "The T-Deck Plus uses 38400, the T-Deck 1.0 9600. Applies after a restart.",
bauds, kGpsBaudCount, picked, gpsBaudPickCb);
#else
const char* bauds[] = { "9600", "19200", "38400", "57600", "115200" };
setChoiceRow(c, "Serial speed", "The speed your GPS module talks at. Applies after a restart.",
bauds, kGpsBaudCount, picked, gpsBaudPickCb);
#endif
+11
View File
@@ -409,6 +409,17 @@
#define CAP_GPS_BAUD_AUTO 0
#endif
// The same probe, but only while the user has not picked a speed (Settings > GPS >
// Serial speed > Auto, the default): the T-Deck Plus GPS talks 38400 or 9600
// depending on the unit, newer ThinkNode M9s 115200. The speed it locks on is kept
// apart from the user's choice (touchPrefsSetGpsBaudFound), and a picked speed is
// used as it is, never probed past.
#if (defined(HAS_TDECK_GT911) && !defined(HAS_TDECK_PRO)) || defined(HAS_THINKNODE_M9)
#define CAP_GPS_BAUD_FIND 1
#else
#define CAP_GPS_BAUD_FIND 0
#endif
// A switchable LoRa antenna: an on-board antenna plus an external socket, picked at
// run time (T-Display P4: SKY13453 on XL9535 IO1). Gates the Radio settings antenna
// rows, the "Always use the external antenna" boot option and the control panel
+11362 -11336
View File
File diff suppressed because it is too large. Load diff
+6 -1
View File
@@ -28,7 +28,12 @@ ESP32RTCClock fallback_clock;
// without the module behaves exactly as before.
HardwareRtcClock hw_rtc(fallback_clock);
ClockFloorRTC rtc_clock(hw_rtc);
MicroNMEALocationProvider gps(Serial1, &rtc_clock);
// Wadamesh's provider for its UART probe: T-Deck Plus receivers talk 38400 or 9600
// depending on the unit, so the speed is found while the user has not picked one in
// Settings (CAP_GPS_BAUD_FIND). No enable or reset line on this board; the ESP
// receives on PIN_GPS_TX (the core's naming).
WadaNmeaLocationProvider gps(Serial1, &rtc_clock, -1 /*reset*/, -1 /*enable*/,
PIN_GPS_TX, PIN_GPS_RX, GPS_BAUD_RATE, true /*keep_choice*/);
EnvironmentSensorManager sensors(gps);
#ifdef DISPLAY_CLASS
+1 -1
View File
@@ -13,7 +13,7 @@
#include <helpers/ui/MomentaryButton.h>
#endif
#include "helpers/sensors/EnvironmentSensorManager.h"
#include "helpers/sensors/MicroNMEALocationProvider.h"
#include "../../src/helpers/WadaNmeaLocationProvider.h" // the core provider plus the baud probe
extern TDeckBoard board;
extern WRAPPER_CLASS radio_driver;
+5 -1
View File
@@ -37,7 +37,11 @@ ClockFloorRTC rtc_clock(
// Wadamesh's own provider rather than the core's MicroNMEALocationProvider:
// identical behaviour, plus the RMC speed/course the core keeps private (see
// src/helpers/WadaNmeaLocationProvider.h for why it is a copy, not a subclass).
WadaNmeaLocationProvider gps(Serial1, &rtc_clock);
// With the UART probe: M9 receivers ship at 115200 or 9600 depending on the
// revision, so the speed is found while the user has not picked one in Settings
// (CAP_GPS_BAUD_FIND). The ESP receives on PIN_GPS_TX (the core's naming).
WadaNmeaLocationProvider gps(Serial1, &rtc_clock, GPS_RESET, GPS_EN,
PIN_GPS_TX, PIN_GPS_RX, GPS_BAUD_RATE, true /*keep_choice*/);
EnvironmentSensorManager sensors(gps);
#ifdef DISPLAY_CLASS