added check for settings in eeprom
This commit is contained in:
@ -35,11 +35,11 @@ struct channel {
|
||||
|
||||
channel channels[6] = { //array of channel settings
|
||||
{ 8, 0, 0, 0 },
|
||||
{ 9, 0, 0, 0 },
|
||||
{10, 0, 0, 0 },
|
||||
{ 7, 1, 0, 0 },
|
||||
{ 2, 0, 1, 4 },
|
||||
{ 6, 1, 1,-4 }
|
||||
{ 8, 0, 0, 0 },
|
||||
{ 8, 0, 0, 0 },
|
||||
{ 8, 0, 0, 0 },
|
||||
{ 8, 0, 0, 0 },
|
||||
{ 8, 0, 0, 0 }
|
||||
};
|
||||
|
||||
int outsClocksCounts[6];
|
||||
@ -76,9 +76,15 @@ RotaryEncoder encoder(ENC_D1_PIN, ENC_D2_PIN, RotaryEncoder::LatchMode::TWO03);
|
||||
void setup() {
|
||||
//Serial.begin(9600);
|
||||
|
||||
//saveState(); //for cases when structure is updated in the code
|
||||
EEPROM.get(0, bpm);
|
||||
EEPROM.get(sizeof(int), channels);
|
||||
//check last bit of eeprom to know if settings were stored
|
||||
if (EEPROM.read(1023) == 'H') {
|
||||
EEPROM.get(0, bpm);
|
||||
EEPROM.get(sizeof(int), channels);
|
||||
} else {
|
||||
saveState();
|
||||
EEPROM.write(1023, 'H');
|
||||
}
|
||||
|
||||
|
||||
pinMode(ENC_BTN_PIN, INPUT_PULLUP);
|
||||
pinMode(START_STOP_BTN_PIN, INPUT_PULLUP);
|
||||
|
||||
Reference in New Issue
Block a user