AP_GPS: allow external libraries to detect CAN instance

This commit is contained in:
Tom Pittenger 2023-02-28 14:19:15 -08:00 committed by Andrew Tridgell
parent 7e214b2695
commit fe37282f77
2 changed files with 16 additions and 0 deletions

View File

@ -889,4 +889,16 @@ void AP_GPS_UAVCAN::handle_param_save_response(AP_UAVCAN* ap_uavcan, const uint8
ap_uavcan->send_reboot_request(node_id); ap_uavcan->send_reboot_request(node_id);
} }
#if AP_DRONECAN_SEND_GPS
bool AP_GPS_UAVCAN::instance_exists(const AP_UAVCAN* ap_uavcan)
{
for (uint8_t i=0; i<ARRAY_SIZE(_detected_modules); i++) {
if (ap_uavcan == _detected_modules[i].ap_uavcan) {
return true;
}
}
return false;
}
#endif // AP_DRONECAN_SEND_GPS
#endif // HAL_ENABLE_LIBUAVCAN_DRIVERS #endif // HAL_ENABLE_LIBUAVCAN_DRIVERS

View File

@ -71,6 +71,10 @@ public:
void clear_RTCMV3() override; void clear_RTCMV3() override;
#endif #endif
#if AP_DRONECAN_SEND_GPS
static bool instance_exists(const AP_UAVCAN* ap_uavcan);
#endif
private: private:
bool param_configured = true; bool param_configured = true;