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:
2025-08-09 23:59:24 +00:00
parent fc17afc9a1
commit 872af30fbc
4 changed files with 95 additions and 138 deletions

View File

@ -91,19 +91,6 @@ void loop() {
// Process change in state of inputs and outputs.
gravity.Process();
// Read CVs and call the update function for each channel.
int cv1 = gravity.cv1.Read();
int cv2 = gravity.cv2.Read();
for (int i = 0; i < Gravity::OUTPUT_COUNT; i++) {
auto& ch = app.channel[i];
// Only apply CV to the channel when the current channel has cv
// mod configured.
if (ch.isCvModActive()) {
ch.applyCvMod(cv1, cv2);
}
}
// Check for dirty state eligible to be saved.
stateManager.update(app);