AP_GPS: added API for getting last iTOW

This commit is contained in:
Andrew Tridgell 2020-09-03 21:48:47 +10:00
parent 5f5c7735a3
commit 5647aadbcf
3 changed files with 17 additions and 0 deletions

View File

@ -1795,6 +1795,15 @@ bool AP_GPS::logging_failed(void) const {
return false;
}
// get iTOW, if supported, zero otherwie
uint32_t AP_GPS::get_itow(uint8_t instance) const
{
if (instance >= GPS_MAX_RECEIVERS || drivers[instance] == nullptr) {
return 0;
}
return drivers[instance]->get_last_itow();
}
namespace AP {
AP_GPS &gps()

View File

@ -482,6 +482,9 @@ public:
return instance>=GPS_MAX_RECEIVERS? GPS_Type::GPS_TYPE_NONE : GPS_Type(_type[instance].get());
}
// get iTOW, if supported, zero otherwie
uint32_t get_itow(uint8_t instance) const;
protected:
// configuration parameters

View File

@ -71,6 +71,11 @@ public:
virtual bool get_RTCMV3(const uint8_t *&bytes, uint16_t &len) { return false; }
virtual void clear_RTCMV3(void) {};
// return iTOW of last message, or zero if not supported
uint32_t get_last_itow(void) const {
return _last_itow;
}
protected:
AP_HAL::UARTDriver *port; ///< UART we are attached to
AP_GPS &gps; ///< access to frontend (for parameters)