Refactor CV Mod (#24)
Move cv mod calculation to processClockTick. This is less ideas because it is an ISR, but it saves a significant amount of memory. Performance doesn't seem to take much of a hit. Reviewed-on: https://git.pinkduck.xyz/awonak/libGravity/pulls/24
This commit is contained in:
@ -328,10 +328,12 @@ void DisplayChannelPage() {
|
||||
// When editing a param, just show the base value. When not editing show
|
||||
// the value with cv mod.
|
||||
bool withCvMod = !app.editing_param;
|
||||
int cv1 = gravity.cv1.Read();
|
||||
int cv2 = gravity.cv2.Read();
|
||||
|
||||
switch (app.selected_param) {
|
||||
case PARAM_CH_MOD: {
|
||||
int mod_value = ch.getClockMod(withCvMod);
|
||||
int mod_value = withCvMod ? ch.getClockModWithMod(cv1, cv2): ch.getClockMod();
|
||||
if (mod_value > 1) {
|
||||
mainText = F("/");
|
||||
mainText += String(mod_value);
|
||||
@ -344,30 +346,30 @@ void DisplayChannelPage() {
|
||||
break;
|
||||
}
|
||||
case PARAM_CH_PROB:
|
||||
mainText = String(ch.getProbability(withCvMod)) + F("%");
|
||||
mainText = String(withCvMod ? ch.getProbabilityWithMod(cv1, cv2) : ch.getProbability()) + F("%");
|
||||
subText = F("HIT CHANCE");
|
||||
break;
|
||||
case PARAM_CH_DUTY:
|
||||
mainText = String(ch.getDutyCycle(withCvMod)) + F("%");
|
||||
mainText = String(withCvMod ? ch.getDutyCycleWithMod(cv1, cv2) : ch.getDutyCycle()) + F("%");
|
||||
subText = F("PULSE WIDTH");
|
||||
break;
|
||||
case PARAM_CH_OFFSET:
|
||||
mainText = String(ch.getOffset(withCvMod)) + F("%");
|
||||
mainText = String(withCvMod ? ch.getOffsetWithMod(cv1, cv2) : ch.getOffset()) + F("%");
|
||||
subText = F("SHIFT HIT");
|
||||
break;
|
||||
case PARAM_CH_SWING:
|
||||
ch.getSwing() == 50
|
||||
? mainText = F("OFF")
|
||||
: mainText = String(ch.getSwing(withCvMod)) + F("%");
|
||||
: mainText = String(withCvMod ? ch.getSwingWithMod(cv1, cv2) : ch.getSwing()) + F("%");
|
||||
subText = "DOWN BEAT";
|
||||
swingDivisionMark();
|
||||
break;
|
||||
case PARAM_CH_EUC_STEPS:
|
||||
mainText = String(ch.getSteps(withCvMod));
|
||||
mainText = String(withCvMod ? ch.getStepsWithMod(cv1, cv2) : ch.getSteps());
|
||||
subText = "EUCLID STEPS";
|
||||
break;
|
||||
case PARAM_CH_EUC_HITS:
|
||||
mainText = String(ch.getHits(withCvMod));
|
||||
mainText = String(withCvMod ? ch.getHitsWithMod(cv1, cv2) : ch.getHits());
|
||||
subText = "EUCLID HITS";
|
||||
break;
|
||||
case PARAM_CH_CV1_DEST:
|
||||
|
||||
Reference in New Issue
Block a user