@@ -53,8 +53,7 @@ void menuPointPerfectKeys()
5353 if (strlen (settings.pointPerfectCurrentKey ) > 0 && settings.pointPerfectCurrentKeyStart > 0 &&
5454 settings.pointPerfectCurrentKeyDuration > 0 )
5555 {
56- long long unixEpoch = thingstreamEpochToGPSEpoch (settings.pointPerfectCurrentKeyStart ,
57- settings.pointPerfectCurrentKeyDuration );
56+ long long gpsEpoch = thingstreamEpochToGPSEpoch (settings.pointPerfectCurrentKeyStart );
5857
5958 uint16_t keyGPSWeek;
6059 uint32_t keyGPSToW;
@@ -80,8 +79,7 @@ void menuPointPerfectKeys()
8079 if (strlen (settings.pointPerfectNextKey ) > 0 && settings.pointPerfectNextKeyStart > 0 &&
8180 settings.pointPerfectNextKeyDuration > 0 )
8281 {
83- long long unixEpoch =
84- thingstreamEpochToGPSEpoch (settings.pointPerfectNextKeyStart , settings.pointPerfectNextKeyDuration );
82+ long long gpsEpoch = thingstreamEpochToGPSEpoch (settings.pointPerfectNextKeyStart );
8583
8684 uint16_t keyGPSWeek;
8785 uint32_t keyGPSToW;
@@ -709,8 +707,7 @@ int daysFromEpoch(long long endEpoch)
709707// Add leap seconds (the API reports start times with GPS leap seconds removed)
710708// Convert from unix epoch (the API reports unix epoch time) to GPS epoch (the NED-D9S expects)
711709// Note: I believe the Thingstream API is reporting startEpoch 18 seconds less than actual
712- // Even though we are adding 18 leap seconds, the ToW is still coming out as 518400 instead of 518418 (midnight)
713- long long thingstreamEpochToGPSEpoch (long long startEpoch, long long duration)
710+ long long thingstreamEpochToGPSEpoch (long long startEpoch)
714711{
715712 long long epoch = startEpoch;
716713 epoch /= 1000 ; // Convert PointPerfect ms Epoch to s
@@ -732,7 +729,7 @@ uint8_t getLeapSeconds()
732729 return (leapSeconds);
733730 }
734731 }
735- return (18 ); // Default to 18 if GNSS if offline
732+ return (18 ); // Default to 18 if GNSS is offline
736733}
737734
738735// Covert a given the key's expiration date to a GPS Epoch, so that we can calculate GPS Week and ToW
@@ -813,8 +810,7 @@ void dateToKeyStartDuration(uint8_t expDay, uint8_t expMonth, uint16_t expYear,
813810 // Print ToW and Week for debugging
814811 uint16_t keyGPSWeek;
815812 uint32_t keyGPSToW;
816- long long unixEpoch = thingstreamEpochToGPSEpoch (*settingsKeyStart, *settingsKeyDuration);
817- unixEpochToWeekToW (unixEpoch, &keyGPSWeek, &keyGPSToW);
813+ long long gpsEpoch = thingstreamEpochToGPSEpoch (*settingsKeyStart);
818814
819815 if (ENABLE_DEVELOPER)
820816 {
@@ -917,14 +913,11 @@ void pointperfectApplyKeys()
917913
918914 uint16_t currentKeyGPSWeek;
919915 uint32_t currentKeyGPSToW;
920- long long epoch = thingstreamEpochToGPSEpoch (settings.pointPerfectCurrentKeyStart ,
921- settings.pointPerfectCurrentKeyDuration );
922- unixEpochToWeekToW (epoch, ¤tKeyGPSWeek, ¤tKeyGPSToW);
916+ long long epoch = thingstreamEpochToGPSEpoch (settings.pointPerfectCurrentKeyStart );
923917
924918 uint16_t nextKeyGPSWeek;
925919 uint32_t nextKeyGPSToW;
926- epoch = thingstreamEpochToGPSEpoch (settings.pointPerfectNextKeyStart , settings.pointPerfectNextKeyDuration );
927- unixEpochToWeekToW (epoch, &nextKeyGPSWeek, &nextKeyGPSToW);
920+ epoch = thingstreamEpochToGPSEpoch (settings.pointPerfectNextKeyStart );
928921
929922 theGNSS.setVal8 (UBLOX_CFG_SPARTN_USE_SOURCE, 1 ); // use LBAND PMP message
930923
0 commit comments