diff --git a/Software/GToE/GToE.ino b/Software/Gravity/Gravity.ino similarity index 88% rename from Software/GToE/GToE.ino rename to Software/Gravity/Gravity.ino index ee65cdc..0a2b421 100644 --- a/Software/GToE/GToE.ino +++ b/Software/Gravity/Gravity.ino @@ -5,7 +5,7 @@ #include #include -#define VERSION "REV2 PREP" +#define VERSION "0.9b" #define SCREEN_ADDRESS 0x3C @@ -43,29 +43,35 @@ const int outsPins[6] = { 7, 8, 10, 6, 9, 11 }; //*/ -const int clockModes[17] = { -24, -12, -8, -6, -4, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 16, 32 }; //positive - divide, negative - multiply, 0 - off +const int subDivs[17] = { -24, -12, -8, -6, -4, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 16, 32 }; //positive - divide, negative - multiply, 0 - off unsigned int bpm = 130; bool bpmModulationChannel; //0 - CV1, 1 - CV2 byte bpmModulationRange = 0; struct channel { - unsigned int mode; //need to be changed to subdiv - unsigned int random; - bool modulationChannel; //0 - CV1, 1 - CV2 - int modulationRange; - unsigned int offset; + byte mode; //0 - CLK, 1 - RND, 2 - SEQ + byte subDiv; + byte CV1Target; //0 - Off, 1 - Subdiv, 2 - RND, 3 - SeqPattern + byte CV1Value; + byte CV2Target; + byte CV2Value; + byte offset; + byte random; + byte seqPattern; }; channel channels[6] = { //array of channel settings - { 7, 0, 0, 0, 0 }, - { 7, 0, 0, 0, 0 }, - { 7, 0, 0, 0, 0 }, - { 7, 0, 0, 0, 0 }, - { 7, 0, 0, 0, 0 }, - { 7, 0, 0, 0, 0 } + { 0, 7, 0, 0, 0, 0, 0, 0 }, + { 0, 7, 1, 0, 0, 0, 0, 0 }, + { 0, 7, 2, 0, 0, 0, 0, 0 }, + { 0, 7, 0, 0, 3, 0, 0, 0 }, + { 0, 7, 0, 0, 0, 0, 0, 0 }, + { 0, 7, 0, 0, 0, 0, 0, 0 } }; +byte memCode = 'A'; //Change to different letter if you changed the data structure + int channelPulseCount[6]; int channelPulsesPerCycle[6]; int playingModes[6]; //actual channel modes array updated from channels object on each beat @@ -121,12 +127,11 @@ const unsigned char splash_logo[] PROGMEM = { 0xff, 0xc0, 0x00 }; - void setup() { //Serial.begin(9600); //check last bit in eeprom to know if the correct settings were stored - if (EEPROM.read(1023) == 'S') { + if (EEPROM.read(1023) == memCode) { int addr = 0; EEPROM.get(addr, bpm); addr = addr + sizeof(bpm); @@ -139,7 +144,7 @@ void setup() { EEPROM.get(addr, channels); } else { saveState(); - EEPROM.write(1023, 'S'); + EEPROM.write(1023, memCode); } pinMode(ENC_BTN_PIN, INPUT_PULLUP); @@ -308,7 +313,7 @@ void externalClock() { void sendTriggers() { for (int i = 0; i < 6; i++) { - if (playingModes[i] != clockModes[channels[i].mode]) { + if (playingModes[i] != subDivs[channels[i].mode]) { needPulseReset[i] = true; } } @@ -342,17 +347,18 @@ void sendTriggers() { void calculateCycles() { for (int i = 0; i < 6; i++) { - if (channels[i].modulationRange == 0) { - playingModes[i] = clockModes[channels[i].mode]; - } else { //modulation happens here + if (channels[i].CV1Target != 1 && channels[i].CV2Target != 1) { + playingModes[i] = subDivs[channels[i].mode]; + } else if (channels[i].CV1Target == 1) { //modulation happens here int mod; - if (!channels[i].modulationChannel) { - mod = a1Input; - } else { - mod = a2Input; - } - mod = map(mod, 0, 1023, 0, channels[i].modulationRange); - playingModes[i] = clockModes[channels[i].mode - mod]; //subtracting because the innitiall array is backwards + mod = a1Input; + mod = map(mod, 0, 1023, 0, channels[i].CV1Value); + playingModes[i] = subDivs[channels[i].mode - mod]; //subtracting because the innitial array is backwards + } else if (channels[i].CV2Target == 1) { //modulation happens here + int mod; + mod = a1Input; + mod = map(mod, 0, 1023, 0, channels[i].CV2Value); + playingModes[i] = subDivs[channels[i].mode - mod]; //subtracting because the innitial array is backwards } if (playingModes[i] > 0) { diff --git a/Software/GToE/InputsCheck.ino b/Software/Gravity/InputsCheck.ino similarity index 95% rename from Software/GToE/InputsCheck.ino rename to Software/Gravity/InputsCheck.ino index 14405cb..fe25155 100644 --- a/Software/GToE/InputsCheck.ino +++ b/Software/Gravity/InputsCheck.ino @@ -46,8 +46,8 @@ void checkInputs() { channels[displayTab - 1].mode = channels[displayTab - 1].mode - change; if (channels[displayTab - 1].mode == 65535) { //65535 is 0-1 for unsigned vars channels[displayTab - 1].mode = 0; - } else if (channels[displayTab - 1].mode > (sizeof(clockModes) / sizeof(int)) - 1) { - channels[displayTab - 1].mode = (sizeof(clockModes) / sizeof(int)) - 1; + } else if (channels[displayTab - 1].mode > (sizeof(subDivs) / sizeof(int)) - 1) { + channels[displayTab - 1].mode = (sizeof(subDivs) / sizeof(int)) - 1; } if (!isPlaying) { calculateCycles(); @@ -102,8 +102,8 @@ void checkInputs() { channels[displayTab - 1].mode = channels[displayTab - 1].mode - change; if (channels[displayTab - 1].mode == 65535) { //65535 is 0-1 for unsigned vars channels[displayTab - 1].mode = 0; - } else if (channels[displayTab - 1].mode > (sizeof(clockModes) / sizeof(int)) - 1) { - channels[displayTab - 1].mode = (sizeof(clockModes) / sizeof(int)) - 1; + } else if (channels[displayTab - 1].mode > (sizeof(subDivs) / sizeof(int)) - 1) { + channels[displayTab - 1].mode = (sizeof(subDivs) / sizeof(int)) - 1; } if (!isPlaying) { calculateCycles(); diff --git a/Software/GToE/UI.ino b/Software/Gravity/UI.ino similarity index 92% rename from Software/GToE/UI.ino rename to Software/Gravity/UI.ino index a2a7aa0..4364ccf 100644 --- a/Software/GToE/UI.ino +++ b/Software/Gravity/UI.ino @@ -172,10 +172,16 @@ void updateScreen() { } else { display.setTextColor(SSD1306_WHITE); } - display.setCursor(94, 25); - if (channels[displayTab - 1].modulationRange > 0) { - display.print(F("+/-")); - display.print(channels[displayTab - 1].modulationRange); + display.setCursor(94, 25); + if (channels[displayTab - 1].CV1Target == 1) { + display.print(F("DIV")); + display.print(channels[displayTab - 1].CV1Value); + } else if (channels[displayTab - 1].CV1Target == 2) { + display.print(F("RND")); + display.print(channels[displayTab - 1].CV1Value); + } else if (channels[displayTab - 1].CV1Target == 3) { + display.print(F("PAT")); + display.print(channels[displayTab - 1].CV1Value); } else { display.print(F("OFF ")); } @@ -219,14 +225,14 @@ void updateScreen() { display.setTextSize(2); display.println(F("1/16")); } else { - if (clockModes[channels[displayTab - 1].mode] == 0) { + if (subDivs[channels[displayTab - 1].mode] == 0) { display.print(F("OFF")); - } else if (clockModes[channels[displayTab - 1].mode] > 0) { + } else if (subDivs[channels[displayTab - 1].mode] > 0) { display.print(F("/")); - display.print(abs(clockModes[channels[displayTab - 1].mode])); + display.print(abs(subDivs[channels[displayTab - 1].mode])); } else { display.print(F("x")); - display.print(abs(clockModes[channels[displayTab - 1].mode])); + display.print(abs(subDivs[channels[displayTab - 1].mode])); } } diff --git a/Software/GToE/build/arduino.avr.nano/GToE.ino.eep b/Software/Gravity/build/arduino.avr.nano/GToE.ino.eep similarity index 100% rename from Software/GToE/build/arduino.avr.nano/GToE.ino.eep rename to Software/Gravity/build/arduino.avr.nano/GToE.ino.eep diff --git a/Software/GToE/build/arduino.avr.nano/GToE.ino.elf b/Software/Gravity/build/arduino.avr.nano/GToE.ino.elf similarity index 100% rename from Software/GToE/build/arduino.avr.nano/GToE.ino.elf rename to Software/Gravity/build/arduino.avr.nano/GToE.ino.elf diff --git a/Software/GToE/build/arduino.avr.nano/GToE.ino.hex b/Software/Gravity/build/arduino.avr.nano/GToE.ino.hex similarity index 100% rename from Software/GToE/build/arduino.avr.nano/GToE.ino.hex rename to Software/Gravity/build/arduino.avr.nano/GToE.ino.hex diff --git a/Software/GToE/build/arduino.avr.nano/GToE.ino.with_bootloader.bin b/Software/Gravity/build/arduino.avr.nano/GToE.ino.with_bootloader.bin similarity index 100% rename from Software/GToE/build/arduino.avr.nano/GToE.ino.with_bootloader.bin rename to Software/Gravity/build/arduino.avr.nano/GToE.ino.with_bootloader.bin diff --git a/Software/GToE/build/arduino.avr.nano/GToE.ino.with_bootloader.hex b/Software/Gravity/build/arduino.avr.nano/GToE.ino.with_bootloader.hex similarity index 100% rename from Software/GToE/build/arduino.avr.nano/GToE.ino.with_bootloader.hex rename to Software/Gravity/build/arduino.avr.nano/GToE.ino.with_bootloader.hex