From 045e66103a88d26f698f883cafa418338d7b01d8 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 23 Dec 2020 22:30:53 +0100 Subject: [PATCH] Made it possible to use the controller hat when entering the UI mode passkey. --- es-app/src/views/UIModeController.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/es-app/src/views/UIModeController.cpp b/es-app/src/views/UIModeController.cpp index 251a0c99e..75cd0b19f 100644 --- a/es-app/src/views/UIModeController.cpp +++ b/es-app/src/views/UIModeController.cpp @@ -72,8 +72,7 @@ bool UIModeController::inputIsMatch(InputConfig* config, Input input) // When we have reached the end of the list, trigger UI_mode unlock. void UIModeController::unlockUIMode() { - LOG(LogDebug) << - " UIModeController::listen(): Passkey sequence completed, switching UIMode to Full"; + LOG(LogInfo) << "Passkey sequence completed, switching UI mode to Full"; Settings::getInstance()->setString("UIMode", "full"); Settings::getInstance()->saveFile(); mPassKeyCounter = 0; @@ -138,10 +137,18 @@ std::string UIModeController::getFormattedPassKeyStr() bool UIModeController::isValidInput(InputConfig* config, Input input) { - if ((config->getMappedTo(input).size() == 0) || // Not a mapped input, so ignore.. - (input.type == TYPE_HAT) || // Ignore all hat inputs. + if ((config->getMappedTo(input).size() == 0) || // Not a mapped input, so ignore it. (!input.value)) // Not a key-down event. return false; + else if (input.type == TYPE_HAT) { + // When the hat goes back to neutral, getMappedTo() will return entries for all + // four directions as the neutral cancels any of them out. So a neutral is + // equivalent to a key-up event and should therefore be ignored. + if (config->getMappedTo(input).size() == 4) + return false; + else + return true; + } else return true; }