mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 12:48:53 +08:00
RPMCapture: refactor to clarify scheduling
This commit is contained in:
@@ -119,16 +119,14 @@ void RPMCapture::Run()
|
|||||||
pwm_input.error_count = _error_count;
|
pwm_input.error_count = _error_count;
|
||||||
_pwm_input_pub.publish(pwm_input);
|
_pwm_input_pub.publish(pwm_input);
|
||||||
|
|
||||||
// Schedule for next timeout
|
ScheduleClear(); // Do not run on previously scheduled timeout
|
||||||
ScheduleClear();
|
|
||||||
ScheduleDelayed(RPM_PULSE_TIMEOUT);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Timeout for no interrupts
|
// Timeout for no interrupts
|
||||||
_period = UINT32_MAX;
|
_period = UINT32_MAX;
|
||||||
ScheduleDelayed(RPM_PULSE_TIMEOUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScheduleDelayed(RPM_PULSE_TIMEOUT); // Schule a new timeout
|
||||||
|
|
||||||
if (_period > _min_pulse_period_us) {
|
if (_period > _min_pulse_period_us) {
|
||||||
// Only update if the period is above the min pulse period threshold
|
// Only update if the period is above the min pulse period threshold
|
||||||
|
|||||||
Reference in New Issue
Block a user