diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-12-14 12:23:19 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-12-14 12:23:19 -0600 |
commit | ac25e89f6e71e097ec3da57d525f398244eff155 (patch) | |
tree | a1b4597da5f284a04f1e48d4eb0c5637f318079b /nuttx | |
parent | afc9c582e202a7aa190ca398f3694191a619079c (diff) | |
download | px4-nuttx-ac25e89f6e71e097ec3da57d525f398244eff155.tar.gz px4-nuttx-ac25e89f6e71e097ec3da57d525f398244eff155.tar.bz2 px4-nuttx-ac25e89f6e71e097ec3da57d525f398244eff155.zip |
Various fixes to traveler joystick input logic and to simulated joystick device
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/sim/src/up_ajoystick.c | 20 | ||||
-rw-r--r-- | nuttx/configs/sim/traveler/defconfig | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/nuttx/arch/sim/src/up_ajoystick.c b/nuttx/arch/sim/src/up_ajoystick.c index 00c2163b0..839338bf7 100644 --- a/nuttx/arch/sim/src/up_ajoystick.c +++ b/nuttx/arch/sim/src/up_ajoystick.c @@ -221,12 +221,12 @@ int up_buttonevent(int x, int y, int buttons) g_ajoy_sample.as_buttons |= AJOY_BUTTON_1_BIT; } - if ((buttons & 1) != 0) + if ((buttons & 2) != 0) { g_ajoy_sample.as_buttons |= AJOY_BUTTON_2_BIT; } - if ((buttons & 1) != 0) + if ((buttons & 4) != 0) { g_ajoy_sample.as_buttons |= AJOY_BUTTON_3_BIT; } @@ -242,14 +242,16 @@ int up_buttonevent(int x, int y, int buttons) /* Check button presses */ changed = g_ajoy_buttons ^ g_ajoy_sample.as_buttons; - pressed = changed & (AJOY_SUPPORTED & g_ajoy_buttons); - released = changed & (AJOY_SUPPORTED & ~g_ajoy_buttons); - - if ((pressed & g_ajoy_pset) != 0 || (released & g_ajoy_rset) != 0) + if (changed != 0) { - /* Call the interrupt handler */ - - g_ajoy_handler(&g_ajoylower, g_ajoy_arg); + pressed = changed & (AJOY_SUPPORTED & g_ajoy_pset); + released = changed & (AJOY_SUPPORTED & ~g_ajoy_rset); + if ((pressed & g_ajoy_pset) != 0 || (released & g_ajoy_rset) != 0) + { + /* Call the interrupt handler */ + + g_ajoy_handler(&g_ajoylower, g_ajoy_arg); + } } } diff --git a/nuttx/configs/sim/traveler/defconfig b/nuttx/configs/sim/traveler/defconfig index f12eb8df7..66087787f 100644 --- a/nuttx/configs/sim/traveler/defconfig +++ b/nuttx/configs/sim/traveler/defconfig @@ -572,7 +572,7 @@ CONFIG_GRAPHICS_TRAVELER_JOYDEV="/dev/ajoy0" # CONFIG_GRAPHICS_TRAVELER_ROMFSDEMO=y # CONFIG_GRAPHICS_TRAVELER_PERFMON is not set -CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL=3 +CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL=0 # # Interpreters |