Skip to content

feat(oled): add safer sleep and idle status carousel - #858

Draft
SiYue-ZO wants to merge 1 commit into
sipeed:mainfrom
SiYue-ZO:feat/oled-power-management
Draft

feat(oled): add safer sleep and idle status carousel#858
SiYue-ZO wants to merge 1 commit into
sipeed:mainfrom
SiYue-ZO:feat/oled-power-management

Conversation

@SiYue-ZO

@SiYue-ZO SiYue-ZO commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Validate OLED sleep values and persist them atomically. Missing configuration now uses a 60-second default, while an explicit value of 0 still disables automatic sleep.
  • Restart the idle countdown and clear carousel deadlines whenever the sleep setting changes.
  • Use monotonic timing for OLED inactivity, carousel, event-wake, Wi-Fi, and button timers so NTP synchronization or wall-clock changes cannot trigger immediate carousel or sleep.
  • Separate OLED power state from UI subpages. Sleep disables the panel and charge pump, while wake-up renders a complete frame before enabling the display.
  • Make the main-page button a stable manual power toggle and bound hardware-event wake windows. Wi-Fi provisioning preserves its workflow state while applying an independent five-minute display timeout.
  • Add a Cube idle dashboard with network, video, and session pages. The Never, 30-minute, and one-hour modes enter the carousel after 15 minutes of local inactivity. Pages rotate every six seconds and periodically shift position to reduce fixed-pixel exposure. Never continues rotating without automatically turning the display off.
  • Publish active MJPEG, Direct, and WebRTC viewer counts through a two-second tmpfs heartbeat. Missing or stale state falls back to zero after five seconds, and short-lived capture leases are excluded.

Compatibility

  • The OLED API remains unchanged: POST /api/vm/oled accepts sleep, and GET /api/vm/oled returns exist and sleep.
  • Sleep values are restricted to 0 or 10–3600 seconds on both the server and kvm_system sides.
  • Existing valid persisted values, including an explicit 0, are preserved.
  • Devices without /etc/kvm/oled_sleep now use a 60-second default. This is an intentional behavior change.
  • PCIe devices retain the legacy layout and do not use the Cube carousel or pixel offsets.
  • Devices without an OLED continue to skip the OLED thread.
  • Viewer heartbeat state is runtime-only under /run/nanokvm; missing or stale state is treated as zero.

Related to #835.
Partially addresses #105.

Validate and atomically persist OLED sleep settings, while using a 60-second default when no configuration exists. Reset idle and carousel deadlines when the setting changes.

Move display power transitions into the OLED thread so sleep disables the panel and charge pump, wake-up renders a complete frame before enabling the panel, and manual, event, Wi-Fi, and shutdown policies no longer share UI page state. Use monotonic timing so NTP synchronization cannot trigger immediate carousel or sleep.

Rotate network, video, and session information with pixel shifting on long-idle Cube displays. Publish active stream viewer counts through a stale-safe runtime heartbeat while preserving the legacy PCIe layout.
@SiYue-ZO
SiYue-ZO force-pushed the feat/oled-power-management branch from 8708757 to 895dcdf Compare August 5, 2026 19:42
@SiYue-ZO
SiYue-ZO marked this pull request as draft August 6, 2026 03:41
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