bpm can't be modulated higher than maxbpm. fixed the offset bug in menu

This commit is contained in:
Oleksiy
2024-09-08 21:44:19 +03:00
parent 70ebaba270
commit cb88ec0e30
2 changed files with 4 additions and 2 deletions

View File

@ -524,7 +524,9 @@ void calculateBPMTiming() {
} else if (bpmModulationRange != 0 && bpmModulationChannel == 1) { } else if (bpmModulationRange != 0 && bpmModulationChannel == 1) {
mod = map(CV2Input, 0, 1023, bpmModulationRange * -10, bpmModulationRange * 10); mod = map(CV2Input, 0, 1023, bpmModulationRange * -10, bpmModulationRange * 10);
} }
pulsePeriod = 600000 / ((bpm + mod) * PPQN); byte calcbpm = bpm + mod;
if (calcbpm > MAXBPM) { calcbpm = MAXBPM; };
pulsePeriod = 600000 / (calcbpm * PPQN);
} else if (masterClockMode == 1 && extClockPPQN == 1) { //for ext 1/16 clock (hardcoded) } else if (masterClockMode == 1 && extClockPPQN == 1) { //for ext 1/16 clock (hardcoded)
pulsePeriod = (newExtPulseTime - lastExtPulseTime) / 6; pulsePeriod = (newExtPulseTime - lastExtPulseTime) / 6;

View File

@ -255,7 +255,7 @@ void checkInputs() {
&& displayTab != 0 && menuItem == 2 && displayTab != 0 && menuItem == 2
&& channels[displayTab - 1].mode == 0) { //Offset && channels[displayTab - 1].mode == 0) { //Offset
channels[displayTab - 1].offset = channels[displayTab - 1].offset + change; channels[displayTab - 1].offset = channels[displayTab - 1].offset + change;
if (channels[displayTab - 1].offset > 1000) { if (channels[displayTab - 1].offset == 255) { // 0 - 1 for uint8 is 255
channels[displayTab - 1].offset = 0; channels[displayTab - 1].offset = 0;
} else if (channels[displayTab - 1].offset > channelPulsesPerCycle[displayTab-1]) { } else if (channels[displayTab - 1].offset > channelPulsesPerCycle[displayTab-1]) {
channels[displayTab - 1].offset = channelPulsesPerCycle[displayTab-1]; channels[displayTab - 1].offset = channelPulsesPerCycle[displayTab-1];