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

@ -7,8 +7,9 @@ void checkInputs() {
} else if (digitalRead(ENC_BTN_PIN) && encBtnPushed) {
encBtnPushed = false;
encReleasedTime = millis();
if (encReleasedTime - encPressedTime < 500) { // press shorter than .5s is for entering the submenu
if (showDone) {
showDone = false;
} else if (encReleasedTime - encPressedTime < 500) { // press shorter than .5s is for entering the submenu
if (!insideTab && displayScreen == 0) {
insideTab = true;
} else if (insideTab && channels[displayTab - 1].mode == 2 && menuItem == 2 && displayScreen == 0) { //enter the pattern editor
@ -346,7 +347,21 @@ void checkInputs() {
updateScreen();
}
//modulations map(randMod, 0, 1023, -5, +5)
a1Input = map(analogRead(ANALOGUE_INPUT_1_PIN), 0 - CV1Calibration, 1023 - CV1Calibration, 0, 1023);
a2Input = map(analogRead(ANALOGUE_INPUT_2_PIN), 0 - CV2Calibration, 1023 - CV2Calibration, 0, 1023);
if (analogRead(ANALOGUE_INPUT_1_PIN) > (CV1Calibration)) {
CV1Input = map(analogRead(ANALOGUE_INPUT_1_PIN), CV1Calibration, 1023, 512, 1023);
} else if (analogRead(ANALOGUE_INPUT_1_PIN) < (CV1Calibration-5)) { //-5 is to shift a -1 break point a little lower
CV1Input = map(analogRead(ANALOGUE_INPUT_1_PIN), 0, CV1Calibration-5, 0, 512);
} else {
CV1Input = 512;
}
if (analogRead(ANALOGUE_INPUT_2_PIN) > (CV1Calibration)) {
CV2Input = map(analogRead(ANALOGUE_INPUT_2_PIN), CV1Calibration, 1023, 512, 1023);
} else if (analogRead(ANALOGUE_INPUT_2_PIN) < (CV1Calibration-5)) {
CV2Input = map(analogRead(ANALOGUE_INPUT_2_PIN), 0, CV1Calibration-5, 0, 512);
} else {
CV2Input = 512;
}
}