diff --git a/control/src/cache/interval_detector.rs b/control/src/cache/interval_detector.rs index 6c4dc46..d921a6e 100644 --- a/control/src/cache/interval_detector.rs +++ b/control/src/cache/interval_detector.rs @@ -15,6 +15,7 @@ pub struct IntervalDetector { trigger_age: [u32; 3], pub tempo: Option, pub just_detected: bool, + pub first_beat_after_detection: bool, } impl IntervalDetector { @@ -51,6 +52,10 @@ impl IntervalDetector { *x = x.saturating_add(1); } self.just_detected = false; + + if let Some(tempo) = self.tempo { + self.first_beat_after_detection = self.trigger_age[2] == tempo; + } } } diff --git a/control/src/cache/reconcile/speed.rs b/control/src/cache/reconcile/speed.rs index 172eb98..9424f7c 100644 --- a/control/src/cache/reconcile/speed.rs +++ b/control/src/cache/reconcile/speed.rs @@ -39,7 +39,7 @@ impl Store { self.cache.requests.reset_impulse = just_triggered_clock || just_triggered_tap || just_triggered_position_reset; - if just_triggered_tap { + if self.cache.tap_detector.first_beat_after_detection() { self.cache.attributes.paused_delay = false; self.cache.display.reset_paused(); } diff --git a/control/src/cache/tap_clock_detector.rs b/control/src/cache/tap_clock_detector.rs index cc7f3ba..622593e 100644 --- a/control/src/cache/tap_clock_detector.rs +++ b/control/src/cache/tap_clock_detector.rs @@ -33,4 +33,7 @@ impl TapClockDetector { pub fn detected_tempo(&self) -> Option { self.detector.tempo } + pub fn first_beat_after_detection(&self) -> bool { + self.detector.first_beat_after_detection + } }