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