Fix timers at program start, TIMER STOP, and Sleep with console #295
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Three timer-related fixes in here:
last_time == 0
logic, which was done after check if the interval had passed. This doesn't work correctly at program start whentime_now == 0
. It's not necessary to check the interval anyway (we're just going to reset it), so we can just check for thelast_time == 0
special case first and avoid the issue.TIMER STOP
, it wouldn't trigger whenTIMER ON
is used. This was simple to fix,TIMER ON
wasn't settingqbevent = 1
to tell the program to check for events (like timer expiration). This meant the timer wouldn't trigger until something else setqbevent
.Sleep
with a console program on Windows won't run timers while sleeping. This was due to the custom sleep logic not callingevnt()
. I rewrote it to sleep for short intervals and then callevnt()
to handle timers and such, like all the other sleep commands do.Fixes: #273
Fixes: #294
Fixes: #293