From dd362158b745b6d4daeb11b23908beba71d5cd7a Mon Sep 17 00:00:00 2001 From: Andrea Martelloni Date: Tue, 29 Apr 2025 17:47:32 +0100 Subject: [PATCH] Made debouncing more robust --- src/memllib | 2 +- subtractivesynthIML.ino | 28 ++++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/memllib b/src/memllib index e0d2a5c..c9e8700 160000 --- a/src/memllib +++ b/src/memllib @@ -1 +1 @@ -Subproject commit e0d2a5ce112f76e337f697ad1a52df981cab88f9 +Subproject commit c9e870062b6125b40ee1a295dd196880f30cd218 diff --git a/subtractivesynthIML.ino b/subtractivesynthIML.ino index 4e59c0e..20dfc29 100644 --- a/subtractivesynthIML.ino +++ b/subtractivesynthIML.ino @@ -100,19 +100,23 @@ public: void SaveInput(saving_mode_t mode) { - if (STORE_VALUE_MODE == mode) { + if (training_mode_ == TRAINING_MODE) { + if (STORE_VALUE_MODE == mode) { - Serial.println("Move input to position..."); - perform_inference_ = false; + Serial.println("Move input to position..."); + perform_inference_ = false; - } else { // STORE_POSITION_MODE + } else { // STORE_POSITION_MODE - Serial.println("Creating example in this position."); - // Save pair in the dataset - dataset_->Add(input_state_, output_state_); - perform_inference_ = true; - MLInference_(input_state_); + Serial.println("Creating example in this position."); + // Save pair in the dataset + dataset_->Add(input_state_, output_state_); + perform_inference_ = true; + MLInference_(input_state_); + } + } else { + Serial.println("Switch to training mode first."); } } @@ -121,6 +125,8 @@ public: if (training_mode_ == TRAINING_MODE) { Serial.println("Clearing dataset..."); dataset_->Clear(); + } else { + Serial.println("Switch to training mode first."); } } @@ -130,6 +136,8 @@ public: Serial.println("Randomising weights..."); MLRandomise_(); MLInference_(input_state_); + } else { + Serial.println("Switch to training mode first."); } } @@ -418,7 +426,7 @@ void bind_interface(std::shared_ptr interface) void setup() { Serial.begin(115200); - while (!Serial) {} + //while (!Serial) {} Serial.println("Serial initialised."); WRITE_VOLATILE(serial_ready, true);