mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-24 17:48:35 -04:00
Sub: remove manual control button debounce timer
This was a really long time for a debounce, and this code belongs to the program actually polling for input.
This commit is contained in:
parent
b514fd29eb
commit
98e0ac1aee
@ -59,29 +59,24 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
|
||||
int16_t throttleBase = 1500-500*throttleScale;
|
||||
|
||||
bool shift = false;
|
||||
static uint32_t buttonDebounce;
|
||||
|
||||
// Debouncing timer
|
||||
if (tnow_ms - buttonDebounce > 100) {
|
||||
// Detect if any shift button is pressed
|
||||
for (uint8_t i = 0 ; i < 16 ; i++) {
|
||||
if ((buttons & (1 << i)) && get_button(i)->function() == JSButton::button_function_t::k_shift) {
|
||||
shift = true;
|
||||
}
|
||||
// Detect if any shift button is pressed
|
||||
for (uint8_t i = 0 ; i < 16 ; i++) {
|
||||
if ((buttons & (1 << i)) && get_button(i)->function() == JSButton::button_function_t::k_shift) {
|
||||
shift = true;
|
||||
}
|
||||
|
||||
// Act if button is pressed
|
||||
// Only act upon pressing button and ignore holding. This provides compatibility with Taranis as joystick.
|
||||
for (uint8_t i = 0 ; i < 16 ; i++) {
|
||||
if ((buttons & (1 << i))) {
|
||||
handle_jsbutton_press(i,shift,(buttons_prev & (1 << i)));
|
||||
buttonDebounce = tnow_ms;
|
||||
}
|
||||
}
|
||||
|
||||
buttons_prev = buttons;
|
||||
}
|
||||
|
||||
// Act if button is pressed
|
||||
// Only act upon pressing button and ignore holding. This provides compatibility with Taranis as joystick.
|
||||
for (uint8_t i = 0 ; i < 16 ; i++) {
|
||||
if ((buttons & (1 << i))) {
|
||||
handle_jsbutton_press(i,shift,(buttons_prev & (1 << i)));
|
||||
}
|
||||
}
|
||||
|
||||
buttons_prev = buttons;
|
||||
|
||||
// Set channels to override
|
||||
if (!roll_pitch_flag) {
|
||||
channels[0] = 1500 + pitchTrim; // pitch
|
||||
|
Loading…
Reference in New Issue
Block a user