Hello! I also wrote such a program and I should note that with the help of
GPS and precise time module RAK12002 everything was very simple!
I read data from the RAK_ZOE_M8Q GPS receiver, then checked if the GPS was getting time data, then loaded it into the RAK_RTC clock.
The official page of Bernd Giesecke has very simple and good examples of how to do this.
#if RAK_ZOE_M8Q > 0
/***********************************/
if (my_gnss.getGnssFixOk ())
{
byte fix_type = my_gnss.getFixType (); // Get the fix type
char fix_type_str[32] = { 0 };
if (fix_type == 0)
sprintf (fix_type_str, "No Fix");
else if (fix_type == 1)
sprintf (fix_type_str, "Dead reckoning");
else if (fix_type == 2)
sprintf (fix_type_str, "Fix type 2D");
else if (fix_type == 3)
sprintf (fix_type_str, "Fix type 3D");
else if (fix_type == 4)
sprintf (fix_type_str, "GNSS fix");
else if (fix_type == 5)
sprintf (fix_type_str, "Time fix");
accuracy = (float) (my_gnss.getHorizontalDOP () / 100.0);
satellites = my_gnss.getSIV ();
MYLOG ("GNSS", "HDOP: %.2f ", accuracy);
MYLOG ("GNSS", "SIV: %d ", satellites);
// Getting time and date
#if RAK_RTC_ID > 0
// Readjusting RTC
if (fix_type > 0 && my_gnss.getTimeValid () == true
&& my_gnss.getDateValid () == true)
{
if (rtc.getMinute () != my_gnss.getMinute ()
|| my_gnss.getHour () != rtc.getHour ())
{
// Clock synchronized with satellite time
rtc.setTime (my_gnss.getYear (), my_gnss.getMonth (),
my_gnss.getTimeOfWeek (), my_gnss.getDay (),
my_gnss.getHour (), my_gnss.getMinute (),
my_gnss.getSecond ());
// year, month, weekday, date, hour, minute, second
fixDateTime = true;
}
}
#endif