Introduce Save/Load banks for storing different preset settings. #11

Merged
awonak merged 8 commits from save-load-slots into main 2025-07-04 17:33:58 +00:00
7 changed files with 216 additions and 119 deletions
Showing only changes of commit d705f57799 - Show all commits

View File

@ -28,8 +28,7 @@ static const int CLOCK_MOD[MOD_CHOICE_SIZE] PROGMEM = {
// Internal Clock Unity // Internal Clock Unity
1, 1,
// Divisors // Divisors
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 24, 32, 64, 128 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 24, 32, 64, 128};
};
// This represents the number of clock pulses for a 96 PPQN clock source // This represents the number of clock pulses for a 96 PPQN clock source
// that match the above div/mult mods. // that match the above div/mult mods.
@ -39,8 +38,7 @@ static const int CLOCK_MOD_PULSES[MOD_CHOICE_SIZE] PROGMEM = {
// Internal Clock Pulses // Internal Clock Pulses
96, 96,
// Divisor Pulses (96 * X) // Divisor Pulses (96 * X)
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_INDEX = 8; // x1 or 96 PPQN. static const byte DEFAULT_CLOCK_MOD_INDEX = 8; // x1 or 96 PPQN.
@ -216,7 +214,7 @@ class Channel {
return; return;
} }
int dest_mod = _calculateMod(CV_DEST_MOD, cv1_val, cv2_val, -(MOD_CHOICE_SIZE/2), MOD_CHOICE_SIZE/2); int dest_mod = _calculateMod(CV_DEST_MOD, cv1_val, cv2_val, -(MOD_CHOICE_SIZE / 2), MOD_CHOICE_SIZE / 2);
cvmod_clock_mod_index = constrain(base_clock_mod_index + dest_mod, 0, 100); cvmod_clock_mod_index = constrain(base_clock_mod_index + dest_mod, 0, 100);
int prob_mod = _calculateMod(CV_DEST_PROB, cv1_val, cv2_val, -50, 50); int prob_mod = _calculateMod(CV_DEST_PROB, cv1_val, cv2_val, -50, 50);

View File

@ -42,7 +42,6 @@ class StateManager {
// Indicate that state has changed and we should save. // Indicate that state has changed and we should save.
void markDirty(); void markDirty();
// This struct holds the data that identifies the firmware version. // This struct holds the data that identifies the firmware version.
struct Metadata { struct Metadata {
byte version; byte version;
@ -70,6 +69,7 @@ class StateManager {
byte selected_save_slot; byte selected_save_slot;
ChannelState channel_data[Gravity::OUTPUT_COUNT]; ChannelState channel_data[Gravity::OUTPUT_COUNT];
}; };
private: private:
bool _isDataValid(); bool _isDataValid();
void _saveMetadata(); void _saveMetadata();