mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 10:46:33 +08:00
manual_control: add hysteresis for arm button back
This commit is contained in:
committed by
Matthias Grob
parent
75209a7552
commit
60de330f18
@@ -82,6 +82,7 @@ void ManualControl::Run()
|
||||
|
||||
_stick_arm_hysteresis.set_hysteresis_time_from(false, _param_rc_arm_hyst.get() * 1_ms);
|
||||
_stick_disarm_hysteresis.set_hysteresis_time_from(false, _param_rc_arm_hyst.get() * 1_ms);
|
||||
_button_hysteresis.set_hysteresis_time_from(false, _param_rc_arm_hyst.get() * 1_ms);
|
||||
|
||||
_selector.set_rc_in_mode(_param_com_rc_in_mode.get());
|
||||
_selector.set_timeout(_param_com_rc_loss_t.get() * 1_s);
|
||||
@@ -176,7 +177,9 @@ void ManualControl::Run()
|
||||
if (switches.arm_switch != _previous_switches.arm_switch) {
|
||||
if (_param_com_arm_swisbtn.get()) {
|
||||
// Arming button
|
||||
if (switches.arm_switch == manual_control_switches_s::SWITCH_POS_ON) {
|
||||
_button_hysteresis.set_state_and_update(switches.arm_switch == manual_control_switches_s::SWITCH_POS_ON, now);
|
||||
|
||||
if (_button_hysteresis.get_state()) {
|
||||
send_arm_command(ArmingAction::TOGGLE, ArmingOrigin::BUTTON);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@ private:
|
||||
|
||||
systemlib::Hysteresis _stick_arm_hysteresis{false};
|
||||
systemlib::Hysteresis _stick_disarm_hysteresis{false};
|
||||
systemlib::Hysteresis _button_hysteresis{false};
|
||||
|
||||
ManualControlSelector _selector;
|
||||
bool _published_invalid_once{false};
|
||||
|
||||
Reference in New Issue
Block a user