Skip to content

feat(applaunch): replace the home carousel with a 3x2 app grid - #286

Open
dbrhspyjkf-code wants to merge 16 commits into
CardputerZero:masterfrom
dbrhspyjkf-code:ci/applaunch-home-3x2-grid
Open

dbrhspyjkf-code wants to merge 16 commits into
CardputerZero:masterfrom
dbrhspyjkf-code:ci/applaunch-home-3x2-grid

Conversation

@dbrhspyjkf-code

Copy link
Copy Markdown

What

The home screen is now a 3x2 grid showing six apps per page (previously a single-row 5-slot carousel).

Navigation

  • Arrow keys move the selection inside the grid: up/down swap rows, left/right walk the row (F/Z/X/C keep their arrow remap, ENTER launches)
  • Stepping past the page edge flips to the neighbouring page with a whole-page slide animation; the wrapped app list means the cursor can never land on an empty cell of a partly filled last page
  • Clicking any card selects and launches it; the side arrows page prev/next

Design (user-confirmed)

  • Whole-page flips (not per-card scrolling), and the carousel card look shrunk to grid size: rounded theme-bordered cards, square 58px so the square icon artwork is never stretched, Montserrat-Bold 12 titles below

Implementation

  • Selection is a pure LauncherGridModel (main/ui/model/launcher_grid_model.hpp): one absolute index into the wrapped list, strides of ±1/±kCols, page-crossing + direction detection — unit-tested in test_launcher_grid_model.cpp
  • The carousel slot-rotation machinery, the fake 5-page LauncherNavigationModel usage and the per-slot animation are removed; the page flip slides the grid container via a new launcher_home_animation::animate_page_slide
  • Card theme invariants from the old carousel contract are preserved and pinned by the rewritten test_grid_contract.py (border_post theme border, selection only swaps border colour, no clip_corner in the factory)
  • Launch::select_next/previous_app and carousel_slot_app collapse into select_app_relative(int) + the public app_at_index

Stacks on #285 (screen-off power staging — this branch contains those commits; the grid was verified on a device running both).

Verification

  • test_launcher_grid_model.cpp + all Python contract tests pass locally (incl. rewritten test_grid_contract.py, adjusted test_external_framebuffer_ownership.py boundary)
  • Cross-built via the release pipeline and deployed to a CardputerZero: framebuffer capture shows the 3x2 grid with correct selection highlight, titles, side arrows and an undisturbed top bar; arrow navigation, page flip, click-to-launch and ENTER verified on device

- pause the top-bar clock/status/battery refreshers and the network status
  polling worker while the panel is dark (Wi-Fi stays connected)
- screensaver: backlight + red status LED go dark first, then after
  panel_sleep_time (default 30s) blank the SPI panel, pin the cpufreq
  governor to powersave and stop the LVGL timers so the process sleeps on
  the input semaphore until a keypress wakes everything back
