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:
parent
a71fb62395
commit
633d8d4969
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user