1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

LP-309 Arming should be done at armingInputLevel edge (crossing ARMED_THRESHOLD) instead of level to avoid unwanted re-arming after timeout.

This commit is contained in:
Vladimir Zidar 2016-05-10 23:00:12 +02:00
parent a71fb62395
commit 633d8d4969

View File

@ -195,12 +195,22 @@ void armHandler(bool newinit, FrameType_t frameType)
bool manualArm = false;
bool manualDisarm = false;
if (armingInputLevel <= -ARMED_THRESHOLD) {
static FlightModeSettingsArmingOptions previousArmingSettings = -1;
static float previousArmingInputLevel = 0.0f;
if (previousArmingSettings != settings.Arming) {
previousArmingSettings = settings.Arming;
previousArmingInputLevel = 0.0f;
}
if ((armingInputLevel <= -ARMED_THRESHOLD) && (previousArmingInputLevel > -ARMED_THRESHOLD)) {
manualArm = true;
} else if (armingInputLevel >= +ARMED_THRESHOLD) {
} else if ((armingInputLevel >= +ARMED_THRESHOLD) && (previousArmingInputLevel < +ARMED_THRESHOLD)) {
manualDisarm = true;
}
previousArmingInputLevel = armingInputLevel;
switch (armState) {
case ARM_STATE_DISARMED:
setArmedIfChanged(FLIGHTSTATUS_ARMED_DISARMED);