Made it possible to use the controller hat when entering the UI mode passkey.

This commit is contained in:
Leon Styhre 2020-12-23 22:30:53 +01:00
parent 9909260480
commit 045e66103a

View file

@ -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;
}