Repository navigation
Refactor platform support - #13
Open
JohnAZoidberg wants to merge 6 commits into
Open
JohnAZoidberg wants to merge 6 commits into
JohnAZoidberg wants to merge 6 commits into
Conversation
Pure move, no code changes except module paths. Prepares for adding more platforms next to it. Signed-off-by: Daniel Schaefer <dhs@frame.work>
Otherwise changes in src/platform/ don't trigger a rebuild. Signed-off-by: Daniel Schaefer <dhs@frame.work>
GOP setup, input protocol and OS indications don't depend on the platform. Same split as on the sunflower branch. Signed-off-by: Daniel Schaefer <dhs@frame.work>
Text boxes, image drawing, the low battery warning and clearing the screen are the same on every platform. Also add decode_png() instead of repeating the decoder in every bitmap getter. Two side-effects: - clear_screen() now clears the whole GOP buffer instead of a fixed 2560x1600 area, same as 'Clear the whole screen' on the sunflower branch. No difference on the native Laptop 16 panel. - Release binary shrinks from 923KiB to 409KiB, because the PNG decoder is now instantiated once instead of once per image. Signed-off-by: Daniel Schaefer <dhs@frame.work>
Expansion bay, input deck, fan speed and the QEMU mock data only make sense on Laptop 16. Power button, HW diag, version and UEFI app mode are common to all platforms and stay in ec_comm. Signed-off-by: Daniel Schaefer <dhs@frame.work>
The UI loop in app.rs is now generic over a Platform. It handles everything that isn't platform specific: power button short and long press, ESC, F12 (reboot into BIOS setup), '?' (verbose) and redrawing only on changes. Laptop 16 implements Platform. Its hardware state is now one Snapshot struct, and the outdated firmware countdown, the 'p' mock key and the interposer cold reboot use the Platform hooks. BIOS settings and the 'info' output move from main.rs to platform/laptop16/status.rs. To add a platform, implement Platform in platform/<name>/ and point platform::Current at it. Signed-off-by: Daniel Schaefer <dhs@frame.work>
📦 Binary Size Comparison (Nix Build)
Full hashes
|
Member
Author
|
Wow, the binary size is halved! Explanation: include_bytes! gives each PNG its own array type (&[u8; N], with a different N per file), so the generic PngDecoder was compiled once per image; |
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.
Preparing for merging Laptop 12 into this branch by extracting the platform specific logic.