AP_Arming: add accessor to retrieve last disarm method

This commit is contained in:
Peter Barker 2020-07-16 12:52:11 +10:00 committed by Randy Mackay
parent 68b6b77a22
commit 6ab9089fff
2 changed files with 10 additions and 0 deletions

View File

@ -1171,6 +1171,7 @@ bool AP_Arming::disarm(const AP_Arming::Method method)
return false;
}
armed = false;
_last_disarm_method = method;
Log_Write_Disarm(method); // should be able to pass through force here?

View File

@ -72,6 +72,7 @@ public:
PILOT_INPUT_FAILSAFE = 29, // only disarm uses this...
TOYMODELANDTHROTTLE = 30, // only disarm uses this...
TOYMODELANDFORCE = 31, // only disarm uses this...
UNKNOWN = 100,
};
enum class Required {
@ -118,6 +119,10 @@ public:
static const struct AP_Param::GroupInfo var_info[];
// method that was last used for disarm; invalid unless the
// vehicle has been disarmed at least once.
Method last_disarm_method() const { return _last_disarm_method; }
protected:
// Parameters
@ -224,6 +229,10 @@ private:
char* aux_auth_fail_msg; // buffer for holding failure messages
bool aux_auth_error; // true if too many auxiliary authorisers
HAL_Semaphore aux_auth_sem; // semaphore for accessing the aux_auth_state and aux_auth_fail_msg
// method that was last used for disarm; invalid unless the
// vehicle has been disarmed at least once.
Method _last_disarm_method = Method::UNKNOWN;
};
namespace AP {