diff --git a/Hardware/gtoe/midi-panel.kicad_prl b/Hardware/gtoe/midi-panel.kicad_prl index 1cbf49a..1206f00 100644 --- a/Hardware/gtoe/midi-panel.kicad_prl +++ b/Hardware/gtoe/midi-panel.kicad_prl @@ -61,7 +61,7 @@ 35, 36 ], - "visible_layers": "fffeedf_ffffffff", + "visible_layers": "fffeeff_ffffffff", "zone_display_mode": 0 }, "meta": { diff --git a/Software/Gravity/Gravity.ino b/Software/Gravity/Gravity.ino index c1bb31d..cd9dacb 100644 --- a/Software/Gravity/Gravity.ino +++ b/Software/Gravity/Gravity.ino @@ -115,8 +115,8 @@ unsigned int pulseCount = 0; byte masterClockMode = 0; // 0 - internal, 1 - external 24ppqn, 2 - MIDI byte extClockPPQN = 0; // 0 - 24, 1 - 4 (1/16) -unsigned long lastExtPulseTime; -unsigned long newExtPulseTime; +unsigned long lastExtPulseTime = 0; +unsigned long newExtPulseTime = 0; bool needPulseReset[6] = { true, true, true, true, true, true }; @@ -168,8 +168,8 @@ const uint8_t velvetscreen[437] U8G2_FONT_SECTION("velvetscreen") = "\7p\10\255\364V\266\323\2q\7\255\364\216\257\5r\10\253d\242\32*\2t\6\255t\376#w\11" "\255\364V\245FN\13x\6\233dR\7\0\0\0\4\377\377\0"; -const uint8_t stkL[499] U8G2_FONT_SECTION("stk-l") = - "\22\0\4\4\4\5\2\1\6\17\27\1\0\27\0\0\0\1\77\0\0\1\326%'\17\37\313\330R#&" +const uint8_t stkL[569] U8G2_FONT_SECTION("stk-l") = + "\25\0\4\4\4\5\2\1\6\17\27\1\0\27\0\0\0\1\77\0\0\2\34%'\17\37\313\330R#&" "\32!F\14\211I\310\24!\65\204(MF\21)Cd\304\10\62b\14\215\60Vb\334\20\0/\14" "\272\336\336d\244\350\263q\343\0\60\37|\377\12\32\25\17\2\35\263\253ChD\30\21bB\14\242S" "\306lv\350A\10\65H\0\61\24z\337\322\60R\205\314\234\31\61F\310\270\371\177\224\42\3\62\33|" @@ -181,10 +181,12 @@ const uint8_t stkL[499] U8G2_FONT_SECTION("stk-l") = "\216)\64*\10\35\263\331!\22D\310\240\62\205\206\10\11B\307lv\210\204\32Tf\0\71\32|\377" "\216)\64*\10\35\263\263C$\226\250I\71_\14\42\241\6\225\31\0A\26}\17S\271Si(\31" "\65d\324\210q\366\356\301w\366\273\1B$}\17\203\232%KF\221\30\66b\330\210a#\206\215\30" - "Eb\311&\243H\14;g\317\36\204`\261\4\0E\21|\377\302\7)\347%\42\214F\316/\37<" - "\60T\15}\17\303\7\251\206\316\377\377\12\0X)~\37\303@\203\307H\14\33B\210\14\21RC\206" - "\241\63h\222(I\203\346\220\15\31E\204\14!\42\303F\20;h\341\0x\24\312\336\302 CGH" - "\240\61E\312\14\222)\6Y\64\0\0\0\0\4\377\377\0"; + "Eb\311&\243H\14;g\317\36\204`\261\4\0D\33}\17C\42\65KF\15\31\66b\330\210q" + "\366\77;\66b\24\211%j\22\1E\21|\377\302\7)\347%\42\214F\316/\37<\60I\7so" + "\302\37$M$}\17\203\310r\346N\245Q\263\202E\12)L\224\60Q\302\310\20#C\214\14\61\23" + "\306L\30s\366\335\0T\15}\17\303\7\251\206\316\377\377\12\0X)~\37\303@\203\307H\14\33B" + "\210\14\21RC\206\241\63h\222(I\203\346\220\15\31E\204\14!\42\303F\20;h\341\0x\24\312" + "\336\302 CGH\240\61E\312\14\222)\6Y\64\0\0\0\0\4\377\377\0"; void setup() { @@ -212,6 +214,8 @@ void setup() { calculateCycles(); calculateBPMTiming(); + resetClocks(); + FlexiTimer2::set(1, 1.0 / 1000, clock); // 1.0/1000 = 1ms period. If other than 1ms calculateBPMTiming() might need tweaking FlexiTimer2::start(); } @@ -303,18 +307,17 @@ void externalClock() { lastExtPulseTime = newExtPulseTime; newExtPulseTime = millis(); - if (masterClockMode == 1 && extClockPPQN == 0) { // EXT-24 - //reset cycles if there was no pulses for a while - if ((newExtPulseTime - lastExtPulseTime) > 125) { //125ms is 20bpm - //for (byte i = 0; i < 6; i++) { - //channelPulseCount[i] = 0; - //} - resetClocks(); - } - + if (masterClockMode == 1 && extClockPPQN == 0) { // EXT 24ppqn if (!isPlaying) { isPlaying = true; } + + //reset cycles if there were no pulses for a while + if ((newExtPulseTime - lastExtPulseTime) > 125) { //125ms is 20bpm + + resetClocks(); + } + tickCount = 0; //to make things happen in the main clock function if (pulseCount < (PPQN - 1)) { pulseCount++; @@ -418,7 +421,7 @@ void sendTriggers() { } else if (seqPattern == 15) { currentSeq = seqB8; } - if (channels[i].mode == 2 && channelPulseCount[i] == 0 && currentSeq[currentStep]) { + if (channels[i].mode == 2 && currentSeq[currentStep]) { // EXT CLOCK SEQUENCER BUG IS SOMEWHERE HERE ???? && channelPulseCount[i] == 0 might be related to channelPulsesPerCycle not calculated in time digitalWrite(outsPins[i], HIGH); } } @@ -430,7 +433,7 @@ void sendTriggers() { } } else { sixteenthPulseCount = 0; - if (currentStep < 15) { + if (currentStep < 15) { currentStep ++; } else { currentStep = 0; @@ -495,13 +498,14 @@ void calculateCycles() { } playingModes[i] = subDivs[channels[i].subDiv - mod]; //subtracting because the innitial array is backwards - if (playingModes[i] > 0 && channels[i].mode != 2) { - channelPulsesPerCycle[i] = (playingModes[i] * PPQN) - 1; - } else if (playingModes[i] <= 0 && channels[i].mode != 2) { - channelPulsesPerCycle[i] = (PPQN / abs(playingModes[i])) - 1; - } else if (channels[i].mode == 2) { //Sequencer plays 1/16th + if (channels[i].mode == 2) { //Sequencer plays 1/16th channelPulsesPerCycle[i] = (PPQN / 4) - 1; + } else if (playingModes[i] > 0) { + channelPulsesPerCycle[i] = (playingModes[i] * PPQN) - 1; + } else if (playingModes[i] < 0) { + channelPulsesPerCycle[i] = (PPQN / abs(playingModes[i])) - 1; } + } } diff --git a/Software/Gravity/Interactions.ino b/Software/Gravity/Interactions.ino index 70a8fe8..711eb4c 100644 --- a/Software/Gravity/Interactions.ino +++ b/Software/Gravity/Interactions.ino @@ -185,8 +185,8 @@ void checkInputs() { masterClockMode = masterClockMode + change; if (masterClockMode > 100) { masterClockMode = 0; - } else if (masterClockMode > 1) { //Set to 2 to unhide MIDI mode - masterClockMode = 1; + } else if (masterClockMode > 2) { //Set to 1 to hide MIDI mode + masterClockMode = 2; } saveState(); } else if (insideTab @@ -364,7 +364,6 @@ void checkInputs() { if (masterClockMode == 0) { calculateBPMTiming(); resetClocks(); - //isPlaying = !isPlaying; if (!isPlaying) { isPlaying = true; sendMIDIStart();