Skip to content

Commit

Permalink
Moved profile change event to setProfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepparks committed Dec 28, 2024
1 parent 87a733a commit 2554f90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/configs/webconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,6 @@ std::string setGamepadOptions()

GamepadOptions& gamepadOptions = Storage::getInstance().getGamepadOptions();

uint8_t prevProfileNumber = gamepadOptions.profileNumber;

readDoc(gamepadOptions.dpadMode, doc, "dpadMode");
readDoc(gamepadOptions.inputMode, doc, "inputMode");
readDoc(gamepadOptions.socdMode, doc, "socdMode");
Expand All @@ -671,7 +669,6 @@ std::string setGamepadOptions()
readDoc(gamepadOptions.xinputAuthType, doc, "xinputAuthType");
readDoc(gamepadOptions.ps4ControllerIDMode, doc, "ps4ControllerIDMode");

EventManager::getInstance().triggerEvent(new GPProfileChangeEvent(prevProfileNumber, gamepadOptions.profileNumber));

HotkeyOptions& hotkeyOptions = Storage::getInstance().getHotkeyOptions();
save_hotkey(&hotkeyOptions.hotkey01, doc, "hotkey01");
Expand Down
2 changes: 2 additions & 0 deletions src/storagemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "BoardConfig.h"
#include "AnimationStorage.hpp"
#include "FlashPROM.h"
#include "eventmanager.h"
#include "peripheralmanager.h"
#include "config.pb.h"
#include "hardware/watchdog.h"
Expand Down Expand Up @@ -130,6 +131,7 @@ bool Storage::setProfile(const uint32_t profileNum)
// is this profile enabled?
// profile 1 (core) is always enabled, others we must check
if (profileNum == 1 || config.profileOptions.gpioMappingsSets[profileNum-2].enabled) {
EventManager::getInstance().triggerEvent(new GPProfileChangeEvent(this->config.gamepadOptions.profileNumber, profileNum));
this->config.gamepadOptions.profileNumber = profileNum;
return true;
}
Expand Down

0 comments on commit 2554f90

Please sign in to comment.