Skip to content

Commit

Permalink
AP_ExternalAHRS: added support for GPS disable and fwd flight
Browse files Browse the repository at this point in the history
allow backends to determine if we are in fixed wing flight and/or the
GPS is disabled by the user
  • Loading branch information
tridge committed Feb 15, 2024
1 parent aed5ded commit b3c2271
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
10 changes: 9 additions & 1 deletion libraries/AP_ExternalAHRS/AP_ExternalAHRS.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ class AP_ExternalAHRS {
float differential_pressure; // Pa
float temperature; // degC
} airspeed_data_message_t;


// set GNSS disable for auxillary function GPS_DISABLE
void set_gnss_disable(bool disable) {
gnss_is_disabled = disable;
}

protected:

enum class OPTIONS {
Expand Down Expand Up @@ -195,6 +200,9 @@ class AP_ExternalAHRS {
}

uint32_t last_log_ms;

// true when user has disabled the GNSS
bool gnss_is_disabled;
};

namespace AP {
Expand Down
6 changes: 6 additions & 0 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "AP_ExternalAHRS_backend.h"
#include <AP_AHRS/AP_AHRS.h>

#if HAL_EXTERNAL_AHRS_ENABLED

Expand All @@ -37,5 +38,10 @@ bool AP_ExternalAHRS_backend::option_is_set(AP_ExternalAHRS::OPTIONS option) con
return frontend.option_is_set(option);
}

bool AP_ExternalAHRS_backend::in_fly_forward(void) const
{
return AP::ahrs().get_fly_forward();
}

#endif // HAL_EXTERNAL_AHRS_ENABLED

14 changes: 13 additions & 1 deletion libraries/AP_ExternalAHRS/AP_ExternalAHRS_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,19 @@ class AP_ExternalAHRS_backend {
void set_default_sensors(uint16_t sensors) {
frontend.set_default_sensors(sensors);
}


/*
return true if the GNSS is disabled
*/
bool gnss_is_disabled(void) const {
return frontend.gnss_is_disabled;
}

/*
return true when we are in fixed wing flight
*/
bool in_fly_forward(void) const;

private:
AP_ExternalAHRS &frontend;
};
Expand Down

0 comments on commit b3c2271

Please sign in to comment.