diff --git a/firmware/Rhythm/Rhythm.ino b/firmware/Rhythm/Rhythm.ino index 2f0beaa..fd29dee 100644 --- a/firmware/Rhythm/Rhythm.ino +++ b/firmware/Rhythm/Rhythm.ino @@ -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,11 +176,16 @@ 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 (active_pattern != mapped_slot) { - active_pattern = mapped_slot; - selected_slot = mapped_slot + 1; - needs_redraw = true; + 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];