Skip to content

Commit

Permalink
Automatic force to set UTC time grid of ublox is now stopped after 4 …
Browse files Browse the repository at this point in the history
…attempts to prevent endless loop. This could happen for older ublox devices which know only GPS time grid (I don't that any of these exist, but better safe than sorry)
  • Loading branch information
hangeza committed Sep 22, 2020
1 parent 6f70af5 commit 8286445
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions muondetector-daemon/src/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2046,20 +2046,23 @@ void Daemon::onUBXReceivedGnssConfig(uint8_t numTrkCh, const std::vector<GnssCon
}

void Daemon::onUBXReceivedTP5(const UbxTimePulseStruct& tp) {
static uint8_t forceUtcSetCounter = 0;
if (verbose > 3) {
// put some verbose output here
}
TcpMessage tcpMessage(TCP_MSG_KEY::MSG_UBX_CFG_TP5);
(*tcpMessage.dStream) << tp;
emit sendTcpMessage(tcpMessage);
// check here if UTC is selected as time source
// this should probably implemented somewhere else, maybe at ublox init
// this should probably be implemented somewhere else, maybe at ublox init
// however, for the timestamping to work correctly, setting the time grid to UTC is mandatory!
int timeGrid = (tp.flags & UbxTimePulseStruct::GRID_UTC_GPS)>>7;
if (timeGrid != 0) {
if (timeGrid != 0 && forceUtcSetCounter++ < 3) {
UbxTimePulseStruct newTp = tp;
newTp.flags &= ~((uint32_t)UbxTimePulseStruct::GRID_UTC_GPS);
emit UBXSetCfgTP5(newTp);
qDebug() << "forced time grid to UTC";
emit sendPollUbxMsg(UBX_CFG_TP5);
}
}

Expand Down

0 comments on commit 8286445

Please sign in to comment.