I originally believed that the timeStatus() would return timeNeedsSync if the time since the last sync was longer than the syncInterval. I wrote my code to check the return value of timeStatus() when the GPS received a valid time and if the returned value was not timeSet, it would call setTime to set the time. I believe this is better than pointing to a function to update the time as it is possible that the GPS does not have a valid time. If the time is invalid, what should the function pointed to by the getTimePtr pointer return?
I found that the timeStatus() only returns timeNeedsSync if the getTimePtr pointer is set. I rewrote the now() method so that the Status is set to timeNeedsSync regardless if the pointer to the set time function is set or not. I think it is more useful this way. I will fork the code, check in the changes, and do a pull request. If Paul believes the change will be useful for others that would be great. If I'm missing something and there is a better way to point to a setter function using GPS, I'm willing to learn. I did look at the TimeGPS example but it did not make use of setSyncProvider or timeStatus.
On a separate note, I get a strange error on line 70 of TimeLib.h. I will get that sorted out but it is strange and does not make sense. I comment out that line and all is fine.
I found that the timeStatus() only returns timeNeedsSync if the getTimePtr pointer is set. I rewrote the now() method so that the Status is set to timeNeedsSync regardless if the pointer to the set time function is set or not. I think it is more useful this way. I will fork the code, check in the changes, and do a pull request. If Paul believes the change will be useful for others that would be great. If I'm missing something and there is a better way to point to a setter function using GPS, I'm willing to learn. I did look at the TimeGPS example but it did not make use of setSyncProvider or timeStatus.
On a separate note, I get a strange error on line 70 of TimeLib.h. I will get that sorted out but it is strange and does not make sense. I comment out that line and all is fine.
Code:In file included from C:\Users\richt\AppData\Local\Temp\arduino_build_546908\sketch\SD_Card.h:6:0, from D:\Users\richt\OneDrive\Documents\Projects\PocketGPS\sketch_sep11b_gps\sketch_sep11b_gps.ino:2: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Time/TimeLib.h:70:32: error: expected ')' before '(' token #define DAYS_PER_WEEK ((time_t)(7UL)) ^ D:\Users\richt\OneDrive\Documents\Arduino\libraries\NeoGPS\src/NeoTime.h:44:16: note: in expansion of macro 'DAYS_PER_WEEK' const uint8_t DAYS_PER_WEEK = 7; ^~~~~~~~~~~~~ Error compiling for board Teensy 2.0.