diff --git a/include/constants.h b/include/constants.h index 8c902b5..55e1276 100644 --- a/include/constants.h +++ b/include/constants.h @@ -6,7 +6,7 @@ #define MEGAFM_CONSTANTS_H const byte kVersion0 = 3; -const byte kVersion1 = 2; +const byte kVersion1 = 3; const byte kDefaultSeq[16] = {0, 0, 0, 0, 12, 12, 12, 12, 0, 0, 12, 0, 0, 12, 12, 0}; diff --git a/include/preset.h b/include/preset.h index f1d5011..085c138 100644 --- a/include/preset.h +++ b/include/preset.h @@ -11,5 +11,5 @@ byte getByte(); void store(byte input); void eWrite(uint16_t theMemoryAddress, uint8_t u8Byte); uint8_t eRead(uint16_t theMemoryAddress); -void clearSSEG(); +void clearSSEG(bool allBanks); #endif // MEGAFM_CMAKE_PRESET_H diff --git a/src/MEGAfm.cpp b/src/MEGAfm.cpp index 94f4c75..a832f6e 100644 --- a/src/MEGAfm.cpp +++ b/src/MEGAfm.cpp @@ -343,7 +343,11 @@ void setup() { input = EEPROM.read(3966); stereoCh3 = bitRead(input, 0); - newWide = EEPROM.read(3970); + if (EEPROM.read(3970)) { + newWide = true; + } else { + newWide = false; + } input = EEPROM.read(3950); noiseTableLength[0] = 0; @@ -436,7 +440,7 @@ void setup() { // first boot into 3.X? clear the SSEG and Offsets so presets aren't crazy (yet)! if (EEPROM.read(3969) != 82) { - clearSSEG(); + clearSSEG(1); EEPROM.write(3969, 82); } @@ -469,8 +473,12 @@ void setup() { digit(1, 18); for (int i = 0; i < 4000; i++) { - EEPROM.write(i, kFactoryPresets[i]); + EEPROM.update(i, kFactoryPresets[i]); } + clearSSEG(0); + EEPROM.update(3970, 0); + newWide = false; + EEPROM.update(3969, 82); loadPreset(); eWrite(69, 69); diff --git a/src/midi.cpp b/src/midi.cpp index 7307868..1b6164a 100644 --- a/src/midi.cpp +++ b/src/midi.cpp @@ -795,8 +795,12 @@ void HandleControlChange(byte channel, byte number, byte val) { break; case 20: - newWide = constrain(val, 0, 1); - EEPROM.update(3970, constrain(val, 0, 1)); + if (val) { + newWide = true; + } else { + newWide = false; + } + EEPROM.update(3970, newWide); break; } } diff --git a/src/preset.cpp b/src/preset.cpp index c360491..337c02e 100644 --- a/src/preset.cpp +++ b/src/preset.cpp @@ -37,7 +37,7 @@ void panel() { void setIndex() { index = (preset * 79) + kBankOffsets[bank]; } -void clearSSEG() { +void clearSSEG(bool allBanks) { // show CL(ear) digit(1, 11); @@ -57,6 +57,8 @@ void clearSSEG() { index += 3; // skip the next 3 bytes } } + if (!allBanks) + b = 6; } }