Public Access
Driver (components/el512/el512_panel.*, ESP-IDF only): - DMA ring of 8 x 4 lines (17 KB) refilled from the I2S EOF interrupt (IRAM) instead of a 142 KB full-frame stream; ~107 KB heap freed. - 256-entry lookup table encodes 8 pixels per step. - Back buffer + displayed buffer, swapped at the start of a frame. - PlatformIO builds it via lib_extra_dirs (EL512Core); lib/EL512 keeps the Adafruit GFX front end. ESPHome external component (platform: el512): - DisplayBuffer with optional ENABLE / _LOWPWR pins, set_enabled(), set_low_power(), helper functions for page lambdas. - still_alive_page: plays the Portal end-credits show, then returns to the previous page. Still Alive engine moved to components/el512/still_alive.* with a built-in 5x7 font (from Adafruit GFX, BSD); the PlatformIO demo uses the same code. The importer writes components/el512/still_alive_data.h and stops at 200 s (--until-ms), matching the hand-trimmed data. esphome/el512-panel.yaml: 8 pages (clock, forecast, agenda, dashboard, now playing, Plex, solar, Still Alive), page select, rotation, display and low-power switches, message text. home_assistant/packages/el512_panel.yaml: helper template sensors for forecast, agenda, now playing and Plex streams. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.7 KiB
C++
69 lines
2.7 KiB
C++
#pragma once
|
|
|
|
#include "el512_helpers.h"
|
|
#include "el512_panel.h"
|
|
#include "esphome/components/display/display_buffer.h"
|
|
#include "esphome/core/component.h"
|
|
#include "still_alive.h"
|
|
|
|
namespace esphome::el512 {
|
|
|
|
// ESPHome display for the Planar EL512.256-H. Drawing goes into the panel
|
|
// driver's back buffer; every update() hands it to the refresh in one piece.
|
|
class EL512Display : public display::DisplayBuffer {
|
|
public:
|
|
void set_pins(int vclk, int vid, int tvid, int hs, int vs, int enable, int low_power) {
|
|
this->pins_ = {(int8_t) vclk, (int8_t) vid, (int8_t) tvid, (int8_t) hs,
|
|
(int8_t) vs, (int8_t) enable, (int8_t) low_power};
|
|
}
|
|
|
|
void setup() override;
|
|
void loop() override;
|
|
void update() override;
|
|
void dump_config() override;
|
|
float get_setup_priority() const override { return setup_priority::PROCESSOR; }
|
|
|
|
void fill(Color color) override;
|
|
display::DisplayType get_display_type() override { return display::DisplayType::DISPLAY_TYPE_BINARY; }
|
|
|
|
// Display on/off (ENABLE) and low-power mode (_LOWPWR), e.g. from template switches.
|
|
void set_enabled(bool on);
|
|
void set_low_power(bool on);
|
|
bool is_enabled() const { return this->enabled_; }
|
|
bool is_low_power() const { return this->low_power_; }
|
|
bool has_enable_pin() const { return this->pins_.enable >= 0; }
|
|
bool has_low_power_pin() const { return this->pins_.lowpwr_n >= 0; }
|
|
|
|
// Portal end-credits show. Showing this page restarts it; while it is the
|
|
// active page the display redraws as the show advances, and when it ends the
|
|
// previous page comes back. Draw it from that page's lambda with
|
|
// draw_still_alive().
|
|
void set_still_alive_page(display::DisplayPage *page) { this->still_alive_page_ = page; }
|
|
void draw_still_alive();
|
|
// Show the Still Alive page and start the show from the top (also when it is
|
|
// already playing).
|
|
void play_still_alive();
|
|
bool is_still_alive_playing() const {
|
|
return this->still_alive_page_ != nullptr && this->get_active_page() == this->still_alive_page_;
|
|
}
|
|
// When to start the music, in ms after the page was shown.
|
|
uint32_t still_alive_song_start_ms() const { return el512sa::StillAlivePlayer::songStartMs(); }
|
|
|
|
protected:
|
|
void draw_absolute_pixel_internal(int x, int y, Color color) override;
|
|
int get_width_internal() override { return EL512Panel::WIDTH; }
|
|
int get_height_internal() override { return EL512Panel::HEIGHT; }
|
|
|
|
EL512Pins pins_{18, 19, 21, 22, 23, -1, -1};
|
|
EL512Panel *panel_{nullptr};
|
|
bool enabled_{true};
|
|
bool low_power_{false};
|
|
|
|
display::DisplayPage *still_alive_page_{nullptr};
|
|
display::DisplayPage *still_alive_return_{nullptr};
|
|
bool still_alive_was_active_{false};
|
|
el512sa::StillAlivePlayer still_alive_;
|
|
};
|
|
|
|
} // namespace esphome::el512
|