Repository navigation
appkit and Home: no restart after System, and a round-screen layout - #51
Merged
Merged
Conversation
After closing an app the launcher checks the largest free block and restarts the program when it is too small. On a board that keeps call frames on the heap, the check ran inside the calls that delivered the switch, and those calls, the request's timer and its closure were all allocated while the old app ran, among its objects. They split the space the close had just freed, so a board with a 228 KB heap restarted on a plain System-to-Home switch. A request now uses two timers made with the launcher, closes the old app from the timer, and checks the heap and starts the next app on the main loop's next turn (a scheduled call where nothing runs the loop). System's close no longer imports wifi_manager just to cancel it. On a Waveshare RP2040-Touch-LCD-1.28, twenty Home-System round trips ran without a restart, the largest free block after each close staying at 49-62 KB (38 KB at the first, threshold 28 KB); before, it fell to 13 KB and the board restarted within ten trips. The launcher contract passes on CPython and unix MicroPython, with a new check for each path.
On a round display the shell's Home button sat in the top-right corner, outside the circle, and Home's title, gear and tab bar were clipped. appkit.shell.is_round() now tells a round panel (the board's driver says so, or it is a GC9A01). There the Home button is a small round button on the diagonal, and Home puts its pages and tabs in the square inside the circle, two apps by two, with the gear centred above them. Checked on a Waveshare RP2040-Touch-LCD-1.28 from the frames sent to the panel: every object of Home and System lies inside the circle. Home on 720x720 and 800x480 renders pixel for pixel as before.
This was referenced Nov 10, 2026
Closed
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.
Going back from System to Home restarted a Waveshare RP2040-Touch-LCD-1.28 (228 KB heap), and on its round screen the shell's Home button and Home's header fell outside the circle. This fixes both.
The restart came from fragmentation the switch itself caused. The launcher checks the largest free block after closing an app, but it ran that check inside the calls that delivered the switch. On this board call frames live on the heap, and those calls, the request's timer and its closure had all been allocated while the old app ran, among its objects, so they split the space the close had just freed. A request now uses two timers made with the launcher, closes the old app from the timer, and checks the heap and starts the next app on the main loop's next turn, or from a scheduled call where nothing runs the loop. System's close no longer imports
wifi_managerjust to cancel it. The threshold is unchanged.On a round panel (
appkit.shell.is_round(): the board's driver says so, or it's a GC9A01) the Home button is now a small round button on the diagonal, and Home puts its pages and tabs in the square inside the circle, two apps by two, with the gear centred above. Square and rectangular screens are unchanged.How it was checked, on the board: twenty Home-System round trips by tapping, with no restart; the largest free block after each close stayed at 49-62 KB (38 KB after the first), against a 28 KB threshold. Before, it fell to 13 KB and the board restarted within ten trips. Images rebuilt from the frames sent to the panel show every object of Home and System inside the circle. Headless renders of Home at 720x720 and 800x480 match main pixel for pixel. The launcher contract passes on CPython and unix MicroPython (384k and 8M heaps) with two new checks, each failing with its fix taken out, and the appkit and touchkit shell tests pass.
Not checked: other round boards, and CircuitPython on a board.
Fixes #49. Fixes #50.