Conversation
The main loop polls at a fixed TARGET_FPS (20Hz) forever via SDL_PollEvent + a fixed-rate delay, even when the app is fully idle on a static page with nothing held or animating. Rendering is already change-driven, but the wake cadence was not, so the CPU (and battery) paid for 20 wakeups a second regardless of whether anything was happening. Adds View::on_tick()/wants_continuous_render() (a view opts in to mean "keep ticking at full rate even with no input", for a future animated view such as auto-scroll - unused by any current view, so no behavior change yet) and HeldKeyTracker::any_held(). When nothing is held and the active view does not need continuous rendering, the loop blocks on the next real input event instead of polling, using a small local poll_event_with_timeout() rather than SDL_WaitEventTimeout itself, since that symbol is not declared in this toolchain's SDL1.2 headers. No behavior change while input is active or a view opts into continuous rendering; the only difference is fewer wakeups while a book just sits on screen. Verified this still compiles and links against the real Miyoo Mini cross-compile toolchain. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The main loop polls at a fixed TARGET_FPS (20Hz) forever via SDL_PollEvent + a fixed-rate delay, even when the app is fully idle on a static page with nothing held or animating. Rendering is already change-driven, but the wake cadence was not, so the CPU (and battery) paid for 20 wakeups a second regardless of whether anything was happening.
Adds View::on_tick()/wants_continuous_render() (a view opts in to mean "keep ticking at full rate even with no input", for a future animated view such as auto-scroll - unused by any current view, so no behavior change yet) and HeldKeyTracker::any_held(). When nothing is held and the active view does not need continuous rendering, the loop blocks on the next real input event instead of polling, using a small local poll_event_with_timeout() rather than SDL_WaitEventTimeout itself, since that symbol is not declared in this toolchain's SDL1.2 headers.
No behavior change while input is active or a view opts into continuous rendering; the only difference is fewer wakeups while a book just sits on screen. Verified this still compiles and links against the real Miyoo Mini cross-compile toolchain.