From 9ca06be4f5776f17efbd41274070968975ca1c23 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Tue, 10 Dec 2024 19:37:37 +0100 Subject: [PATCH] RPMCapture: refactor to clarify scheduling --- src/drivers/rpm_capture/RPMCapture.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/drivers/rpm_capture/RPMCapture.cpp b/src/drivers/rpm_capture/RPMCapture.cpp index 0da3f941df..1f949e7078 100644 --- a/src/drivers/rpm_capture/RPMCapture.cpp +++ b/src/drivers/rpm_capture/RPMCapture.cpp @@ -119,16 +119,14 @@ void RPMCapture::Run() pwm_input.error_count = _error_count; _pwm_input_pub.publish(pwm_input); - // Schedule for next timeout - ScheduleClear(); - ScheduleDelayed(RPM_PULSE_TIMEOUT); + ScheduleClear(); // Do not run on previously scheduled timeout } else { // Timeout for no interrupts _period = UINT32_MAX; - ScheduleDelayed(RPM_PULSE_TIMEOUT); } + ScheduleDelayed(RPM_PULSE_TIMEOUT); // Schule a new timeout if (_period > _min_pulse_period_us) { // Only update if the period is above the min pulse period threshold