Factory reset RTC

This commit is contained in:
Ben Meadors 2025-07-16 19:17:45 -05:00
parent 55fc4fcd90
commit 225c47ede3
2 changed files with 14 additions and 0 deletions

View File

@ -1539,6 +1539,13 @@ The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of s
if (perhapsSetRTC(RTCQualityGPS, t) == RTCSetResultInvalidTime) {
// Clear the GPS buffer if we got an invalid time
clearBuffer();
// Clear the RTC from the L76K, L76B, and clones
if (IS_ONE_OF(gnssModel, GNSS_MODEL_MTK_L76B, GNSS_MODEL_MTK)) {
// Clear the RTC from the L76 and MTK GPS modules
LOG_DEBUG("Clearing RTC from L76K/L76B");
int msglen = makeCASPacket(0x06, 0x02, sizeof(_message_CAS_CFG_RST_FACTORY), _message_CAS_CFG_RST_FACTORY);
_serial_gps->write(_message_CAS_CFG_RST_FACTORY, msglen);
}
}
return true;
} else

View File

@ -27,6 +27,13 @@ static const uint8_t _message_CAS_CFG_RST_FACTORY[] = {
0x03 // Startup Mode: Factory
};
// Clear RTC data
static const uint8_t _message_CAS_CFG_RST_RTC[] = {
0x00, 0x01, // NavBbrMask: Clear RTC data
0x01, // Reset Mode: Controlled Software reset
0x00 // Reserved
};
// CFG_RATE (0x06, 0x01)
// 1HZ update rate, this should always be the case after
// factory reset but update it regardless