From 043a20e167614d2e42f9515da65d3d5d79a0e31a Mon Sep 17 00:00:00 2001 From: DriftKingTW Date: Sat, 9 Dec 2023 20:36:54 +0800 Subject: [PATCH] fix: prevent emit rotary encoder keystroke when output is locked --- src/main.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d1fec50..aa91e1f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -580,10 +580,10 @@ void encoderTask(void *pvParameters) { if (direction.equals("CCW")) { resetIdle(); - if (isUsbMode) { + if (isUsbMode && !isOutputLocked) { usbKeyboard.release(onboardRotaryEncoders[0].rotaryCCW); usbKeyboard.write(onboardRotaryEncoders[0].rotaryCCW); - } else { + } else if (!isOutputLocked) { bleKeyboard.release(onboardRotaryEncoders[0].rotaryCCW); bleKeyboard.write(onboardRotaryEncoders[0].rotaryCCW); } @@ -591,10 +591,10 @@ void encoderTask(void *pvParameters) { currentKeyInfo = onboardRotaryEncoders[0].rotaryCCWInfo; } else if (direction.equals("CW")) { resetIdle(); - if (isUsbMode) { + if (isUsbMode && !isOutputLocked) { usbKeyboard.release(onboardRotaryEncoders[0].rotaryCW); usbKeyboard.write(onboardRotaryEncoders[0].rotaryCW); - } else { + } else if (!isOutputLocked) { bleKeyboard.release(onboardRotaryEncoders[0].rotaryCW); bleKeyboard.write(onboardRotaryEncoders[0].rotaryCW); } @@ -652,10 +652,10 @@ void encoderExtBoardTask(void *pvParameters) { if (trigger) { resetIdle(); if (direction.equals("CW")) { - if (isUsbMode) { + if (isUsbMode && !isOutputLocked) { usbKeyboard.write( rotaryExtRotaryEncoders[0].rotaryCW); - } else { + } else if (!isOutputLocked) { bleKeyboard.write( rotaryExtRotaryEncoders[0].rotaryCW); } @@ -663,10 +663,10 @@ void encoderExtBoardTask(void *pvParameters) { currentKeyInfo = rotaryExtRotaryEncoders[0].rotaryCWInfo; } else if (direction.equals("CCW")) { - if (isUsbMode) { + if (isUsbMode && !isOutputLocked) { usbKeyboard.write( rotaryExtRotaryEncoders[0].rotaryCCW); - } else { + } else if (!isOutputLocked) { bleKeyboard.write( rotaryExtRotaryEncoders[0].rotaryCCW); }