mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
FlightTask Manual: Gear react only on switch changes and not states
This commit is contained in:
parent
f4fc0cd291
commit
9ee3d79a96
@ -91,15 +91,12 @@ bool FlightTaskManual::_evaluateSticks()
|
||||
// until he toggles the switch to avoid retracting the gear immediately on takeoff.
|
||||
int8_t gear_switch = _sub_manual_control_setpoint->get().gear_switch;
|
||||
|
||||
if (!_gear.landing_gear) {
|
||||
if (gear_switch == manual_control_setpoint_s::SWITCH_POS_OFF) {
|
||||
_applyGearSwitch(gear_switch);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_gear_switch_old != gear_switch) {
|
||||
_applyGearSwitch(gear_switch);
|
||||
}
|
||||
|
||||
_gear_switch_old = gear_switch;
|
||||
|
||||
// valid stick inputs are required
|
||||
const bool valid_sticks = PX4_ISFINITE(_sticks(0))
|
||||
&& PX4_ISFINITE(_sticks(1))
|
||||
|
||||
@ -59,6 +59,7 @@ protected:
|
||||
bool _sticks_data_required = true; /**< let inherited task-class define if it depends on stick data */
|
||||
matrix::Vector<float, 4> _sticks; /**< unmodified manual stick inputs */
|
||||
matrix::Vector<float, 4> _sticks_expo; /**< modified manual sticks using expo function*/
|
||||
int _gear_switch_old = manual_control_setpoint_s::SWITCH_POS_NONE; /**< old switch state*/
|
||||
|
||||
float stickDeadzone() const { return _stick_dz.get(); }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user