Skip to content

Commit

Permalink
scheduler: use tooth rpm for scheduling
Browse files Browse the repository at this point in the history
This reverts a change from years ago to use the average rpm.  I think
the reasoning for the original change was to help with high rpm trigger
noise, but I can't see that the change makes much sense.  On the other,
as integration tests are showing, low rpm timing accuracy is greatly
compromised when not using the tooth rpm, such that accuracy tests will
not even pass.
  • Loading branch information
via committed Aug 28, 2024
1 parent 5ad85a0 commit d59bf03
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ static int schedule_ignition_event(struct output_event *ev,
firing_angle =
clamp_angle(ev->angle - advance - d->last_trigger_angle + d->offset, 720);

stop_time = d->last_trigger_time + time_from_rpm_diff(d->rpm, firing_angle);
stop_time =
d->last_trigger_time + time_from_rpm_diff(d->tooth_rpm, firing_angle);
start_time = stop_time - time_from_us(usecs_dwell);

if (event_has_fired(ev)) {
Expand Down Expand Up @@ -195,7 +196,7 @@ static int schedule_fuel_event(struct output_event *ev,
firing_angle =
clamp_angle(ev->angle - d->last_trigger_angle + d->offset, 720);

stop_time = d->last_trigger_time + time_from_rpm_diff(d->rpm, firing_angle);
stop_time = d->last_trigger_time + time_from_rpm_diff(d->tooth_rpm, firing_angle);
start_time = stop_time - (TICKRATE / 1000000) * usecs_pw;

if (event_has_fired(ev)) {
Expand Down

0 comments on commit d59bf03

Please sign in to comment.