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

Merged in f5soh/librepilot/LP-428_Switch_Stick_threshold (pull request #370)

LP-428 Switch and stick threshold
This commit is contained in:
Philippe Renon 2017-01-09 22:45:11 +01:00
commit 88784276f0
2 changed files with 9 additions and 7 deletions

View File

@ -41,7 +41,8 @@
#endif
// Private constants
#define ARMED_THRESHOLD 0.20f
#define ARMED_THRESHOLD_SWITCH 0.20f
#define ARMED_THRESHOLD_STICK 0.80f
#define GROUND_LOW_THROTTLE 0.01f
// Private types
@ -116,7 +117,7 @@ void armHandler(bool newinit, FrameType_t frameType)
}
// immediate disarm on switch
if (armSwitch && acc.AccessoryVal <= -ARMED_THRESHOLD) {
if (armSwitch && acc.AccessoryVal <= -ARMED_THRESHOLD_SWITCH) {
lowThrottle = true;
}
@ -209,9 +210,11 @@ void armHandler(bool newinit, FrameType_t frameType)
previousArmingInputLevel = 0.0f;
}
if ((armingInputLevel <= -ARMED_THRESHOLD) && (previousArmingInputLevel > -ARMED_THRESHOLD)) {
float armedThreshold = armSwitch ? ARMED_THRESHOLD_SWITCH : ARMED_THRESHOLD_STICK;
if ((armingInputLevel <= -armedThreshold) && (previousArmingInputLevel > -armedThreshold)) {
manualArm = true;
} else if ((armingInputLevel >= +ARMED_THRESHOLD) && (previousArmingInputLevel < +ARMED_THRESHOLD)) {
} else if ((armingInputLevel >= +armedThreshold) && (previousArmingInputLevel < +armedThreshold)) {
manualDisarm = true;
}

View File

@ -64,8 +64,7 @@
#define TASK_PRIORITY (tskIDLE_PRIORITY + 3) // 3 = flight control
#define UPDATE_PERIOD_MS 20
#define THROTTLE_FAILSAFE -0.1f
#define ARMED_THRESHOLD 0.50f
// safe band to allow a bit of calibration error or trim offset (in microseconds)
#define CONNECTION_OFFSET 250