Deluge Firmware 1.3.0
Build date: 2026.08.23
Loading...
Searching...
No Matches
deluge::hid::display::Screensaver Class Reference

Blanks the OLED, or replaces it with a starfield or a field of Deluge rain, after a configurable period without physical input. More...

#include <screensaver.h>

Collaboration diagram for deluge::hid::display::Screensaver:

Static Public Member Functions

Event entry points
static void noteActivity ()
 Register that a physical control was touched: wake the screensaver if it is showing, and re-arm the idle timer either way.
static void timerEvent ()
 Activate the screensaver, or advance it one animation frame.
static void settingsChanged ()
 Apply a change to the mode or timeout setting: wake if showing, then re-arm or cancel the timer for the new settings.
Display integration
static bool isActive ()
 Whether the screensaver is currently overriding the panel contents.
static bool consumeFrameDirty ()
 Test and clear the "our canvas changed" flag.
static oled_canvas::CanvasgetCanvas ()
 The canvas the screensaver draws into, which sendMainImage() sends in place of main.

Static Private Member Functions

static void arm ()
 Set the idle timer from the configured timeout.
static void render ()
 Draw the current frame into canvas_ and mark it dirty.
static void renderStarfield ()
 Draw the starfield's stars into canvas_.
static void renderRainfall ()
 Draw the rainfall's streaks into canvas_.

Static Private Attributes

static bool active_ = false
static bool frameDirty_ = false
static oled_canvas::Canvas canvas_
static Starfield starfield_
static Rainfall rainfall_

Detailed Description

Blanks the OLED, or replaces it with a starfield or a field of Deluge rain, after a configurable period without physical input.

OLED only: 7SEG units never activate it. All state is static – there is exactly one screensaver.

Note
It renders into its own canvas rather than the main one, and so never writes to main: waking up is just "stop overriding and mark dirty". Other UI timers (side-scrollers, the working animation) can and do keep writing to main while the screensaver is showing, so whatever they have left there is already current when it wakes.

Member Function Documentation

◆ consumeFrameDirty()

bool deluge::hid::display::Screensaver::consumeFrameDirty ( )
inlinestatic

Test and clear the "our canvas changed" flag.

Lets sendMainImage() tell "our frame actually changed" apart from "some unrelated timer (scrolling text, working animation) marked the display dirty while we are showing".

Warning
Test-and-clear: each call consumes the flag. A caller that ignores a false return and resends anyway reintroduces the SPI-bus flood this protocol was added to fix – the side-scroller re-arms every 5-15ms, so an unconditional resend would run continuously for as long as the screensaver is showing.
Returns
True if the canvas changed since the last call.

◆ getCanvas()

oled_canvas::Canvas & deluge::hid::display::Screensaver::getCanvas ( )
inlinestatic

The canvas the screensaver draws into, which sendMainImage() sends in place of main.

Warning
DO NOT USE THIS OUTSIDE OF OLED::sendMainImage().
Returns
The screensaver's own canvas.

◆ isActive()

bool deluge::hid::display::Screensaver::isActive ( )
inlinestaticnodiscard

Whether the screensaver is currently overriding the panel contents.

Returns
True while the screensaver is overriding the panel contents.

◆ noteActivity()

void deluge::hid::display::Screensaver::noteActivity ( )
static

Register that a physical control was touched: wake the screensaver if it is showing, and re-arm the idle timer either way.

Warning
This sits on the input hot path. The wake check runs first, before the mode-is-off check, so a mode that somehow reached OFF without going through settingsChanged() can never strand the panel permanently blank.

◆ timerEvent()

void deluge::hid::display::Screensaver::timerEvent ( )
static

Activate the screensaver, or advance it one animation frame.

Dispatched from UITimerManager when TimerName::SCREENSAVER fires.


The documentation for this class was generated from the following files:
  • src/deluge/hid/display/screensaver.h
  • src/deluge/hid/display/screensaver.cpp