From 10640381387bac9893122e9fd7a2530e52522e50 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Tue, 7 Feb 2023 21:12:02 +0000 Subject: [PATCH] Another try --- usbcontroller.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usbcontroller.cpp b/usbcontroller.cpp index 3554542..e1ca43b 100644 --- a/usbcontroller.cpp +++ b/usbcontroller.cpp @@ -475,7 +475,7 @@ void usbController::runTimer() lastData = data; } } - else if (usbDevice == eCoderPlus && data.length() >= 0x0f) { + else if (usbDevice == eCoderPlus && data.length() >= 0x0f && (quint8)data[0] == 0xff) { /* Button matrix: DATA2 DATA 1 7654321076543210 @@ -494,7 +494,7 @@ void usbController::runTimer() 0000000000000100 = button2 0000000000000010 = button1 */ - quint16 tempButtons = (data[2] << 8) | (data[1] & 0xff); + quint16 tempButtons = ((quint8)data[2] << 8) | ((quint8)data[1] & 0xff); if (buttons != tempButtons) {