Skip to content

Commit

Permalink
Be more relaxed in GPS timings
Browse files Browse the repository at this point in the history
- allows support of some variants of GPS modules
  • Loading branch information
amandel committed Dec 6, 2024
1 parent c97a4d2 commit 7b865b9
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/gps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,14 @@ void Gps::sendUbxDirect() {

/* Resets the stored GPS config and stores our config! */
void Gps::configureGpsModule() {
// Clear configuration, RESET TO DEFAULT
const uint8_t UBX_CFG_CFG_CLR[] = {
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFE, 0xFF, 0x00, 0x00, 0x03
};
#ifdef UBX_M10
// It is fairly stupid to reset the config here, as the baud rate will be reset (at least for M10)
//sendUbx(UBX_MSG::CFG_CFG, UBX_CFG_CFG_CLR, sizeof(UBX_CFG_CFG_CLR)); // Newer devices will not answer this request
#endif
#ifdef UBX_M6
sendAndWaitForAck(UBX_MSG::CFG_CFG, UBX_CFG_CFG_CLR, sizeof(UBX_CFG_CFG_CLR));
#endif
handle(300);

log_d("Start CFG");
// The CFG_CFG_CLR caused trouble on newer modules - connection settings get reset.
// no CFG_CFG_CLR for now if this fails we might need more fine-grained
// reset
// const uint8_t UBX_CFG_CFG_CLR[] = {
// 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0xFE, 0xFF, 0x00, 0x00, 0x03
// };
log_i("Start GPS CFG");
#ifdef UBX_M6
// INF messages via UBX only
const uint8_t UBX_CFG_INF_UBX[] = {
Expand Down Expand Up @@ -1286,7 +1279,7 @@ void Gps::handleUbxNavTimeGps(const GpsBuffer::UbxNavTimeGps &message, const uin
mIncomingGpsRecord.setWeek(mLastGpsWeek);
}
if ((message.valid & 0x03) == 0x03 // WEEK && TOW
&& delayMs < 20
&& delayMs < 200 // FIXME: needs to be lower once we have multi GPS versions support 20
&& message.tAcc < (20 * 1000 * 1000 /* 20ms */)
&& (mLastTimeTimeSet == 0
|| (mLastTimeTimeSet + (2 * 60 * 1000 /* 2 minutes */)) < receivedMs)) {
Expand Down

0 comments on commit 7b865b9

Please sign in to comment.