- ship a tmpfiles.d rule granting the gpio group write access to the staged
  sysfs nodes (mirror of the image's cardputerzero-leds.conf), applied
  immediately by postinst
A launcher process that dies during the deep panel-sleep stage leaves the
CRTC blanked and the governor pinned to powersave; the restarted process
had no way to know.  Unblank the panel and clear a stale powersave pin
during the boot backlight dance.
- home screen now shows six apps per page in a 3x2 grid; arrow keys move
  the selection (up/down swap rows, left/right walk the row), F/Z/X/C keep
  their arrow remap and ENTER launches
- stepping past the page edge flips to the neighbouring page with a slide
  animation; the wrapped app list means the cursor never lands on an empty
  cell of a partly filled page
- clicking any card selects and launches that app; the side arrows page
  prev/next
- selection model is a pure LauncherGridModel (absolute index + strides,
  page-crossing detection) with unit tests; the carousel slot-rotation
  machinery, the fake 5-page model and the per-slot animation are gone
- cards keep the carousel theme: border_post theme border, selection only
  swaps the border colour; titles use Montserrat-Bold 12
- contract test rewritten for the grid (test_grid_contract.py)
Left/right no longer spill onto the other row of the same page: stepping
past the row edge flips to the neighbouring page at the same row (next
page row start when moving right, previous page row end when moving
left).  Up/down keep swapping rows.  A ragged last page still wraps onto
the cells actually shown, and a single-page list wraps within the row
without a page slide.
Page flips happen through the row-edge wrap now, so the clickable
left/right arrows just duplicated a keyboard-only affordance; remove them
and their click handlers.
A dark-grey border on the black page was too subtle now that every card
is the same size.  The selection gets the theme accent: yellow border, a
~20% yellow backlight behind the icon art, a full-opacity icon and a
white title; neighbour icons dim to ~59% and their titles drop to grey.
The last page used to display wrapped filler apps in its trailing cells,
so LEFT from the first app bounced between the first two apps instead of
reaching the last page, and rightward moves landed on wrapped duplicates.

- pages no longer show wrapped filler: cells past the app count stay empty
- row-edge flips target the neighbouring page's same-row far cell, clamped
  to that page's nearest real app when it is ragged
- walking right past the very last app wraps to the first page's first cell
- new: I flips to the previous page, O to the next page, keeping the
  cursor's cell position (clamped on ragged pages)
Dimming the neighbour icons and graying their titles made the whole page
read dark.  All cards render at full brightness again; the selection is
marked only by the yellow border and the yellow tile backlight.
…e LED stage

Idle drain measured at ~390 mA with the screen already off: Bluetooth
powered but unused, WiFi power save disabled, and the red status LED back
on because the ACT led classdev is re-registered by a deferred probe
after boot, which resets permissions and relights the default trigger.

- deep-sleep stage powers the Bluetooth radio off over the existing bluez
  client (fire-and-forget async) and re-asserts the dark LED; wake powers
  Bluetooth back up
- the LED suspend re-asserts none/0 on every call instead of trusting a
  suspended flag
- the deb ships a udev rule re-granting gpio-group access to the ACT
  nodes on (re)registration, mirroring 60-cardputerzero-leds.rules
…plays

Deep sleep powered the radio off unconditionally, which severed a
connected speaker's A2DP link mid-song the moment the panel blanked.
The power-down now rides an async worker that probes the mixer with one
pactl spawn, and audio actually rendering (any sink in the RUNNING
state) keeps the link until the next wake; a failed probe still counts
as idle, so power saving stays the default when no mixer answers.
The LVGL thread blocks inside ExecBlocking for the whole app lifetime,
so the launcher's screensaver never ran while an app was open and the
panel stayed lit forever.  The runner's supervision loop - the only
launcher-side code alive while a child owns the screen - now carries
the idle staging: after dark_time with no key activity and no audio
rendering the backlight goes dark (stage 1 only), any key press lights
it back up, and radio/music/TV actually rendering suppresses the
staging entirely so the panel stays on for the session.  Deep sleep
stays launcher-home-only: the keyboard queue drops events while an app
is foreground, so a deep-sleeping launcher could never be woken by a
key.
pygame keeps its mixer open for the whole app lifetime and pumps digital
silence, which holds a sink in the RUNNING state without any audible
media - the sink-state probe therefore read oneapp as playing forever
and never staged the backlight dark.  The staging probe now captures
0.45s of each RUNNING sink's monitor via pw-record (stream.capture.sink)
and requires real output energy; a failed capture falls back to treating
the sink as playing so a broken probe can never sleep the panel in the
middle of actual media.
Streaming under Wi-Fi PSM stalls the TCP fetch long enough that ffplay's
reconnect kicks in - observed as a 9.1 s silent gap through the Bluetooth
speaker with 'Unexpected continuation frame' UART noise right after, and
the app's own reconnect flags already document 'WiFi 停顿导致 TCP 断'.
While media renders the fetch traffic keeps the radio awake anyway, so
PSM saves nothing during playback and only costs the stalls.  The media
probe now toggles power save off for the playback period and restores it
when idle or when the app exits, riding a narrow sudoers rule shipped by
the deb for exactly the two iw commands; a missing rule degrades to the
status quo instead of breaking anything.
The device's iw rejects '0'/'1' with 'Invalid parameter', so both the
sudoers rule and the runner now use 'off'/'on' - verified live on the
device that the narrow sudo rule toggles power save both ways.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant