Add four Star Trek / Lower Decks pages with a 3D printer red alert

LCARS ship status, the Cerritos duty roster from the agenda, a warp core
driven by solar power with Rutherford's advice, and a captain's log under
a viewscreen. Original pixel art in tools/trek_sprites.py.

When the 3D printer (Moonraker current_print_state, `printer`
substitution) is paused or in error, the panel jumps to LCARS Status in
red alert and holds the rotation until it carries on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-19 16:29:29 +02:00
1 parent 4c6286e794
commit 13a499fd97
8 files changed
+811 -8

No files matched your search

+59 -3
View File
@@ -10,6 +10,7 @@ substitutions:
friendly_name: EL512 Panel
weather: weather.knmi_home
envoy: sensor.envoy_122225067403
printer: sensor.mainsailos_current_print_state # Moonraker; "paused"/"error" = red alert
esphome:
name: ${name}
@@ -20,6 +21,7 @@ esphome:
id(ks_fonts) = {id(f_ks_title), id(f_ks_big), id(f_ks_text), id(f_ks_pixel), id(f_ks_pixel_l), id(f_ks_jp),
id(f_ks_jp_big), id(icons_l)};
id(sg_fonts) = {id(f_sg_nixie), id(f_sg_title), id(f_cp_mono), id(f_cp_code), id(f_ks_pixel), id(f_sg_jp)};
id(st_fonts) = {id(f_st_small), id(f_st_medium), id(f_st_large), id(f_ks_text), id(f_ks_pixel)};
esp32:
board: wemos_d1_mini32
@@ -65,13 +67,15 @@ globals:
- id: plex_updated
type: uint32_t
initial_value: "0"
# Themed pages (Cyberpunk, KonoSuba, Steins;Gate): their fonts and the home data they show.
# Themed pages (Cyberpunk, KonoSuba, Steins;Gate, Star Trek): their fonts and the home data they show.
- id: cp_fonts
type: el512::cyber::Fonts
- id: ks_fonts
type: el512::konosuba::Fonts
- id: sg_fonts
type: el512::steins::Fonts
- id: st_fonts
type: el512::trek::Fonts
- id: cp_home
type: el512::HomeData
@@ -213,6 +217,20 @@ font:
id: f_sg_jp
size: 18
glyphs: "未来ガジェット研究所世界線"
# Star Trek pages: Antonio stands in for the LCARS typeface (also use
# f_ks_text and f_ks_pixel)
- file: "gfonts://Antonio@600"
id: f_st_small
size: 16
glyphsets: [GF_Latin_Core]
- file: "gfonts://Antonio@600"
id: f_st_medium
size: 26
glyphsets: [GF_Latin_Core]
- file: "gfonts://Antonio@700"
id: f_st_large
size: 60
glyphs: " 0123456789:ADELRT"
# --- Data from Home Assistant -------------------------------------------------
text_sensor:
@@ -245,6 +263,9 @@ text_sensor:
attribute: streams
on_value:
- lambda: id(plex_updated) = millis();
- platform: homeassistant
id: printer_state
entity_id: ${printer}
- platform: homeassistant
id: plex_update
entity_id: update.plex_media_server_mangavalkserver
@@ -414,6 +435,10 @@ select:
- D-Mail
- Gadget Lab
- World Lines
- LCARS Status
- Duty Roster
- Warp Core
- Captain's Log
initial_option: Clock
set_action:
- lambda: |-
@@ -438,6 +463,10 @@ select:
else if (x == "D-Mail") p = id(page_sg_dmail);
else if (x == "Gadget Lab") p = id(page_sg_lab);
else if (x == "World Lines") p = id(page_sg_world);
else if (x == "LCARS Status") p = id(page_st_lcars);
else if (x == "Duty Roster") p = id(page_st_roster);
else if (x == "Warp Core") p = id(page_st_warp);
else if (x == "Captain's Log") p = id(page_st_log);
id(panel).show_page(p);
id(panel).update();
@@ -456,6 +485,13 @@ interval:
- interval: 1s
then:
- lambda: |-
// Red alert (the 3D printer paused or failed): jump to LCARS once,
// then hold the rotation until the printer carries on.
static bool was_alert = false;
const bool alert = el512::trek::red_alert(id(cp_home));
if (alert && !was_alert) { id(panel).show_page(id(page_st_lcars)); id(panel).update(); }
was_alert = alert;
if (alert) { id(rotation_elapsed) = 0; return; }
if (id(sw_pause).state || id(panel).is_still_alive_playing()) { id(rotation_elapsed) = 0; return; }
if (++id(rotation_elapsed) < (int) id(page_interval).state) return;
id(rotation_elapsed) = 0;
@@ -470,7 +506,7 @@ interval:
id(page_plex), id(page_solar), id(page_cyber_hud), id(page_cyber_breach), id(page_cyber_scan),
id(page_cyber_split), id(page_ks_explosion), id(page_ks_guild), id(page_ks_card),
id(page_ks_battle), id(page_sg_meter), id(page_sg_dmail), id(page_sg_lab), id(page_sg_world),
id(page_still_alive)};
id(page_st_lcars), id(page_st_roster), id(page_st_warp), id(page_st_log), id(page_still_alive)};
for (size_t i = order.size() - 1; i > 0; i--)
std::swap(order[i], order[random_uint32() % (i + 1)]);
pos = order.size() - 1; // the next step starts at the front
@@ -498,6 +534,7 @@ interval:
d.solar_today = id(solar_today).state;
d.agenda = id(agenda_events).state;
d.message = id(panel_message).state;
d.printer = id(printer_state).state;
d.house = id(house_power).state;
d.grid = id(grid_import).state - id(grid_export).state;
d.rooms[0] = {"Woonkamer", id(t_woonkamer).state};
@@ -517,7 +554,8 @@ display:
# Redrawn every animation_interval (~15 fps) while shown.
animated_pages: [page_cyber_hud, page_cyber_breach, page_cyber_scan, page_cyber_split,
page_ks_explosion, page_ks_guild, page_ks_card, page_ks_battle,
page_sg_meter, page_sg_dmail, page_sg_lab, page_sg_world]
page_sg_meter, page_sg_dmail, page_sg_lab, page_sg_world,
page_st_lcars, page_st_roster, page_st_warp, page_st_log]
animation_interval: 66ms
on_page_change:
- then:
@@ -542,6 +580,10 @@ display:
else if (to == id(page_sg_dmail)) name = "D-Mail";
else if (to == id(page_sg_lab)) name = "Gadget Lab";
else if (to == id(page_sg_world)) name = "World Lines";
else if (to == id(page_st_lcars)) name = "LCARS Status";
else if (to == id(page_st_roster)) name = "Duty Roster";
else if (to == id(page_st_warp)) name = "Warp Core";
else if (to == id(page_st_log)) name = "Captain's Log";
if (id(page_select).current_option() != name) id(page_select).publish_state(name);
pages:
# 1. Clock, date and current weather
@@ -797,3 +839,17 @@ display:
- id: page_sg_world
lambda: |-
el512::steins::world_lines(*id(panel), id(sg_fonts), id(cp_home), id(ha_time).now());
# 21-24. Star Trek / Lower Decks pages (components/el512/trek.cpp)
- id: page_st_lcars
lambda: |-
el512::trek::lcars_status(*id(panel), id(st_fonts), id(cp_home), id(ha_time).now());
- id: page_st_roster
lambda: |-
el512::trek::duty_roster(*id(panel), id(st_fonts), id(cp_home), id(ha_time).now());
- id: page_st_warp
lambda: |-
el512::trek::warp_core(*id(panel), id(st_fonts), id(cp_home));
- id: page_st_log
lambda: |-
el512::trek::captains_log(*id(panel), id(st_fonts), id(cp_home), id(ha_time).now());