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.
Description
Makes sure that the quick settings menu never tries to fill a negative or zero number of pixels in.
This was happening because, when
checkButtonQueueWrapper()
is called, it usesesp_timer_get_time()
to set the last select-pressed time. But then, when it's checked in the main loop, it's compared againsttNowUs
which was set before the swadge's main loop was called. So, the button press time is always slightly negative immediately after being pressed. If the mode's main loop took a long enough time to run, the time difference would be negative enough to cause a negative number of pixels to be drawn.Test Instructions
I tested this by:
./swadge_emulator -lm Demo --fuzz-buttons -r fuzz_to_reproduce_qs_error.csv
until the emulator crashed reasonably quickly../swadge_emulator -lm Demo --replay fuzz_to_reproduce_qs_error.csv
a few times to make sure it crashed consistently when replaying inputs (not every time, more like 2/3 times)./swadge_emulator -lm Demo --replay fuzz_to_reproduce_qs_error.csv
many times to make sure it definitely doesn't crash.fuzz_to_reproduce_qs_errors.csv
:Ticket Links
Closes #67
Readiness Checklist
make format
to format the changesmake cppcheck
and checked thatcppcheck_result.txt
has no warnings for the changes/*! \file
comments with Design Philosophy, Usage, and Example sections for new headers.make docs
and checked thatdoxy_warnings.txt
has no warnings for the new code