Made debouncing more robust
This commit is contained in:
parent
fb3b1d7e61
commit
dd362158b7
2 changed files with 19 additions and 11 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit e0d2a5ce112f76e337f697ad1a52df981cab88f9
|
Subproject commit c9e870062b6125b40ee1a295dd196880f30cd218
|
||||||
|
|
@ -100,19 +100,23 @@ public:
|
||||||
|
|
||||||
void SaveInput(saving_mode_t mode)
|
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...");
|
Serial.println("Move input to position...");
|
||||||
perform_inference_ = false;
|
perform_inference_ = false;
|
||||||
|
|
||||||
} else { // STORE_POSITION_MODE
|
} else { // STORE_POSITION_MODE
|
||||||
|
|
||||||
Serial.println("Creating example in this position.");
|
Serial.println("Creating example in this position.");
|
||||||
// Save pair in the dataset
|
// Save pair in the dataset
|
||||||
dataset_->Add(input_state_, output_state_);
|
dataset_->Add(input_state_, output_state_);
|
||||||
perform_inference_ = true;
|
perform_inference_ = true;
|
||||||
MLInference_(input_state_);
|
MLInference_(input_state_);
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Serial.println("Switch to training mode first.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,6 +125,8 @@ public:
|
||||||
if (training_mode_ == TRAINING_MODE) {
|
if (training_mode_ == TRAINING_MODE) {
|
||||||
Serial.println("Clearing dataset...");
|
Serial.println("Clearing dataset...");
|
||||||
dataset_->Clear();
|
dataset_->Clear();
|
||||||
|
} else {
|
||||||
|
Serial.println("Switch to training mode first.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,6 +136,8 @@ public:
|
||||||
Serial.println("Randomising weights...");
|
Serial.println("Randomising weights...");
|
||||||
MLRandomise_();
|
MLRandomise_();
|
||||||
MLInference_(input_state_);
|
MLInference_(input_state_);
|
||||||
|
} else {
|
||||||
|
Serial.println("Switch to training mode first.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -418,7 +426,7 @@ void bind_interface(std::shared_ptr<IMLInterface> interface)
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
while (!Serial) {}
|
//while (!Serial) {}
|
||||||
Serial.println("Serial initialised.");
|
Serial.println("Serial initialised.");
|
||||||
WRITE_VOLATILE(serial_ready, true);
|
WRITE_VOLATILE(serial_ready, true);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue