Browse Source

AP_Arming: move Log_Write_Arm_Disarm in, make disarm virtual

master
Peter Barker 6 years ago committed by Randy Mackay
parent
commit
aff6cb424f
  1. 11
      libraries/AP_Arming/AP_Arming.cpp
  2. 4
      libraries/AP_Arming/AP_Arming.h

11
libraries/AP_Arming/AP_Arming.cpp

@ -900,6 +900,17 @@ bool AP_Arming::rc_checks_copter_sub(const bool display_failure, const RC_Channe @@ -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;
/*

4
libraries/AP_Arming/AP_Arming.h

@ -51,7 +51,7 @@ public: @@ -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: @@ -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;

Loading…
Cancel
Save