Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamically change resolution passed to OS_WAIT
res was hard coded to 16 ms, which could waste too many iterations when CPU is fast enough. Suppose WAIT starts with timeout = 30, and Awake_System always returns negatives: 1. first iteration will call OS_WAIT with 30, and actually waits 14 ms (timeout - res). 2. second iteration will call OS_WAIT with 16, and OS_WAIT will not wait at all, because (timeout - res == 0). 3. third iteration will call OS_WAIT with probably 16 (or < 16, depending on how fast the second iteration finished), and a busy loop will start until 16 ms elapses.
- Loading branch information
Just curious... REBCNT is defined as u32, so the
old_time
is never negative and so the followingold_time >= 0
is alwaystrue
, right?