nit pick fixes and docs

This commit is contained in:
2025-07-04 10:27:10 -07:00
parent e664f6c17b
commit c9d112f3fa
3 changed files with 9 additions and 3 deletions

View File

@ -42,7 +42,7 @@ static const int CLOCK_MOD_PULSES[MOD_CHOICE_SIZE] PROGMEM = {
192, 288, 384, 480, 576, 672, 768, 864, 960, 1056, 1152, 1536, 2304, 3072, 6144, 12288 192, 288, 384, 480, 576, 672, 768, 864, 960, 1056, 1152, 1536, 2304, 3072, 6144, 12288
}; };
static const byte DEFAULT_CLOCK_MOD = 8; // x1 or 96 PPQN. static const byte DEFAULT_CLOCK_MOD_INDEX = 8; // x1 or 96 PPQN.
class Channel { class Channel {
public: public:
@ -52,7 +52,7 @@ class Channel {
void Init() { void Init() {
// Reset base values to their defaults // Reset base values to their defaults
base_clock_mod_index = DEFAULT_CLOCK_MOD; base_clock_mod_index = DEFAULT_CLOCK_MOD_INDEX;
base_probability = 100; base_probability = 100;
base_duty_cycle = 50; base_duty_cycle = 50;
base_offset = 0; base_offset = 0;

View File

@ -18,6 +18,7 @@ bool StateManager::initialize(AppState& app) {
// Initialize eeprom and save default patter to all save slots. // Initialize eeprom and save default patter to all save slots.
reset(app); reset(app);
_saveMetadata(); _saveMetadata();
// MAX_SAVE_SLOTS slot is reserved for transient state.
for (int i = 0; i <= MAX_SAVE_SLOTS; i++) { for (int i = 0; i <= MAX_SAVE_SLOTS; i++) {
app.selected_save_slot = i; app.selected_save_slot = i;
_saveState(app, i); _saveState(app, i);

View File

@ -19,6 +19,11 @@ static const unsigned long SAVE_DELAY_MS = 2000;
/** /**
* @brief Manages saving and loading of the application state to and from EEPROM. * @brief Manages saving and loading of the application state to and from EEPROM.
* The number of user slots is defined by MAX_SAVE_SLOTS, and one additional slot
* is reseved for transient state to persist state between power cycles before
* state is explicitly saved to a user slot. Metadata is stored in the beginning
* of the memory space which stores firmware version information to validate that
* the data can be loaded into the current version of AppState.
*/ */
class StateManager { class StateManager {
public: public:
@ -28,7 +33,7 @@ class StateManager {
bool initialize(AppState& app); bool initialize(AppState& app);
// Load data from specified slot. // Load data from specified slot.
bool loadData(AppState& app, byte slot_index); bool loadData(AppState& app, byte slot_index);
// Save data to slot defined by app. // Save data to specified slot.
void saveData(const AppState& app); void saveData(const AppState& app);
// Reset AppState instance back to default values. // Reset AppState instance back to default values.
void reset(AppState& app); void reset(AppState& app);