AP_Arming: add prearm check for blending-enabled-but-not-available

This commit is contained in:
Peter Barker 2024-03-23 13:20:24 +11:00 committed by Andrew Tridgell
parent a0b2753766
commit fcd36664d0
2 changed files with 23 additions and 0 deletions

View File

@ -1054,6 +1054,11 @@ bool AP_Arming::system_checks(bool report)
}
if (check_enabled(ARMING_CHECK_PARAMETERS)) {
#if !AP_GPS_BLENDED_ENABLED
if (!blending_auto_switch_checks(report)) {
return false;
}
#endif
#if AP_RPM_ENABLED
auto *rpm = AP::rpm();
if (rpm && !rpm->arming_checks(sizeof(buffer), buffer)) {
@ -1645,6 +1650,19 @@ bool AP_Arming::arm_checks(AP_Arming::Method method)
return true;
}
#if !AP_GPS_BLENDED_ENABLED
bool AP_Arming::blending_auto_switch_checks(bool report)
{
if (AP::gps().get_auto_switch_type() == 2) {
if (report) {
check_failed(ARMING_CHECK_GPS, true, "GPS_AUTO_SWITCH==2 but no blending");
}
return false;
}
return true;
}
#endif
bool AP_Arming::mandatory_checks(bool report)
{
bool ret = true;

View File

@ -3,6 +3,7 @@
#include <AP_HAL/AP_HAL_Boards.h>
#include <AP_HAL/Semaphores.h>
#include <AP_Param/AP_Param.h>
#include <AP_GPS/AP_GPS_config.h>
#include "AP_Arming_config.h"
#include "AP_InertialSensor/AP_InertialSensor_config.h"
@ -309,6 +310,10 @@ private:
bool report_immediately; // set to true when check goes from true to false, to trigger immediate report
void update_arm_gpio();
#if !AP_GPS_BLENDED_ENABLED
bool blending_auto_switch_checks(bool report);
#endif
};
namespace AP {