Closed gringow831 closed 1 year ago
Is IsEnabled()
the way to go in order to save the disable enable to EEPROM? I can't seem to make it work
void setup() {
savedSetting = EEPROM.read(0);
if (savedSetting != first2[2].isEnabled())
{ }
else
savedSetting = first2[2].isEnabled();
savedSetting_1 = EEPROM.read(1);
if (savedSetting_1 != second2[2].isEnabled())
{ }
else
savedSetting_1 = second2[2].isEnabled();
NoteButton::disable(second2); //disable the second2 NoteButton
//if pressed while boot enable the first3 button (IT BREAKS THE CODE IF THE FIRST2 ARE ALREADY SELECTED BUT NECESARY IF SAVED SECOND2 TO GO BACK)
if (btn5.update()) {
if (btn5.getState()==Button::Released){
}
if (btn5.getState()==Button::Falling){
NoteButton::enable(first2);
NoteButton::disable(second2);
}}
//enable second3 and disable first3 NoteButtons
if (btn7.update()) {
if (btn7.getState()==Button::Released){
}
if (btn7.getState()==Button::Falling){
NoteButton::disable(first2);
NoteButton::enable(second2);
}
}
}
void loop() {
Control_Surface.loop();
auto currSetting = first2[2].isEnabled();
if (savedSetting != currSetting) {
EEPROM.write(0, currSetting);
savedSetting = currSetting;
}
auto currSetting_1 = second2[2].isEnabled();
if (savedSetting_1 != currSetting_1) {
EEPROM.write(1, currSetting_1);
savedSetting_1 = currSetting_1;
}
}
Is it possible to save the settings and reload them if the settings were modified at the setup? In my example I have managed to change which "mode" is being used at the setup stage but I would like that to reload when reconnecting rather than every time needing to follow the process manually
I can't seem to find the solution to this problem, I tried many ways and wouldn't want to break the teensy by adding EEPROM.write inside the Button state at the setup stage just before reading the memory again.
At the moment to enable and disable the buttons I use a dipswitch but I am trying to modify this to use button combinations. I managed with one button at a time at the setup stage since I want to have this selected and saved. Is there a way to use a combination of 2 buttons to change that mode? (enable or disable the first2 or second2?
The second part is I have been trying to modify my previous projects to save that selection on the EEPROM. The address that has been enabled or disabled since there will be 5 different "modes" I want to keep the last action rather than every time the controller gets connected needing to select the mode I'd like to work on.