Public Access
Add four animated KonoSuba ESPHome pages
Megumin's daily explosion, the Adventurers' Guild quest board (agenda, weather, solar), Megumin's adventurer card and a party battle against a giant toad with a live-data battle log. Original 1-bit pixel art lives in tools/konosuba_sprites.py, which generates konosuba_sprites.h and can render a preview PNG. Home data and drawing helpers shared by the themed pages move to el512_pages.h; the display gains dither_mask() for a dissolve-in intro. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
50ee17b3f6
commit
e9b91c5628
11 files changed
+1655
-61
No files matched your search
@@ -17,6 +17,8 @@ esphome:
|
||||
on_boot:
|
||||
- lambda: |-
|
||||
id(cp_fonts) = {id(f_cp_title), id(f_cp_label), id(f_cp_value), id(f_cp_huge), id(f_cp_mono), id(f_cp_code)};
|
||||
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)};
|
||||
|
||||
esp32:
|
||||
board: wemos_d1_mini32
|
||||
@@ -59,11 +61,13 @@ globals:
|
||||
- id: np_updated
|
||||
type: uint32_t
|
||||
initial_value: "0"
|
||||
# Cyberpunk pages: their fonts and the home data they show.
|
||||
# Themed pages (Cyberpunk, KonoSuba): their fonts and the home data they show.
|
||||
- id: cp_fonts
|
||||
type: el512::cyber::Fonts
|
||||
- id: ks_fonts
|
||||
type: el512::konosuba::Fonts
|
||||
- id: cp_home
|
||||
type: el512::cyber::HomeData
|
||||
type: el512::HomeData
|
||||
|
||||
# --- Fonts -------------------------------------------------------------------
|
||||
font:
|
||||
@@ -159,6 +163,35 @@ font:
|
||||
id: f_cp_code
|
||||
size: 22
|
||||
glyphs: " 0123456789ABCDEF."
|
||||
# KonoSuba pages
|
||||
- file: "gfonts://Cinzel@700"
|
||||
id: f_ks_title
|
||||
size: 22
|
||||
glyphs: " ABCDEFGHIJKLMNOPQRSTUVWXYZ'!"
|
||||
- file: "gfonts://Cinzel Decorative@900"
|
||||
id: f_ks_big
|
||||
size: 44
|
||||
glyphs: "EXPLOSIN!"
|
||||
- file: "gfonts://Nunito@700"
|
||||
id: f_ks_text
|
||||
size: 16
|
||||
glyphsets: [GF_Latin_Core]
|
||||
- file: "gfonts://Press Start 2P"
|
||||
id: f_ks_pixel
|
||||
size: 8
|
||||
glyphsets: [GF_Latin_Core]
|
||||
- file: "gfonts://Press Start 2P"
|
||||
id: f_ks_pixel_l
|
||||
size: 16
|
||||
glyphs: " 0123456789:!ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
- file: "gfonts://Noto Sans JP@700"
|
||||
id: f_ks_jp
|
||||
size: 20
|
||||
glyphs: "冒険者ギルドカー戦闘" # each character once
|
||||
- file: "gfonts://Dela Gothic One"
|
||||
id: f_ks_jp_big
|
||||
size: 40
|
||||
glyphs: "爆裂魔法"
|
||||
|
||||
# --- Data from Home Assistant -------------------------------------------------
|
||||
text_sensor:
|
||||
@@ -350,6 +383,10 @@ select:
|
||||
- Cyber Breach
|
||||
- Cyber Scan
|
||||
- Cyber Split
|
||||
- KonoSuba Explosion
|
||||
- KonoSuba Guild
|
||||
- KonoSuba Card
|
||||
- KonoSuba Battle
|
||||
initial_option: Clock
|
||||
set_action:
|
||||
- lambda: |-
|
||||
@@ -366,6 +403,10 @@ select:
|
||||
else if (x == "Cyber Breach") p = id(page_cyber_breach);
|
||||
else if (x == "Cyber Scan") p = id(page_cyber_scan);
|
||||
else if (x == "Cyber Split") p = id(page_cyber_split);
|
||||
else if (x == "KonoSuba Explosion") p = id(page_ks_explosion);
|
||||
else if (x == "KonoSuba Guild") p = id(page_ks_guild);
|
||||
else if (x == "KonoSuba Card") p = id(page_ks_card);
|
||||
else if (x == "KonoSuba Battle") p = id(page_ks_battle);
|
||||
id(panel).show_page(p);
|
||||
id(panel).update();
|
||||
|
||||
@@ -386,7 +427,7 @@ interval:
|
||||
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;
|
||||
for (int i = 0; i < 12; i++) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
id(panel).show_next_page();
|
||||
const auto *p = id(panel).get_active_page();
|
||||
const std::string &np = id(np_state).state;
|
||||
@@ -395,7 +436,7 @@ interval:
|
||||
break;
|
||||
}
|
||||
id(panel).update();
|
||||
# Home data for the Cyberpunk pages.
|
||||
# Home data for the themed pages.
|
||||
- interval: 1s
|
||||
then:
|
||||
- lambda: |-
|
||||
@@ -405,6 +446,8 @@ interval:
|
||||
d.humidity = id(weather_hum).state;
|
||||
d.wind = id(weather_wind).state;
|
||||
d.solar = id(solar_power).state;
|
||||
d.solar_today = id(solar_today).state;
|
||||
d.agenda = id(agenda_events).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};
|
||||
@@ -421,7 +464,8 @@ display:
|
||||
update_interval: 1s
|
||||
still_alive_page: page_still_alive
|
||||
# Redrawn every animation_interval (~15 fps) while shown.
|
||||
animated_pages: [page_cyber_hud, page_cyber_breach, page_cyber_scan, page_cyber_split]
|
||||
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]
|
||||
animation_interval: 66ms
|
||||
on_page_change:
|
||||
- then:
|
||||
@@ -438,6 +482,10 @@ display:
|
||||
else if (to == id(page_cyber_breach)) name = "Cyber Breach";
|
||||
else if (to == id(page_cyber_scan)) name = "Cyber Scan";
|
||||
else if (to == id(page_cyber_split)) name = "Cyber Split";
|
||||
else if (to == id(page_ks_explosion)) name = "KonoSuba Explosion";
|
||||
else if (to == id(page_ks_guild)) name = "KonoSuba Guild";
|
||||
else if (to == id(page_ks_card)) name = "KonoSuba Card";
|
||||
else if (to == id(page_ks_battle)) name = "KonoSuba Battle";
|
||||
if (id(page_select).current_option() != name) id(page_select).publish_state(name);
|
||||
pages:
|
||||
# 1. Clock, date and current weather
|
||||
@@ -633,3 +681,17 @@ display:
|
||||
- id: page_cyber_split
|
||||
lambda: |-
|
||||
el512::cyber::split_hud(*id(panel), id(cp_fonts), id(cp_home), id(ha_time).now());
|
||||
|
||||
# 13-16. KonoSuba pages (components/el512/konosuba.cpp)
|
||||
- id: page_ks_explosion
|
||||
lambda: |-
|
||||
el512::konosuba::explosion(*id(panel), id(ks_fonts), id(cp_home), id(ha_time).now());
|
||||
- id: page_ks_guild
|
||||
lambda: |-
|
||||
el512::konosuba::guild_board(*id(panel), id(ks_fonts), id(cp_home), id(ha_time).now());
|
||||
- id: page_ks_card
|
||||
lambda: |-
|
||||
el512::konosuba::adventurer_card(*id(panel), id(ks_fonts), id(cp_home), id(ha_time).now());
|
||||
- id: page_ks_battle
|
||||
lambda: |-
|
||||
el512::konosuba::party_battle(*id(panel), id(ks_fonts), id(cp_home));
|
||||
Reference in new issue
Block a user