From e412e9edfcd0291d19c8f5da584c5bc3af13b59a Mon Sep 17 00:00:00 2001 From: EmanuelFeru Date: Tue, 22 Dec 2020 20:16:57 +0100 Subject: [PATCH] Fix Nunchuk + UART - fixed Nunchuck timeout when UART was enabled --- Src/util.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Src/util.c b/Src/util.c index 7b9c9be..c0b2adb 100644 --- a/Src/util.c +++ b/Src/util.c @@ -805,16 +805,16 @@ void readInputRaw(void) { #endif #if defined(CONTROL_NUNCHUK) || defined(SUPPORT_NUNCHUK) - if (inIdx == CONTROL_NUNCHUK) { - if (nunchuk_connected != 0) { - Nunchuk_Read(); + if (nunchuk_connected) { + Nunchuk_Read(); + if (inIdx == CONTROL_NUNCHUK) { input1[inIdx].raw = (nunchuk_data[0] - 127) * 8; // X axis 0-255 input2[inIdx].raw = (nunchuk_data[1] - 128) * 8; // Y axis 0-255 - #ifdef SUPPORT_BUTTONS - button1 = (uint8_t)nunchuk_data[5] & 1; - button2 = (uint8_t)(nunchuk_data[5] >> 1) & 1; - #endif } + #ifdef SUPPORT_BUTTONS + button1 = (uint8_t)nunchuk_data[5] & 1; + button2 = (uint8_t)(nunchuk_data[5] >> 1) & 1; + #endif } #endif