diff --git a/arch/sim/src/up_ajoystick.c b/arch/sim/src/up_ajoystick.c index 00c2163b00..839338bf7a 100644 --- a/arch/sim/src/up_ajoystick.c +++ b/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 */ + 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); + g_ajoy_handler(&g_ajoylower, g_ajoy_arg); + } } } diff --git a/configs/sim/traveler/defconfig b/configs/sim/traveler/defconfig index f12eb8df7d..66087787f4 100644 --- a/configs/sim/traveler/defconfig +++ b/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