AP_Arming: move Log_Write_Arm_Disarm in, make disarm virtual

This commit is contained in:
Peter Barker 2019-05-03 21:15:46 +10:00 committed by Randy Mackay
parent d384827291
commit aff6cb424f
2 changed files with 14 additions and 1 deletions

View File

@ -900,6 +900,17 @@ bool AP_Arming::rc_checks_copter_sub(const bool display_failure, const RC_Channe
return ret;
}
void AP_Arming::Log_Write_Arm_Disarm()
{
struct log_Arm_Disarm pkt = {
LOG_PACKET_HEADER_INIT(LOG_ARM_DISARM_MSG),
time_us : AP_HAL::micros64(),
arm_state : is_armed(),
arm_checks : get_enabled_checks()
};
AP::logger().WriteCriticalBlock(&pkt, sizeof(pkt));
}
AP_Arming *AP_Arming::_singleton = nullptr;
/*

View File

@ -51,7 +51,7 @@ public:
// these functions should not be used by Copter which holds the armed state in the motors library
Required arming_required();
virtual bool arm(AP_Arming::Method method, bool do_arming_checks=true);
bool disarm();
virtual bool disarm();
bool is_armed();
// get bitmask of enabled checks
@ -133,6 +133,8 @@ protected:
// handle the case where a check fails
void check_failed(const enum AP_Arming::ArmingChecks check, bool report, const char *fmt, ...) const;
void Log_Write_Arm_Disarm();
private:
static AP_Arming *_singleton;