Compare commits

...

3 Commits

Author SHA1 Message Date
Tom Fifield
a802c38e1a
Merge 6304bec41e into 5d48d2c0a7 2025-04-20 13:55:59 +02:00
Ben Meadors
6304bec41e
Merge branch 'master' into stationary-gps 2025-04-19 04:59:04 -05:00
Tom Fifield
fc9fad0359 [WIP] Set GPS to stationary mode when fixed position is enabled
untested WIP - this code may never run, need to check where GPS setup
bails out due to fixed_position config.

As repoted by @RCGV1, some GPS chips have a "stationary" mode,
which assumes acceleration and velocity are zero. For fixed nodes,
taking advantage of this configuration means potentially less power
usage, and a more accurate position that doesn't jitter its way around
the map. (See also: https://github.com/meshtastic/firmware/issues/3984 )

The aim would be to enable this mode when users have a GPS enabled and
select "Fixed Position" without specifying coordinates. UX TBD!

Fixes https://github.com/meshtastic/firmware/issues/6627
2025-04-19 13:08:58 +10:00

View File

@ -547,8 +547,13 @@ bool GPS::setup()
// only ask for RMC and GGA
_serial_gps->write("$PCAS03,1,0,0,0,1,0,0,0,0,0,,,0,0*02\r\n");
delay(250);
// Switch to Vehicle Mode, since SoftRF enables Aviation < 2g
_serial_gps->write("$PCAS11,3*1E\r\n");
if (config.position.fixed_position == true) {
// Set to stationary mode, which reduces jitter and may save power
_serial_gps->write("$PCAS11,1*1C\r\n");
} else {
// Switch to Vehicle Mode, since SoftRF enables Aviation < 2g
_serial_gps->write("$PCAS11,3*1E\r\n");
}
delay(250);
} else if (gnssModel == GNSS_MODEL_MTK_L76B) {
// Waveshare Pico-GPS hat uses the L76B with 9600 baud
@ -567,8 +572,13 @@ bool GPS::setup()
// Enable PPS for 2D/3D fix only
_serial_gps->write("$PMTK285,3,100*3F\r\n");
delay(250);
// Switch to Fitness Mode, for running and walking purpose with low speed (<5 m/s)
_serial_gps->write("$PMTK886,1*29\r\n");
if (config.position.fixed_position == true) {
// Set to stationary mode, which reduces jitter and may save power
_serial_gps->write("$PMTK886,4*2C\r\n");
} else {
// Switch to Fitness Mode, for running and walking purpose with low speed (<5 m/s)
_serial_gps->write("$PMTK886,1*29\r\n");
}
delay(250);
} else if (gnssModel == GNSS_MODEL_MTK_PA1616S) {
// PA1616S is used in some GPS breakout boards from Adafruit
@ -584,7 +594,16 @@ bool GPS::setup()
delay(250);
} else if (gnssModel == GNSS_MODEL_ATGM336H) {
// Set the intial configuration of the device - these _should_ work for most AT6558 devices
msglen = makeCASPacket(0x06, 0x07, sizeof(_message_CAS_CFG_NAVX_CONF), _message_CAS_CFG_NAVX_CONF);
if (config.position.fixed_position == true) {
// Set to stationary mode, which reduces jitter and may save power
uint8_t temp_NAVX_CONF[sizeof(_message_CAS_CFG_NAVX_CONF)];
memcpy(temp_NAVX_CONF, _message_CAS_CFG_NAVX_CONF, sizeof(_message_CAS_CFG_NAVX_CONF));
temp_NAVX_CONF[4] = 0x01;
msglen = makeCASPacket(0x06, 0x07, sizeof(temp_NAVX_CONF), temp_NAVX_CONF);
} else {
// regular config, which uses automotive mode
msglen = makeCASPacket(0x06, 0x07, sizeof(_message_CAS_CFG_NAVX_CONF), _message_CAS_CFG_NAVX_CONF);
}
_serial_gps->write(UBXscratch, msglen);
if (getACKCas(0x06, 0x07, 250) != GNSS_RESPONSE_OK) {
LOG_WARN("ATGM336H: Could not set Config");
@ -641,6 +660,14 @@ bool GPS::setup()
_serial_gps->write("$PAIR062,5,0*3B\r\n"); // VTG OFF
_serial_gps->write("$PAIR062,6,0*38\r\n"); // ZDA ON
delay(250);
if (config.position.fixed_position == true) {
// Set to stationary mode, which reduces jitter and may save power
_serial_gps->write("$PAIR080,4*2A\r\n");
} else {
// Switch to Fitness Mode, for running and walking purpose with low speed (<5 m/s)
_serial_gps->write("$PAIR080,1*2F\r\n");
}
delay(250);
_serial_gps->write("$PAIR513*3D\r\n"); // save configuration
} else if (gnssModel == GNSS_MODEL_UBLOX6) {