fix: Debounce preset pattern selection from CV input using last_mapped_slot to prevent redundant updates.
This commit is contained in:
@ -79,6 +79,7 @@ int current_step = 0;
|
||||
|
||||
volatile int cv1_val = 0;
|
||||
volatile int cv2_val = 0;
|
||||
int last_mapped_slot = -1;
|
||||
|
||||
// LFSR State for Chaos
|
||||
uint16_t lfsr = 0xACE1;
|
||||
@ -175,12 +176,17 @@ void ProcessSequencerTick(uint32_t tick) {
|
||||
|
||||
if (cv1_dest == CV_DEST_PRESET || cv2_dest == CV_DEST_PRESET) {
|
||||
int mapped_slot = constrain(map(preset_cv, 0, 512, 0, 4), 0, 4);
|
||||
if (mapped_slot != last_mapped_slot) {
|
||||
last_mapped_slot = mapped_slot;
|
||||
if (active_pattern != mapped_slot) {
|
||||
active_pattern = mapped_slot;
|
||||
selected_slot = mapped_slot + 1;
|
||||
needs_redraw = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
last_mapped_slot = -1;
|
||||
}
|
||||
|
||||
PatternState &p = patterns[active_pattern];
|
||||
int active_map_x = p.map_x;
|
||||
|
||||
Reference in New Issue
Block a user