From 3cd323d5b986ab7e7a94c210de145984bba6b9aa Mon Sep 17 00:00:00 2001 From: Oleksiy Date: Fri, 18 Oct 2024 15:21:08 +0300 Subject: [PATCH] basik swing works --- Software/Gravity/Gravity.ino | 12 ++++++++++-- Software/Gravity/Interactions.ino | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Software/Gravity/Gravity.ino b/Software/Gravity/Gravity.ino index 537c004..f3fff67 100644 --- a/Software/Gravity/Gravity.ino +++ b/Software/Gravity/Gravity.ino @@ -32,7 +32,7 @@ struct channel { byte random : 4; //mv: 16 byte seqPattern : 4; uint8_t gate : 6; //mv: 64 - uint8_t swing : 4; //some of this params can be combinde into 4+4 bits to save space + uint8_t swing : 3; //some of this params can be combinde into 4+4 bits to save space }; channel channels[6] = { //array of channel settings @@ -87,6 +87,7 @@ unsigned long newExtPulseTime = 0; bool needPulseReset[6] = { true, true, true, true, true, true }; int gatePulseCount[6] = {0,0,0,0,0,0}; +bool swingBit = 0; byte displayTab = 0; bool insideTab = false; @@ -417,9 +418,16 @@ void sendTriggers() { //rename to onPulse or something } } + if ((channels[i].mode == 3 && channelPulseCount[i] == 0 && swingBit == 0) + || (channels[i].mode == 3 && channelPulseCount[i] == channels[i].swing && swingBit == 1 && currentStep %2 == 0) //swing + ) { + digitalWrite(outsPins[i], HIGH); + swingBit = !swingBit; + } + if ((channels[i].mode == 0 && channelPulseCount[i] == channels[i].offset) //CLK with offset || (channels[i].mode == 1 && channelPulseCount[i] == 0 && (random(10) + 1) > randAmount) //RND - || (channels[i].mode == 4 && channelPulseCount[i] == 0) //gate + || (channels[i].mode == 4 && channelPulseCount[i] == 0) //Gate ) { digitalWrite(outsPins[i], HIGH); gatePulseCount[i] = 0; //reset gate here to avoid length "countdown" effect diff --git a/Software/Gravity/Interactions.ino b/Software/Gravity/Interactions.ino index 43860db..8c2468a 100644 --- a/Software/Gravity/Interactions.ino +++ b/Software/Gravity/Interactions.ino @@ -183,8 +183,8 @@ void checkInputs() { channels[displayTab - 1].swing = channels[displayTab - 1].swing + change; if (channels[displayTab - 1].swing > 100) { channels[displayTab - 1].swing = 0; - } else if (channels[displayTab - 1].swing > 15) { - channels[displayTab - 1].swing = 15; + } else if (channels[displayTab - 1].swing > 6) { + channels[displayTab - 1].swing = 6; } saveState(); } else if (((!insideTab && shiftBtnPushed)