From c362c0406541169df2e26d326c7248a7bbdf1af7 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Sat, 26 Nov 2016 23:56:45 -0600 Subject: [PATCH] The Xbox button on the Xbox One controller was not read properly XBOX_BUTTONS is stored in PROGMEM --- XBOXONE.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/XBOXONE.cpp b/XBOXONE.cpp index 0698a6aa..d3f1fd77 100644 --- a/XBOXONE.cpp +++ b/XBOXONE.cpp @@ -260,9 +260,9 @@ void XBOXONE::readReport() { if(readBuf[0] == 0x07) { // The XBOX button has a separate message if(readBuf[4] == 1) - ButtonState |= XBOX_BUTTONS[XBOX]; + ButtonState |= pgm_read_word(&XBOX_BUTTONS[XBOX]); else - ButtonState &= ~XBOX_BUTTONS[XBOX]; + ButtonState &= ~pgm_read_word(&XBOX_BUTTONS[XBOX]); } if(readBuf[0] != 0x20) { // Check if it's the correct report, otherwise return - the controller also sends different status reports #ifdef EXTRADEBUG @@ -272,7 +272,7 @@ void XBOXONE::readReport() { return; } - uint16_t xbox = ButtonState & XBOX_BUTTONS[XBOX]; // Since the XBOX button is separate, save it and add it back in + uint16_t xbox = ButtonState & pgm_read_word(&XBOX_BUTTONS[XBOX]); // Since the XBOX button is separate, save it and add it back in // xbox button from before, dpad, abxy, start/back, sync, stick click, shoulder buttons ButtonState = xbox | (((uint16_t)readBuf[5] & 0xF) << 8) | (readBuf[4] & 0xF0) | (((uint16_t)readBuf[4] & 0x0C) << 10) | ((readBuf[4] & 0x01) << 3) | (((uint16_t)readBuf[5] & 0xC0) << 8) | ((readBuf[5] & 0x30) >> 4);