2017-02-27 17:12:56 -04:00
|
|
|
#include "AP_Arming_Sub.h"
|
|
|
|
#include "Sub.h"
|
|
|
|
|
2017-09-04 01:17:07 -03:00
|
|
|
bool AP_Arming_Sub::rc_calibration_checks(bool display_failure)
|
2017-03-01 00:05:51 -04:00
|
|
|
{
|
2017-08-10 22:26:57 -03:00
|
|
|
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-03-01 00:05:51 -04:00
|
|
|
}
|
|
|
|
|
2017-08-09 08:37:41 -03:00
|
|
|
bool AP_Arming_Sub::pre_arm_checks(bool display_failure)
|
2017-03-01 00:05:51 -04:00
|
|
|
{
|
|
|
|
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)) {
|
2018-06-25 02:26:41 -03:00
|
|
|
if (!AP::ahrs().healthy()) {
|
|
|
|
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;
|
2017-03-01 00:05:51 -04:00
|
|
|
}
|