From 81978c95392fa9797f2b7f439ebd4d8cbf5b7e69 Mon Sep 17 00:00:00 2001 From: Adrien Moulin Date: Tue, 2 Aug 2022 22:38:20 +0200 Subject: [PATCH] pit_fast: fix off by one error with mode 2 counter --- src/pit_fast.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pit_fast.c b/src/pit_fast.c index 704cfd68c..758183d5e 100644 --- a/src/pit_fast.c +++ b/src/pit_fast.c @@ -145,6 +145,8 @@ pitf_dump_and_disable_timer(ctrf_t *ctr) { if (ctr->using_timer && timer_is_enabled(&ctr->timer)) { 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); } }