From 73f66c34c61855f52f43ec56ce070237497c5b87 Mon Sep 17 00:00:00 2001 From: Adam Wonak Date: Sun, 29 Jun 2025 22:41:28 -0700 Subject: [PATCH] euclidean save state --- examples/Gravity/save_state.cpp | 4 ++++ examples/Gravity/save_state.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/Gravity/save_state.cpp b/examples/Gravity/save_state.cpp index f7529ed..aca6977 100644 --- a/examples/Gravity/save_state.cpp +++ b/examples/Gravity/save_state.cpp @@ -30,6 +30,8 @@ bool StateManager::initialize(AppState& app) { ch.setSwing(saved_ch_state.base_shuffle); ch.setCvSource(static_cast(saved_ch_state.cv_source)); ch.setCvDestination(static_cast(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(ch.getCvSource()); save_ch.cv_destination = static_cast(ch.getCvDestination()); + save_ch.euc_steps = ch.getSteps(); + save_ch.euc_hits = ch.getHits(); } EEPROM.put(sizeof(Metadata), save_data); } diff --git a/examples/Gravity/save_state.h b/examples/Gravity/save_state.h index 7ca9df5..8a814c6 100644 --- a/examples/Gravity/save_state.h +++ b/examples/Gravity/save_state.h @@ -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 {