mirror of https://github.com/ArduPilot/ardupilot
AP_GPS: Allow multiple external AHRS GPS instances
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
This commit is contained in:
parent
f2dcf72fbb
commit
01cd42d1e7
|
@ -1346,13 +1346,23 @@ void AP_GPS::handle_msp(const MSP::msp_gps_data_message_t &pkt)
|
|||
#endif // HAL_MSP_GPS_ENABLED
|
||||
|
||||
#if HAL_EXTERNAL_AHRS_ENABLED
|
||||
void AP_GPS::handle_external(const AP_ExternalAHRS::gps_data_message_t &pkt)
|
||||
|
||||
bool AP_GPS::get_first_external_instance(uint8_t& instance) const
|
||||
{
|
||||
for (uint8_t i=0; i<num_instances; i++) {
|
||||
if (drivers[i] != nullptr && _type[i] == GPS_TYPE_EXTERNAL_AHRS) {
|
||||
drivers[i]->handle_external(pkt);
|
||||
instance = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void AP_GPS::handle_external(const AP_ExternalAHRS::gps_data_message_t &pkt, const uint8_t instance)
|
||||
{
|
||||
if (_type[instance] == GPS_TYPE_EXTERNAL_AHRS && drivers[instance] != nullptr) {
|
||||
drivers[instance]->handle_external(pkt);
|
||||
}
|
||||
}
|
||||
#endif // HAL_EXTERNAL_AHRS_ENABLED
|
||||
|
||||
|
|
|
@ -249,7 +249,11 @@ public:
|
|||
void handle_msp(const MSP::msp_gps_data_message_t &pkt);
|
||||
#endif
|
||||
#if HAL_EXTERNAL_AHRS_ENABLED
|
||||
void handle_external(const AP_ExternalAHRS::gps_data_message_t &pkt);
|
||||
// Retrieve the first instance ID that is configured as type GPS_TYPE_EXTERNAL_AHRS.
|
||||
// Can be used by external AHRS systems that only report one GPS to get the instance ID.
|
||||
// Returns true if an instance was found, false otherwise.
|
||||
bool get_first_external_instance(uint8_t& instance) const WARN_IF_UNUSED;
|
||||
void handle_external(const AP_ExternalAHRS::gps_data_message_t &pkt, const uint8_t instance);
|
||||
#endif
|
||||
|
||||
// Accessor functions
|
||||
|
|
Loading…
Reference in New Issue