* Properly format timestamp in log message
* Better formatting of GPS_DEBUG logging in gps probe
* Reset GPS after serial speed change, and look for magic string to identify chip
* Add UC6580 to boot message detection, for Heltec Tracker
* Add L76K detect from boot string, for Heltec-v4
* Slightly more useful GPS debugging
* Back out detection of L76K via startup messages.
* Ignore PIN_GPS_RESET = -1 and rename passive_detect array.
---------
Co-authored-by: Tom Fifield <tom@tomfifield.net>
8 months ago, when this was added to the code, the GPS probe code
was still a little flaky.
Particularly after #6114 and #6116 were added, reliability improved
for all devices as we were sending fewer calls on the bus.
Today, the T1000E is the only Meshtastic device that regularly takes
2, 3, or 4 attempts to be detected via the probe code.
Removing these lines, on my T1000E, results in the AG3335 being
detected immediately.
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Wait until after GPS lock hold before updating position, if we can.
After the recent patch, we hold lock for a bit before updating the position.
The positions that come in after the hold are genuinely better positions
than what we've been doing before. However, they only come 20 seconds
after we've got lock.
Previously, we would update the local position as soon as we got a lock as well
as at the end of the hold, since a hold was not always possible.
With this patch, if the settings allow, we should skip that first local position update.
Fixes https://github.com/meshtastic/firmware/issues/8029
* Fix falling edge handling.
* spelling
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Congeal lock handling
* Add named constants
* define unit to avoid confusion
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* ifdef, not if.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add handling for when we first turn on.
* Don't run if not active
* Reset fixhold
* Logic fixes
* Add path for ACTIVE--> IDLE --> ACTIVE
Previously we only covered HARDSLEEP --> ACTIVE.
* Change hold time to gps_update_interval - 10s
* Update comment
* Add extra buffer to avoid re-starting hold
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Do slightly better at threading the search for GPS hardware
* Formatting and minor logic fix
* Remove now-spam GPS Log messages
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Add a new GPS model CM121.
* Add CM121 to Unicore.
* Trunk fixes, remove unneded NMEA lines
---------
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Start portduino_config refactor
* refactor GPIOs to new portduino_config
* More portduino_config work
* More conversion to portduino_config
* Finish portduino_config transition
* trunk
* yaml output work
* Simplify the GPIO config
* Trunk
* Scale probe buffer size based on current baud rate
* Throttle bad time validation logging and fix time comparison logic
* Remove comment
* Missed the other instances
* Copy pasta
Further to https://github.com/meshtastic/firmware/pull/7897 ,
there was another log line that was triggering indiscriminantly on
GPS_INTERVAL_THRESHOLD .
Rather than logging a bad time 4000 times, let's just log one good time
when it is set.
* Hold for >20s after GPS lock
GPS chips are designed to stay locked for a while to download some data and save it.
This data is important for speeding up future locks, and making them higher quality.
Our present configuration could make every lock perform similar to first lock.
This patch sets a hold of between 20s and 10% of the lock search time after lock
is acquired. This should allow the GPS to finish its work before we turn it off.
Fixes https://github.com/meshtastic/firmware/issues/7466
* Remove T1000E-specific GPS holds
The new code does the same thing, for all devices.
* Fix publishing settings
* Cleanups, removing unused variables.
* ifdef log line with GPS_DEBUG
* fixQual is not a bool.
There are certain GPS chips that have a hard-coded time in firmware
that they will return before lock. We set our own hard-coded time,
BUILD_EPOCH, that should be newer and use the comparison to not set
a bad time.
In https://github.com/meshtastic/firmware/pull/7261 we introduced
the RTCSetResult and improved it in https://github.com/meshtastic/firmware/pull/7375 .
However, the original try-fix left logic in GPS.cpp that could
still result in broadcasting the bad time.
Further, as part of our fix we cleared the GPS buffer if we didn't
get a good time. The mesh was hurting at the time, so this was a reasonable
approach. However, given time tends to come in when we're trying to get
early lock, this had the potential side effect of throwing away valuable
information to get position lock.
This change reverses the clearBuffer and changes the logic so if time
is not set it will not be broadcast.
Fixes https://github.com/meshtastic/firmware/issues/7771
Fixes https://github.com/meshtastic/firmware/issues/7750
TinyGPS Fix Quality has this information:
0 - fix not available,
1 - GPS fix,
2 - Differential GPS fix (values above 2 are 2.3 features)
3 = PPS fix
4 = Real Time Kinematic
5 = Float RTK
6 = estimated (dead reckoning)
7 = Manual input mode
8 = Simulation mode
the previous Airoha code would allow quality >0 , which includes
estimated positions. These wouldn't be passed through to the mesh
due to other checks, but would affect the Airoha GPS_FIX_HOLD_TIME
calculations.
Changes the calculation to 1 >= quality <=5 .
As determined by @b8b8 , enabling NAVIC meant the more modern L5 GPS
signal was not used (L1 GPS is always available).
NAVIC, India's GNSS, probably provides the best coverage in India and
the neighbouring region. However, outside of NAVIC's coverage area, L5
GPS is highly desirable.
This patch amends the AG3335-family GPS configuration to enable L5 GPS
coverage by default. If the Lora region is set to India or Nepal,
NAVIC will be enabled instead.
* Enable GPS for Wio-E5 variant on Serial2
* Add ability to override GPS serial port using GPS_SERIAL_PORT, and make RAK2560 use it.
* Don't try to send ATAK packets if ATAK is disabled, +4k flash
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>