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:
Jacob Walser 2017-10-25 21:43:23 -04:00
parent b514fd29eb
commit 98e0ac1aee

View File

@ -59,10 +59,7 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
int16_t throttleBase = 1500-500*throttleScale; int16_t throttleBase = 1500-500*throttleScale;
bool shift = false; bool shift = false;
static uint32_t buttonDebounce;
// Debouncing timer
if (tnow_ms - buttonDebounce > 100) {
// Detect if any shift button is pressed // Detect if any shift button is pressed
for (uint8_t i = 0 ; i < 16 ; i++) { for (uint8_t i = 0 ; i < 16 ; i++) {
if ((buttons & (1 << i)) && get_button(i)->function() == JSButton::button_function_t::k_shift) { if ((buttons & (1 << i)) && get_button(i)->function() == JSButton::button_function_t::k_shift) {
@ -75,12 +72,10 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
for (uint8_t i = 0 ; i < 16 ; i++) { for (uint8_t i = 0 ; i < 16 ; i++) {
if ((buttons & (1 << i))) { if ((buttons & (1 << i))) {
handle_jsbutton_press(i,shift,(buttons_prev & (1 << i))); handle_jsbutton_press(i,shift,(buttons_prev & (1 << i)));
buttonDebounce = tnow_ms;
} }
} }
buttons_prev = buttons; buttons_prev = buttons;
}
// Set channels to override // Set channels to override
if (!roll_pitch_flag) { if (!roll_pitch_flag) {