settings saved to EEPROM on play/pause
This commit is contained in:
@ -25,7 +25,7 @@ const int outsPins[6] = {5, 6, 7, 8, 9, 10};
|
||||
|
||||
const int clockModes[18] = {-24, -16, -12, -8, -6, -4, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 16, 32}; //positive - divide, negative - multiply, 0 - off
|
||||
|
||||
int bpm = 130;
|
||||
unsigned int bpm = 130;
|
||||
|
||||
struct channel {
|
||||
unsigned int mode;
|
||||
@ -76,8 +76,9 @@ RotaryEncoder encoder(ENC_D1_PIN, ENC_D2_PIN, RotaryEncoder::LatchMode::TWO03);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
channels[2].mode = 5;
|
||||
Serial.println(channels[2].mode);
|
||||
|
||||
EEPROM.get(0, bpm);
|
||||
EEPROM.get(sizeof(int), channels);
|
||||
|
||||
pinMode(INPUT_CONNECTED_PIN, INPUT_PULLUP);
|
||||
pinMode(ENC_BTN_PIN, INPUT_PULLUP);
|
||||
@ -193,6 +194,11 @@ void resetClocks() {
|
||||
}
|
||||
}
|
||||
|
||||
void saveState() {
|
||||
EEPROM.put(0, bpm);
|
||||
EEPROM.put(sizeof(int), channels);
|
||||
}
|
||||
|
||||
void checkInputs() {
|
||||
|
||||
//input jack switcch
|
||||
@ -273,6 +279,7 @@ void checkInputs() {
|
||||
isPlaying = !isPlaying;
|
||||
resetClocks();
|
||||
playBtnPushed = true;
|
||||
saveState();
|
||||
} else if (digitalRead(START_STOP_BTN_PIN) && playBtnPushed) {
|
||||
playBtnPushed = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user