euclidean save state

This commit is contained in:
2025-06-29 22:41:28 -07:00
parent 16d47df926
commit 73f66c34c6
2 changed files with 7 additions and 1 deletions

View File

@ -30,6 +30,8 @@ bool StateManager::initialize(AppState& app) {
ch.setSwing(saved_ch_state.base_shuffle);
ch.setCvSource(static_cast<CvSource>(saved_ch_state.cv_source));
ch.setCvDestination(static_cast<CvDestination>(saved_ch_state.cv_destination));
ch.setSteps(saved_ch_state.euc_steps);
ch.setHits(saved_ch_state.euc_hits);
}
return true;
@ -109,6 +111,8 @@ void StateManager::_saveState(const AppState& app) {
save_ch.base_shuffle = ch.getSwing();
save_ch.cv_source = static_cast<byte>(ch.getCvSource());
save_ch.cv_destination = static_cast<byte>(ch.getCvDestination());
save_ch.euc_steps = ch.getSteps();
save_ch.euc_hits = ch.getHits();
}
EEPROM.put(sizeof(Metadata), save_data);
}

View File

@ -9,7 +9,7 @@ struct AppState;
// Define the constants for the current firmware.
const char SKETCH_NAME[] = "Gravity";
const byte SKETCH_VERSION = 5;
const byte SKETCH_VERSION = 6;
// Define the minimum amount of time between EEPROM writes.
static const unsigned long SAVE_DELAY_MS = 2000;
@ -44,6 +44,8 @@ class StateManager {
byte base_shuffle;
byte cv_source; // Cast the CvSource enum to a byte for storage
byte cv_destination; // Cast the CvDestination enum as a byte for storage
byte euc_steps;
byte euc_hits;
};
// This struct holds all the parameters we want to save.
struct EepromData {