#pragma once // GDEY0213F52, JD79676 controller, 128x250, 4-color (BWRY). The V2 revision of // the GDEY0213F51 (JD79661) on a different controller - this is the part the // bench F52 panels actually are (see the F51-vs-F52 control-diff memory). // // Emitter-derived (tools/gxepd2_harness/emit_descriptor.h) from the vendor // GxEPD2_213c_GDEY0213F52 driver pulled into third_party/GxEPD2/ from the zGxEPD2 fork. // The striking thing the capture shows: this driver is *minimal* because the // JD79676 loads PSR/PWR/BTST/resolution and the full-refresh LUT from on-chip // OTP. So init is just 0xE9=0x01 then power-on (0x04), there is NO register // setup and NO window command at all (OTP resolution defaults to 128x250 = // WIDTH x HEIGHT, and with partial-update off the controller fills the whole // OTP-default frame), and refresh is a bare 0x12 trigger relying on the OTP // default CDI. Nothing to hand-transcribe - this is exactly what the emitter // produced, with only the packed-format fields added below. // // Packed 4-color: bits_per_pixel=2, GXEPD2_PALETTE_4C (the vendor's own // color4() black0/white1/yellow2/red3, validated by the diag Pattern-B pass - // see CONTRIBUTING.md "Limits"; the F52 uses the same GxEPD2_4C wrapper). blank_code=0x01 // matches the observed 0x55 white clear (code 01 x4). If colors come out wrong // on hardware the palette/codes are the thing to re-check for JD79676. // // Bench-confirmed 2026-10-18: 4 colors, clean lines/gradients, ~15.5s full // refresh. Needed the engine's new post-reset busy wait (cycle_engine.h) - the // JD79676 holds BUSY while loading from OTP after reset, which the command // capture can't see; without it every busy-wait returned in ~8ms and nothing // refreshed. busy_level LOW (the HIGH experiment hung on idle-HIGH) is correct. #include "epd_command.h" namespace esphome::gxepd2 { inline const uint8_t PANEL_213C_GDEY0213F52_CMD_E9[] = {0x01}; inline const EpdCommand PANEL_213C_GDEY0213F52_INIT[] = { {0xE9, PANEL_213C_GDEY0213F52_CMD_E9, 1}, {0x04, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, // power on }; inline const uint8_t PANEL_213C_GDEY0213F52_REFRESH_TRIGGER[] = {0x00}; inline const EpdCommand PANEL_213C_GDEY0213F52_REFRESH[] = { {0x12, PANEL_213C_GDEY0213F52_REFRESH_TRIGGER, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, }; inline const uint8_t PANEL_213C_GDEY0213F52_POWER_OFF_0_02[] = {0x00}; inline const EpdCommand PANEL_213C_GDEY0213F52_POWER_OFF[] = { {0x02, PANEL_213C_GDEY0213F52_POWER_OFF_0_02, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, }; inline const uint8_t PANEL_213C_GDEY0213F52_HIBERNATE_0_07[] = {0xA5}; inline const EpdCommand PANEL_213C_GDEY0213F52_HIBERNATE[] = { {0x07, PANEL_213C_GDEY0213F52_HIBERNATE_0_07, 1}, }; inline const EpdPanelDescriptor PANEL_213C_GDEY0213F52 = { .width = 128, .height = 250, .busy_active_level = false, // GxEPD2_EPD(..., /*busy_level=*/LOW, ...) - confirmed: HIGH hangs .busy_timeout_ms = 30000, // vendor full_refresh_time ~16000ms; err long .init_sequence = PANEL_213C_GDEY0213F52_INIT, .init_sequence_len = sizeof(PANEL_213C_GDEY0213F52_INIT) / sizeof(PANEL_213C_GDEY0213F52_INIT[0]), .window_sequence = {nullptr, nullptr}, // OTP-default full frame; driver sets no window .window_sequence_len = {0, 0}, .plane_count = 1, .plane_write_cmd = {0x10, 0x00}, .plane_invert = {false, false}, // unused for packed panels .bits_per_pixel = 2, .palette = GXEPD2_PALETTE_4C, .palette_len = GXEPD2_PALETTE_4C_LEN, .blank_code = 0x01, // white; matches the observed 0x55 clear (code 01 x4) .refresh_sequence = PANEL_213C_GDEY0213F52_REFRESH, .refresh_sequence_len = sizeof(PANEL_213C_GDEY0213F52_REFRESH) / sizeof(PANEL_213C_GDEY0213F52_REFRESH[0]), .power_off_sequence = PANEL_213C_GDEY0213F52_POWER_OFF, .power_off_sequence_len = sizeof(PANEL_213C_GDEY0213F52_POWER_OFF) / sizeof(PANEL_213C_GDEY0213F52_POWER_OFF[0]), .hibernate_sequence = PANEL_213C_GDEY0213F52_HIBERNATE, .hibernate_sequence_len = sizeof(PANEL_213C_GDEY0213F52_HIBERNATE) / sizeof(PANEL_213C_GDEY0213F52_HIBERNATE[0]), }; } // namespace esphome::gxepd2