gps initial time sync added
This commit is contained in:
		
							parent
							
								
									ba08662323
								
							
						
					
					
						commit
						c0692c3879
					
				| @ -90,13 +90,12 @@ time_t fetch_gpsTime(uint16_t *msec) { | |||||||
|   // poll NMEA $GPZDA sentence
 |   // poll NMEA $GPZDA sentence
 | ||||||
| #ifdef GPS_SERIAL | #ifdef GPS_SERIAL | ||||||
|   GPS_Serial.print(ZDA_Request); |   GPS_Serial.print(ZDA_Request); | ||||||
|  |   // wait for gps NMEA answer
 | ||||||
|  |   vTaskDelay(tx_Ticks(NMEA_FRAME_SIZE, GPS_SERIAL)); | ||||||
| #elif defined GPS_I2C | #elif defined GPS_I2C | ||||||
|   Wire.print(ZDA_Request); |   Wire.print(ZDA_Request); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|   // wait for gps NMEA answer
 |  | ||||||
|   //vTaskDelay(tx_Ticks(NMEA_FRAME_SIZE, GPS_SERIAL));
 |  | ||||||
| 
 |  | ||||||
|   // did we get a current time?
 |   // did we get a current time?
 | ||||||
|   if (gpstime.isUpdated() && gpstime.isValid()) { |   if (gpstime.isUpdated() && gpstime.isValid()) { | ||||||
| 
 | 
 | ||||||
| @ -104,7 +103,8 @@ time_t fetch_gpsTime(uint16_t *msec) { | |||||||
| 
 | 
 | ||||||
|     String rawtime = gpstime.value(); |     String rawtime = gpstime.value(); | ||||||
|     uint32_t time_bcd = rawtime.toFloat() * 100; |     uint32_t time_bcd = rawtime.toFloat() * 100; | ||||||
|     uint32_t delay_ms = gpstime.age() + nmea_txDelay_ms + NMEA_COMPENSATION_FACTOR; |     uint32_t delay_ms = | ||||||
|  |         gpstime.age() + nmea_txDelay_ms + NMEA_COMPENSATION_FACTOR; | ||||||
|     uint8_t year = |     uint8_t year = | ||||||
|         CalendarYrToTm(gps.date.year()); // year offset from 1970 in microTime.h
 |         CalendarYrToTm(gps.date.year()); // year offset from 1970 in microTime.h
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user