|
AwesomeStudioPedal
A programmable, multi-profile foot controller for DAWs, score readers, and studio automation
|
Manages up to MAX_PROFILES profiles with LED feedback. More...
#include <profile_manager.h>
Public Member Functions | |
| ProfileManager (std::vector< ILEDController * > leds) | |
| void | addProfile (uint8_t profileIndex, std::unique_ptr< Profile > profile) |
| Action * | getAction (uint8_t profileIndex, uint8_t button) const |
| const Profile * | getProfile (uint8_t profileIndex) const |
| uint8_t | switchProfile () |
| Advance to the next populated profile slot and trigger blink feedback. | |
| uint8_t | getCurrentProfile () const |
| void | setCurrentProfile (uint8_t profileIndex) |
| Directly set the current profile without triggering blink feedback. | |
| const std::string & | getProfileName (uint8_t profileIndex) const |
| void | resetToFirstProfile () |
| Reset to the first populated slot (or slot 0 if all empty) | |
| bool | hasActiveDelayedAction () const |
| Returns true if any DelayedAction across all profiles is currently running. | |
| void | update (uint32_t now) |
| Drive timed LED behaviour — call every loop iteration. | |
Static Public Member Functions | |
| static const char * | getActionTypeString (Action::Type actionType) |
Static Public Attributes | |
| static constexpr uint8_t | MAX_PROFILES = 63 |
| 2^6 − 1 (6 select LEDs max) | |
| static constexpr uint8_t | MAX_SELECT_LEDS = 6 |
Manages up to MAX_PROFILES profiles with LED feedback.
LED encoding (chosen at runtime based on numProfiles vs numSelectLeds):
Maximum profiles for a given wiring: 2^numSelectLeds − 1.
After a profile switch all select LEDs blink 3 times, then return to the encoding for the new profile. Drive this by calling update() every loop.
Definition at line 25 of file profile_manager.h.
|
explicit |
| leds | Pointers to LED controllers for profile-select LEDs. Size must match hardwareConfig.numSelectLeds. |
Definition at line 6 of file profile_manager.cpp.
| void ProfileManager::addProfile | ( | uint8_t | profileIndex, |
| std::unique_ptr< Profile > | profile | ||
| ) |
Definition at line 11 of file profile_manager.cpp.
| Action * ProfileManager::getAction | ( | uint8_t | profileIndex, |
| uint8_t | button | ||
| ) | const |
Definition at line 19 of file profile_manager.cpp.
|
static |
Definition at line 193 of file profile_manager.cpp.
|
inline |
Definition at line 51 of file profile_manager.h.
| const Profile * ProfileManager::getProfile | ( | uint8_t | profileIndex | ) | const |
Definition at line 28 of file profile_manager.cpp.
| const std::string & ProfileManager::getProfileName | ( | uint8_t | profileIndex | ) | const |
Definition at line 163 of file profile_manager.cpp.
| bool ProfileManager::hasActiveDelayedAction | ( | ) | const |
Returns true if any DelayedAction across all profiles is currently running.
Definition at line 173 of file profile_manager.cpp.
| void ProfileManager::resetToFirstProfile | ( | ) |
Reset to the first populated slot (or slot 0 if all empty)
Called after loadFromString clears and repopulates all slots so that currentProfile is never left pointing at an empty slot.
Definition at line 147 of file profile_manager.cpp.
| void ProfileManager::setCurrentProfile | ( | uint8_t | profileIndex | ) |
Directly set the current profile without triggering blink feedback.
Used to restore a saved profile on boot. Caller must ensure the profile slot is populated before calling.
Definition at line 138 of file profile_manager.cpp.
| uint8_t ProfileManager::switchProfile | ( | ) |
Advance to the next populated profile slot and trigger blink feedback.
Skips empty slots and wraps around. Triggers a 3-blink sequence on all select LEDs; the LEDs return to the profile encoding after the sequence completes.
Definition at line 37 of file profile_manager.cpp.
| void ProfileManager::update | ( | uint32_t | now | ) |
Drive timed LED behaviour — call every loop iteration.
| now | Current time in milliseconds (millis()) |
Definition at line 96 of file profile_manager.cpp.
|
staticconstexpr |
2^6 − 1 (6 select LEDs max)
Definition at line 28 of file profile_manager.h.
|
staticconstexpr |
Definition at line 29 of file profile_manager.h.