Merge pull request #2563 from elyosh/pitfastfix

pit_fast: fix off by one error with mode 2 counter
This commit is contained in:
Miran Grča
2022-08-02 23:17:30 +02:00
committed by GitHub

View File

@@ -145,6 +145,8 @@ pitf_dump_and_disable_timer(ctrf_t *ctr)
{ {
if (ctr->using_timer && timer_is_enabled(&ctr->timer)) { if (ctr->using_timer && timer_is_enabled(&ctr->timer)) {
ctr->count = pitf_read_timer(ctr); ctr->count = pitf_read_timer(ctr);
if (ctr->m == 2)
ctr->count--; /* Don't store the offset from pitf_read_timer */
timer_disable(&ctr->timer); timer_disable(&ctr->timer);
} }
} }