Updated CV calibration related stuff

This commit is contained in:
2023-08-26 18:58:36 +03:00
parent 5aaa6e694d
commit 95d07893bc
4 changed files with 72 additions and 51 deletions

View File

@ -26,9 +26,10 @@ const char version[5] = "V:0.9";
const byte outsPins[6] = { 7, 8, 10, 6, 9, 11 };
const byte clockOutPin = 3;
int CV1Calibration = 0;
int CV2Calibration = 0;
int CV1Calibration = 512;
int CV2Calibration = 512;
bool rotateScreen = false;
bool showDone = false;
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
@ -108,8 +109,8 @@ byte displayScreen = 0; //0 - main, 1 - sequencer, 2 - settings
bool playBtnPushed = false;
bool shiftBtnPushed = false;
int a1Input = 0;
int a2Input = 0;
int CV1Input = 0;
int CV2Input = 0;
int encPositionOld = 0;
unsigned long encPressedTime;
@ -271,9 +272,9 @@ void sendTriggers() {
int seqMod = 0;
byte seqPattern;
if (channels[i].CV2Target == 3) {
seqMod = map(a2Input, -1, 1024, -8, 8); //-1 and 1024 are to try to make the last step not at max value (should make the range from -7 to +7)
seqMod = map(CV2Input, -1, 1024, -8, 8); //-1 and 1024 are to try to make the last step not at max value (should make the range from -7 to +7)
} else if (channels[i].CV1Target == 3) {
seqMod = map(a1Input, -1, 1024, -8, 8);
seqMod = map(CV1Input, -1, 1024, -8, 8);
}
if (channels[i].seqPattern < 8 && channels[i].seqPattern + seqMod >= 8) {
seqPattern = 7;
@ -357,10 +358,10 @@ void sendTriggers() {
//RND modulation
byte randMod = 0;
if (channels[i].CV1Target == 2) {
randMod = randMod + a1Input;
randMod = randMod + CV1Input;
}
if (channels[i].CV2Target == 2) {
randMod = randMod + a2Input;
randMod = randMod + CV2Input;
}
if (channels[i].CV1Target == 2 || channels[i].CV2Target == 2) {
randMod = map(randMod, 0, 1023, -5, +5);
@ -391,9 +392,9 @@ void calculateCycles() {
for (byte i = 0; i < 6; i++) {
int mod = 0; //subdiv modulation happens here
if (channels[i].CV1Target == 1) {
mod = map(a1Input, -1, 1024, -5, 5); //(channels[i].CV1Value * -1), channels[i].CV1Value)
mod = map(CV1Input, -1, 1024, -5, 5); //(channels[i].CV1Value * -1), channels[i].CV1Value)
} else if (channels[i].CV2Target == 1) {
mod = map(a2Input, -1, 1024, -5, 5);
mod = map(CV2Input, -1, 1024, -5, 5);
}
playingModes[i] = subDivs[channels[i].subDiv - mod]; //subtracting because the innitial array is backwards
@ -414,9 +415,9 @@ void calculateBPMTiming() {
int mod = 0;
if (masterClockMode == 0) { //Internal clock
if (bpmModulationRange != 0 && bpmModulationChannel == 0) {
mod = map(a1Input, 0, 1023, bpmModulationRange * -10, bpmModulationRange * 10);
mod = map(CV1Input, 0, 1023, bpmModulationRange * -10, bpmModulationRange * 10);
} else if (bpmModulationRange != 0 && bpmModulationChannel == 1) {
mod = map(a2Input, 0, 1023, bpmModulationRange * -10, bpmModulationRange * 10);
mod = map(CV2Input, 0, 1023, bpmModulationRange * -10, bpmModulationRange * 10);
}
pulsePeriod = 60000 / ((bpm + mod) * PPQN);
@ -554,10 +555,10 @@ void reboot() {
}
void calibrateCVs() {
//CV1Calibration = 511 - analogRead(ANALOGUE_INPUT_1_PIN);
//CV2Calibration = 511 - analogRead(ANALOGUE_INPUT_2_PIN);
CV1Calibration = 255 - (analogRead(ANALOGUE_INPUT_1_PIN) / 2);
CV2Calibration = 255 - (analogRead(ANALOGUE_INPUT_2_PIN) / 2);
CV1Calibration = analogRead(ANALOGUE_INPUT_1_PIN);
CV2Calibration = analogRead(ANALOGUE_INPUT_2_PIN);
showDone = true;
updateScreen();
}
void checkScreenRotation() {