diff --git a/GsmWithGnss.c b/GsmWithGnss.c index c18c502..74f20a9 100644 --- a/GsmWithGnss.c +++ b/GsmWithGnss.c @@ -131,6 +131,8 @@ void GsmWithGnssInit( env->gnssRmcGga.rmcAccess = osMutexNew(NULL); + env->isRtcACP = false; + } diff --git a/GsmWithGnss.h b/GsmWithGnss.h index b9be51d..ae9b961 100644 --- a/GsmWithGnss.h +++ b/GsmWithGnss.h @@ -84,6 +84,8 @@ typedef struct { tSocketGsm socketGsm; + bool isRtcACP; + } tGsmWithGnss; //Common diff --git a/GsmWithGnss_GnssOps.c b/GsmWithGnss_GnssOps.c index 1bda8a7..85573bb 100644 --- a/GsmWithGnss_GnssOps.c +++ b/GsmWithGnss_GnssOps.c @@ -114,6 +114,19 @@ void AtGsm_Gsnss_GetNMEA_Pack(tGsmWithGnss *env, uint32_t timeout) { memcpy(&env->gnssRmcGga.currentRmc, &env->gnss.currentAcp, sizeof(env->gnss.currentAcp)); + if (env->gnssRmcGga.currentRmc.time.second != 0) { + if (env->isRtcACP == false) { + + time_t timestamp; + timestamp = iNmea0183TimestampFromRmc(&env->gnssRmcGga.currentRmc); + + if (timestamp > 1733817613) { + env->isRtcACP = true; + RtcSet(env->Rtc, ×tamp); + } + } + } + env->gnss.success = true; } }