Skip to content

Commit

Permalink
Reverse logic for input validation. Now only use input that are both …
Browse files Browse the repository at this point in the history
…mapped to something, and of value !=0.
  • Loading branch information
zigurana committed Nov 30, 2017
1 parent ca046f7 commit 846243d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions es-app/src/views/UIModeController.cpp
Expand Up @@ -144,19 +144,21 @@ void UIModeController::logInput(InputConfig * config, Input input)
mapname += mn;
mapname += ", ";
}
LOG(LogDebug) << "UIModeController::logInput( " << config->getDeviceName() <<" ):" << input.string() << ", isMappedTo= " << mapname << ", value=" << input.value;
LOG(LogDebug) << "UIModeController::logInput( " << config->getDeviceName() <<" ):" <<
input.string() << ", isMappedTo= " << mapname <<", value=" << input.value << ", isValidInput: " <<
(isValidInput(config,input)? "yes" : "no");
}


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
(!input.value)) // not a key-down event
if((config->getMappedTo(input).size() != 0) && // a mapped input, and
(input.value != 0)) // a key-down event
{
return false;
return true;
}
else
{
return true;
return false;
}
}

0 comments on commit 846243d

Please sign in to comment.