Public Access
Add four animated Cyberpunk-style ESPHome pages
Netrunner HUD, self-solving breach protocol, optics boot-and-scan and a split HUD with a mini breach matrix, all in the page rotation. The el512 display gains animated_pages / animation_interval (redraw ~15 fps while shown), page_age_ms() as animation clock, and shift_rows() / invert_rect() for glitch effects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6d5e5315f0
commit
50ee17b3f6
7 files changed
+944
-4
No files matched your search
@@ -0,0 +1,55 @@
|
||||
// Cyberpunk-style animated pages for the ESPHome display: a netrunner HUD, a
|
||||
// self-solving breach protocol, an optics boot-and-scan sequence, and a HUD
|
||||
// with a small breach matrix. Inspired by the look of Cyberpunk 2077; the
|
||||
// layouts and graphics are drawn from scratch, no game assets are used.
|
||||
//
|
||||
// Each function draws a whole page. Call it from a page lambda and list that
|
||||
// page under animated_pages: the animation clock is the display's
|
||||
// page_age_ms(), so every page starts its intro when it is shown.
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
|
||||
#include "esphome/components/display/display.h"
|
||||
#include "esphome/core/time.h"
|
||||
|
||||
namespace esphome::el512 {
|
||||
|
||||
class EL512Display;
|
||||
|
||||
namespace cyber {
|
||||
|
||||
struct Fonts {
|
||||
display::BaseFont *title{nullptr}; // wide display face for headers (Orbitron)
|
||||
display::BaseFont *label{nullptr}; // condensed labels (Rajdhani)
|
||||
display::BaseFont *value{nullptr}; // condensed readouts (Rajdhani bold)
|
||||
display::BaseFont *huge{nullptr}; // clock digits (Rajdhani bold)
|
||||
display::BaseFont *mono{nullptr}; // small monospace for logs and tickers (Share Tech Mono)
|
||||
display::BaseFont *code{nullptr}; // larger monospace for breach codes (Share Tech Mono)
|
||||
};
|
||||
|
||||
struct Reading {
|
||||
std::string name;
|
||||
float value{NAN};
|
||||
};
|
||||
|
||||
// Home Assistant values shown on the pages; NAN or "" when unknown.
|
||||
struct HomeData {
|
||||
std::string weather; // condition, e.g. "partlycloudy"
|
||||
float temp{NAN}; // °C
|
||||
float humidity{NAN}; // %
|
||||
float wind{NAN}; // km/h
|
||||
float solar{NAN}; // W
|
||||
float house{NAN}; // W
|
||||
float grid{NAN}; // W, > 0 = import
|
||||
Reading rooms[4];
|
||||
};
|
||||
|
||||
void netrunner_hud(EL512Display &it, const Fonts &f, const HomeData &d, ESPTime now);
|
||||
void breach_protocol(EL512Display &it, const Fonts &f);
|
||||
void optics_scan(EL512Display &it, const Fonts &f, const HomeData &d, ESPTime now);
|
||||
void split_hud(EL512Display &it, const Fonts &f, const HomeData &d, ESPTime now);
|
||||
|
||||
} // namespace cyber
|
||||
} // namespace esphome::el512
|
||||
Reference in new issue
Block a user