Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eahrs remove gps serial assumption #29153

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ class AP_ExternalAHRS {
// get serial port number, -1 for not enabled
int8_t get_port(AvailableSensor sensor) const;

// check if a sensor type is enabled
bool has_sensor(AvailableSensor sensor) const {
return (uint16_t(sensors.get()) & uint16_t(sensor)) != 0;
}

struct state_t {
HAL_Semaphore sem;

Expand Down Expand Up @@ -190,11 +195,6 @@ class AP_ExternalAHRS {

static AP_ExternalAHRS *_singleton;

// check if a sensor type is enabled
bool has_sensor(AvailableSensor sensor) const {
return (uint16_t(sensors.get()) & uint16_t(sensor)) != 0;
}

// set default of EAHRS_SENSORS
void set_default_sensors(uint16_t _sensors) {
sensors.set_default(_sensors);
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_GPS/AP_GPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ AP_GPS_Backend *AP_GPS::_detect_instance(uint8_t instance)
#endif
#if HAL_EXTERNAL_AHRS_ENABLED
case GPS_TYPE_EXTERNAL_AHRS:
if (AP::externalAHRS().get_port(AP_ExternalAHRS::AvailableSensor::GPS) >= 0) {
if (!AP::externalAHRS().has_sensor(AP_ExternalAHRS::AvailableSensor::GPS)) {
dstate->auto_detected_baud = false; // specified, not detected
return NEW_NOTHROW AP_GPS_ExternalAHRS(*this, params[instance], state[instance], nullptr);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/mavlink
Loading