gps fixes (TIM-TP5 removed again)

This commit is contained in:
cyberman54 2022-02-13 18:41:22 +01:00
parent 88efd5dd4d
commit 8f98a9bdde

View File

@ -43,10 +43,10 @@ byte CFG_PRT[] = {
}; };
// Array of two bytes for CFG-MSG packets payload. // Array of two bytes for CFG-MSG packets payload.
byte CFG_MSG_CID[][2] = { byte CFG_MSG_CID[][2] = {{0xF0, 0x01}, {0xF0, 0x02}, {0xF0, 0x03}, {0xF0, 0x05},
{0xF0, 0x01}, {0xF0, 0x02}, {0xF0, 0x03}, {0xF0, 0x05}, {0xF0, 0x06}, {0xF0, 0x06}, {0xF0, 0x07}, {0xF0, 0x08}, {0xF0, 0x09},
{0xF0, 0x07}, {0xF0, 0x08}, {0xF0, 0x09}, {0xF0, 0x0A}, {0xF0, 0x0E}, {0xF0, 0x0A}, {0xF0, 0x0E}, {0xF1, 0x00}, {0xF1, 0x03},
{0xF1, 0x00}, {0xF1, 0x03}, {0xF1, 0x04}, {0xF1, 0x05}, {0xF1, 0x06}}; {0xF1, 0x04}, {0xF1, 0x05}, {0xF1, 0x06}};
// UBX CFG-MSG packet // UBX CFG-MSG packet
byte CFG_MSG[] = { byte CFG_MSG[] = {
@ -61,47 +61,6 @@ byte CFG_MSG[] = {
0x00 // payload (zero to disable message) 0x00 // payload (zero to disable message)
}; };
// UBX TIM-TP5 packet
byte TIM_TP5[] = {
0xB5, // sync char 1
0x62, // sync char 2
0x06, // class
0x31, // id
0x20, // length
0x00, // time pulse index
0x00, // reserved
0x00, // reserved
0x00, // .
0x00, // antenna cable delay [ns]
0x00, // .
0x00, // receiver rf group delay [ns]
0x00, // .
0x00, // frequency unlocked
0x00, // -> no signal
0x00, // .
0x00, // .
0x01, // frequency locked
0x00, // -> 1Hz
0x00, // .
0x00, // .
0x00, // pulse length unlocked
0x00, // -> no pulse
0x00, // .
0x00, // .
0xE8, // pulse length locked
0x03, // -> 1000us = 1ms
0x00, // .
0x00, // .
0x00, // user delay
0x00, // .
0x00, // .
0x00, // .
0b01111111, // flags
0b00000000, // -> UTC time grid
0b00000000, // .
0b00000000 // .
};
// UBX CFG-CFG packet // UBX CFG-CFG packet
byte CFG_CFG[] = { byte CFG_CFG[] = {
0xB5, // sync char 1 0xB5, // sync char 1
@ -184,7 +143,6 @@ int gps_init(void) {
GPS_Serial.updateBaudRate(GPS_BAUDRATE); GPS_Serial.updateBaudRate(GPS_BAUDRATE);
disableNmea(); disableNmea();
setTimePulse();
return 1; return 1;
@ -215,7 +173,7 @@ bool gps_hasfix() {
time_t get_gpstime(uint16_t *msec = 0) { time_t get_gpstime(uint16_t *msec = 0) {
const uint16_t txDelay = const uint16_t txDelay =
70 * 1000 / (GPS_BAUDRATE / 9); // serial tx of 70 NMEA chars 70U * 1000 / (GPS_BAUDRATE / 9); // serial tx of 70 NMEA chars
// did we get a current date & time? // did we get a current date & time?
if (gps.time.age() < 1000) { if (gps.time.age() < 1000) {
@ -235,15 +193,16 @@ time_t get_gpstime(uint16_t *msec = 0) {
#ifdef GPS_INT #ifdef GPS_INT
// if we have a recent GPS PPS pulse, sync on top of next second // if we have a recent GPS PPS pulse, sync on top of next second
if (millis() - lastPPS < 1000) uint16_t ppsDiff = millis() - lastPPS;
*msec = (uint16_t)(millis() - lastPPS); if (ppsDiff < 1000)
*msec = ppsDiff;
else { else {
ESP_LOGD(TAG, "no PPS from GPS"); ESP_LOGD(TAG, "no PPS from GPS");
return 0; return 0;
} }
#else #else
// best guess top of second // best guess for sync on top of next second
*msec = gps.time.centisecond() * 10 + txDelay; *msec = gps.time.centisecond() * 10U + txDelay;
#endif #endif
return t; return t;