Skip to content

Commit

Permalink
only load a profile if profileNum exists and is enabled (#1167)
Browse files Browse the repository at this point in the history
only load a profile if it profileNum exists and is enabled
  • Loading branch information
bsstephan authored Sep 30, 2024
1 parent 9780430 commit 2ec1f04
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/storagemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,12 @@ char* Storage::currentProfileLabel() {
void Storage::setFunctionalPinMappings()
{
GpioMappingInfo* alts = nullptr;
if (config.gamepadOptions.profileNumber >= 2 && config.gamepadOptions.profileNumber <= 4)
alts = this->config.profileOptions.gpioMappingsSets[config.gamepadOptions.profileNumber-2].pins;
if (config.gamepadOptions.profileNumber >= 2 &&
config.gamepadOptions.profileNumber <= config.profileOptions.gpioMappingsSets_count + 1) {
if (config.profileOptions.gpioMappingsSets[config.gamepadOptions.profileNumber-2].enabled) {
alts = config.profileOptions.gpioMappingsSets[config.gamepadOptions.profileNumber-2].pins;
}
}

for (Pin_t pin = 0; pin < (Pin_t)NUM_BANK0_GPIOS; pin++) {
// assign the functional pin to the profile pin if:
Expand Down

0 comments on commit 2ec1f04

Please sign in to comment.