2017-02-27 17:12:56 -04:00
|
|
|
#include "AP_Arming_Sub.h"
|
|
|
|
#include "Sub.h"
|
|
|
|
|
|
|
|
enum HomeState AP_Arming_Sub::home_status() const
|
|
|
|
{
|
|
|
|
return sub.ap.home_state;
|
|
|
|
}
|
2017-03-01 00:05:51 -04:00
|
|
|
|
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
|
|
|
|
};
|
2017-08-14 14:54:01 -03:00
|
|
|
return rc_checks_copter_sub(display_failure, channels, false /* check_min_max */);
|
2017-03-01 00:05:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool AP_Arming_Sub::pre_arm_checks(bool report)
|
|
|
|
{
|
|
|
|
if (armed) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-09-04 05:12:58 -03:00
|
|
|
return AP_Arming::pre_arm_checks(report);
|
2017-04-14 17:37:36 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool AP_Arming_Sub::ins_checks(bool report)
|
|
|
|
{
|
|
|
|
// call parent class checks
|
|
|
|
if (!AP_Arming::ins_checks(report)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// additional plane specific checks
|
|
|
|
if ((checks_to_perform & ARMING_CHECK_ALL) ||
|
|
|
|
(checks_to_perform & ARMING_CHECK_INS)) {
|
|
|
|
if (!ahrs.healthy()) {
|
|
|
|
if (report) {
|
|
|
|
const char *reason = ahrs.prearm_failure_reason();
|
|
|
|
if (reason) {
|
2017-07-09 00:57:38 -03:00
|
|
|
gcs().send_text(MAV_SEVERITY_CRITICAL, "PreArm: %s", reason);
|
2017-04-14 17:37:36 -03:00
|
|
|
} else {
|
2017-07-09 00:57:38 -03:00
|
|
|
gcs().send_text(MAV_SEVERITY_CRITICAL, "PreArm: AHRS not healthy");
|
2017-04-14 17:37:36 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2017-03-01 00:05:51 -04:00
|
|
|
}
|