In the GPS probe code we write commands on the serial line and
determine which GPS we have based on the result.
GPS units in the same family sometimes use the same command,
but return different results (eg AG3335 and AG3332 both use $PAIR021*39).
Currently we run the command once per GPS. Instead we should run each
command only once per family, record the result, and select the GNSS MODEL
based on the result, which is what this patch does.
Before the change, we put 12 commands on the serial bus.
Now we only put 6.
This should markedly improve the speed and reliability of GPS detection.
Fixes https://github.com/meshtastic/firmware/issues/5193
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
In 2020 there was a bad batch of tbeams whose ubloxen went a little
loopy. We factory reset them to bring them sane again.
It's now 2025, the problem with tbeam is long fixed, and this is not
necessary for any other devices we're aware of. Removing the function to
make our code more maintainable.
There is an associated protobuf entry did_gps_reset that we might be able
to re-purpose for something else, or remove in 3.0.
Last release a change introduced different branching functions in
gps.cpp based on the model of a device. This makes the code less
readable and introduces the potential for bugs.
This patch creates a new variable, GPS_PROBETRIES that can be set
in variant.h of devices that will control how many times we will
probe for GPS presence. It sets up the T1000-E to use this variable
and cleans the code in gps.c
* GPS.h cleanups round 3.
No effective behavior change.
Protected members can be private so make it so. (Supporting
subclasses needs a lot more work.)
Moves uBloxGnssModelInfo into file scope.
Moves uBloxProtocolVersion into uBloxGnssModelInfo.
Moves baud rate arrays into file scope.
Removes unused/ unimplemented powerStateToString.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Trunk Format.
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Move yet more stuff out of GPS.h and into file scope.
* Protect code macros from eating semicolons.
* Remove unused (and unimplemented) getDOPString.
* clang-format with project style file on affected files.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
https://github.com/meshtastic/firmware/pull/5160 introduced a change
which made first publication of GPS information take up to 15mins.
For that initial period, displays would show "No GPS Present", even
if one was detected.
This change fixes that bug, triggering publication immediately after
a GPS module is detected.
* Optimise GPS Baud Rate cycle
Previously, our baud rate cycled through one list twice.
There were some rarer baudrates in there, so this code
separates out those into a dedicated list that is only
run through if detection fails for common bauds. We also
only run through each baud rate once.
* Fix first time around bug
Would have always reset GPS baudrate every time.
* Add support for fixing GPS_BAUDRATE
If GPS_BAUDRATE is set in variant.h, the deployer knows something we
don't about the GPS. Used especially when the GPS is soldered to a board
in a commercial product :) If we see that, we don't try other baud rates
at all.
* Don't print blank lines in GPS_DEBUG.
* Try GPS_BAUDRATE first, not only.
* Fix spelling mistakes in comments
* Only use GPS_BAUDRATE if specified in variant.h
* Modify RareSerial Speeds based on FIXED or not.
After the recent change to move logging line breaks to a central
location, GPS_DEBUG is now emitting one character per line,
making the logs unusable.
Patch uses local strings and appends to collate and then print
in the right places.
Fixes https://github.com/meshtastic/firmware/issues/5099
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Triple Press on buttons toggles GPS enable/disable.
This enhancement plays a triple-beep so that users of devices with buzzers can get audible feedback about whether they have turned the GPS off or on. This is especially valuable for screenless devices such as the T1000E where it may not be immediately obvious the GPS has been disabled.
remove newline from logging statements in code. The LOG_* functions will now magically add it at the end.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Recently there have been reports of intermittent difficulties
detecting U-Blox chips. This patch proposes a new approach that should
be more reliable.
Previously we were fighting with NMEA messages to try and send binary
commands. We unusually also tried changing the Baud rate of U-Blox
chips, something we don't do with any other GPS.
It turns out U-Blox has another method to disable NMEA
messages. PUBX,40 is a text-based command, supported on all the
U-Blox versions we care about that can set the rate of NMEA messages
to zero.
This is what we attempt to do with all other GPS and it works quite
well.
So this patch alters the probe code to:
1. Remove UBX binary code to stop NMEA messages
2. Remove code that tries to reset UBX chips to 9600 baud
3. Add UBX proprietary text commands messages to stop the NMEA flood
4. Improve log strings sent to the user.
Tested on Ublox 6, Ublox 9, and Ublox 10 on multiple devices.
Also tested on several devices with
non-Ublox GPS to ensure it does not interfere with their detection
(heltec-wireless-tracker, wio-tracker-wm11110)
@allanmac noted we were not enabling QZSS on the UC6580.
QZSS is an augmentation service that runs on the same frequency
as GPS, so turning it on should not have any impact on usage other
than improving performance for users in the Asia Pacific.
Fixes https://github.com/meshtastic/firmware/issues/5009
* * Adding the -Wcast-align compilation flag for
the rp2040.
* * Some rework to use a struct to access radio data
* Buffer will not be accessed by arithmetic pointer anymore
* * Remplace arithmetic pointer to avoid Warning
* * Avoid 2 little artitmetic pointer
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
There is no EXTINT pin available on the Tdeck, which uses
the Ublox M10 GPS. Therefore our previous hack to use that pin
makes the GPS not work. That workaround was implemented to
fix sleep issues which have now since been fixed with the
state machine.
This patch restores the state prior to the hack, which is
known-working.
Additionaly, it was discovered that M10s hate it when you
try and save to non-extistent eeprom/SPI flash.
This patch creates a new SAVE command for the M10 that fixes
this issue.
Many thanks to @MisterC925 whose report and testing was
essential for this fix.
fixes https://github.com/meshtastic/firmware/issues/4625
Co-authored-by: Ken McGuire <kenm@paonia.com>
* Refactor and consolidate windowing logic
* Trunk
* Fixes
* More
* Fix braces and remove unused now variables.
There was a brace in src/mesh/RadioLibInterface.cpp that was breaking
compile on some architectures.
Additionally, there were some brace errors in
src/modules/Telemetry/AirQualityTelemetry.cpp
src/modules/Telemetry/EnvironmentTelemetry.cpp
src/mesh/wifi/WiFiAPClient.cpp
Move throttle include in WifiAPClient.cpp to top.
Add Default.h to sleep.cpp
rest of files just remove unused now variables.
* Remove a couple more meows
---------
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Simplify Ublox code
Ublox comes in a myriad of versions and settings. Presently our
configuration code does a lot of branching based on versions being
or not being present.
This patch adds version detection earlier in the piece and branches
on the set gnssModel instead to create separate setup methods for Ublox 6,
Ublox 7/8/9, and Ublox10.
Additionally, adds a macro to make the code much shorter and more
readable.
* Make trunk happy
* Make trunk happy
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
As discovered and tested by @Mictronics, default Serial FIFO size
on the Pico is 32bytes, which is not enough for GPS messages.
This patch increases the Serial GPS FIFO buffer size to 256
for the RP2040 Architecture
fixes https://github.com/meshtastic/firmware/issues/3989
This getACK is used to look for ASCII responses, so print ASCII
when GPS_DEBUG is enabled.
This markedly assisted with recent AG3335 debugging. It works great
with other chips too (tested eg ATGM336H). Even UBLOX prints
understandable "GPTXT,01,01,01,PDTI inv format*35." responses.
Credit to bluebrolly. on discord.
At the moment if the result of sleepTime calculations comes out
to zero, we put the GPS into HARDSLEEP (losing all its status) and
then immediately make it ACTIVE again.
This patch avoids that toga.
fixes https://github.com/meshtastic/firmware/issues/4657
AG33352 is a Mediatek/Airoha GPS/GLONASS/Galileo/BeiDou receiver.
Patch adds relevant detection and setup code.
Thanks to Bluebrolly and kongduino for providing the relevant
information and testing.
This patch also fixes support for the A3335, which is a related chip.
The setup and detection code now works as tested on a real life
T-1000E!
Thanks to @gpsfan for the guidance.
This patch takes inspiration from our I2CDetect code where we have
many sensors that can be detected rather simply. It creates a new
macro,
PROBE_SIMPLE(Chip name, Command to run, response, Driver, timeout)
and converts existing simple cases to use this macro.