1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Adds a further drift safeguard.

This commit is contained in:
Thomas Harte 2019-07-26 23:23:01 -04:00
parent b7b62aa3f6
commit d08d8ed22c

View File

@ -302,6 +302,10 @@ void Drive::setup_track() {
offset = track_time_now - time_found;
}
// Reseed cycles_since_index_hole_; 99.99% of the time it'll still be correct as is,
// but if the track has rounded one way or the other it may now be very slightly adrift.
cycles_since_index_hole_ = (int((time_found + offset) * cycles_per_revolution_)) % cycles_per_revolution_;
get_next_event(offset);
}