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:
commit
88784276f0
@ -41,8 +41,9 @@
|
||||
#endif
|
||||
|
||||
// Private constants
|
||||
#define ARMED_THRESHOLD 0.20f
|
||||
#define GROUND_LOW_THROTTLE 0.01f
|
||||
#define ARMED_THRESHOLD_SWITCH 0.20f
|
||||
#define ARMED_THRESHOLD_STICK 0.80f
|
||||
#define GROUND_LOW_THROTTLE 0.01f
|
||||
|
||||
// Private types
|
||||
typedef enum {
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user