ardupilot/ArduSub/AP_Arming_Sub.cpp

46 lines
1.1 KiB
C++
Raw Normal View History

2017-02-27 17:12:56 -04:00
#include "AP_Arming_Sub.h"
#include "Sub.h"
bool AP_Arming_Sub::rc_calibration_checks(bool display_failure)
{
const RC_Channel *channels[] = {
sub.channel_roll,
sub.channel_pitch,
sub.channel_throttle,
sub.channel_yaw
};
2018-12-20 04:23:25 -04:00
return rc_checks_copter_sub(display_failure, channels);
}
2017-08-09 08:37:41 -03:00
bool AP_Arming_Sub::pre_arm_checks(bool display_failure)
{
if (armed) {
return true;
}
2017-08-09 08:37:41 -03:00
return AP_Arming::pre_arm_checks(display_failure);
2017-04-14 17:37:36 -03:00
}
2017-08-09 08:37:41 -03:00
bool AP_Arming_Sub::ins_checks(bool display_failure)
2017-04-14 17:37:36 -03:00
{
// call parent class checks
2017-08-09 08:37:41 -03:00
if (!AP_Arming::ins_checks(display_failure)) {
2017-04-14 17:37:36 -03:00
return false;
}
2018-06-25 02:26:41 -03:00
// additional sub-specific checks
2017-04-14 17:37:36 -03:00
if ((checks_to_perform & ARMING_CHECK_ALL) ||
(checks_to_perform & ARMING_CHECK_INS)) {
if (!AP::ahrs().prearm_healthy()) {
2018-06-25 02:26:41 -03:00
const char *reason = AP::ahrs().prearm_failure_reason();
2017-08-09 08:37:41 -03:00
if (reason == nullptr) {
reason = "AHRS not healthy";
2017-04-14 17:37:36 -03:00
}
2017-08-09 08:37:41 -03:00
check_failed(ARMING_CHECK_INS, display_failure, "%s", reason);
2017-04-14 17:37:36 -03:00
return false;
}
}
return true;
}