void gps_geodetic_message() { unsigned int year = gps_payload[11] << 8 | gps_payload[12]; unsigned int month = gps_payload[13]; unsigned int day = gps_payload[14]; unsigned int hour = gps_payload[15]; unsigned int minute = gps_payload[16]; unsigned int rawsecond = (gps_payload[17] << 8 | gps_payload[18]); unsigned int second = rawsecond / 1000; unsigned int millis = rawsecond % 1000; unsigned int gps_week = gps_payload[5] << 8 | gps_payload[6]; unsigned int gps_tow = (unsigned int)gps_payload[7] << 24 | (unsigned int)gps_payload[8] << 16 | (unsigned int)gps_payload[9] << 8 | (unsigned int)gps_payload[10]; unsigned int gps_tow_sec = gps_tow / 1000L; unsigned int numsvs = gps_payload[88]; debug_int(year); debug("-"); debug_int(month); debug("-"); debug_int(day); debug(" "); debug_int(hour); debug(":"); debug_int(minute); debug(":"); debug_int(second); debug("."); debug_int(millis); debug(", "); debug_int(numsvs); debug(" SVs\r\n"); int utc_offset = gps_utc_offset(hour, minute, second, gps_tow_sec); time_set_date(gps_week, gps_tow_sec, utc_offset); health_set_gps_status(GPS_OK); health_reset_gps_watchdog(); }
void health_watchdog_tick() { if (gps_watchdog <= 3) gps_watchdog ++; if (gps_watchdog == 3) { debug("GPS watchdog expired\r\n"); health_set_gps_status(GPS_UNLOCK); } if (fll_watchdog <= HOLDOVER_LIMIT_SEC) fll_watchdog ++; if (fll_watchdog == HOLDOVER_LIMIT_SEC) { debug("Holdover expired\r\n"); health_set_fll_status(FLL_UNLOCK); } }