AwesomeStudioPedal
A programmable, multi-profile foot controller for DAWs, score readers, and studio automation
Loading...
Searching...
No Matches
profile_manager.h
Go to the documentation of this file.
1#pragma once
2#include "config.h"
3#include "i_led_controller.h"
4#include "profile.h"
5#include <array>
6#include <memory>
7#include <vector>
8
26{
27public:
28 static constexpr uint8_t MAX_PROFILES = 63;
29 static constexpr uint8_t MAX_SELECT_LEDS = 6;
30
35 explicit ProfileManager(std::vector<ILEDController*> leds);
36
37 void addProfile(uint8_t profileIndex, std::unique_ptr<Profile> profile);
38 Action* getAction(uint8_t profileIndex, uint8_t button) const;
39 const Profile* getProfile(uint8_t profileIndex) const;
40
49 uint8_t switchProfile();
50
51 uint8_t getCurrentProfile() const { return currentProfile; }
52
59 void setCurrentProfile(uint8_t profileIndex);
60
61 const std::string& getProfileName(uint8_t profileIndex) const;
62
70
74 bool hasActiveDelayedAction() const;
75
81 void update(uint32_t now);
82
83 static const char* getActionTypeString(Action::Type actionType);
84
85private:
86 void updateLEDs();
87
88 std::array<std::unique_ptr<Profile>, MAX_PROFILES> profileSlots;
89 uint8_t currentProfile = 0;
90
91 std::vector<ILEDController*> selectLeds;
93 // Post-switch blink state
94 bool postSwitchBlink = false;
95 bool blinkStarted = false;
96 uint32_t blinkStartTime = 0;
97 uint8_t blinkPhase = 0; // counts half-cycles (on/off)
98 static constexpr uint8_t BLINK_COUNT = 3; // full on/off cycles
99 static constexpr uint32_t BLINK_INTERVAL = 150; // ms per half-cycle
100};
Base class for all pedal actions.
Definition action.h:12
Manages up to MAX_PROFILES profiles with LED feedback.
bool hasActiveDelayedAction() const
Returns true if any DelayedAction across all profiles is currently running.
const std::string & getProfileName(uint8_t profileIndex) const
const Profile * getProfile(uint8_t profileIndex) const
static constexpr uint8_t MAX_PROFILES
2^6 − 1 (6 select LEDs max)
Action * getAction(uint8_t profileIndex, uint8_t button) const
uint8_t getCurrentProfile() const
static const char * getActionTypeString(Action::Type actionType)
static constexpr uint8_t MAX_SELECT_LEDS
void resetToFirstProfile()
Reset to the first populated slot (or slot 0 if all empty)
void setCurrentProfile(uint8_t profileIndex)
Directly set the current profile without triggering blink feedback.
void update(uint32_t now)
Drive timed LED behaviour — call every loop iteration.
uint8_t switchProfile()
Advance to the next populated profile slot and trigger blink feedback.
void addProfile(uint8_t profileIndex, std::unique_ptr< Profile > profile)
Represents a single button configuration profile.
Definition profile.h:15