panel_213c_gdey0213f52.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #pragma once
  2. // GDEY0213F52, JD79676 controller, 128x250, 4-color (BWRY). The V2 revision of
  3. // the GDEY0213F51 (JD79661) on a different controller - this is the part the
  4. // bench F52 panels actually are (see the F51-vs-F52 control-diff memory).
  5. //
  6. // Emitter-derived (tools/gxepd2_harness/emit_descriptor.h) from the vendor
  7. // GxEPD2_213c_GDEY0213F52 driver pulled into third_party/GxEPD2/ from the zGxEPD2 fork.
  8. // The striking thing the capture shows: this driver is *minimal* because the
  9. // JD79676 loads PSR/PWR/BTST/resolution and the full-refresh LUT from on-chip
  10. // OTP. So init is just 0xE9=0x01 then power-on (0x04), there is NO register
  11. // setup and NO window command at all (OTP resolution defaults to 128x250 =
  12. // WIDTH x HEIGHT, and with partial-update off the controller fills the whole
  13. // OTP-default frame), and refresh is a bare 0x12 trigger relying on the OTP
  14. // default CDI. Nothing to hand-transcribe - this is exactly what the emitter
  15. // produced, with only the packed-format fields added below.
  16. //
  17. // Packed 4-color: bits_per_pixel=2, GXEPD2_PALETTE_4C (the vendor's own
  18. // color4() black0/white1/yellow2/red3, validated by the diag Pattern-B pass -
  19. // see DESIGN.md §12; the F52 uses the same GxEPD2_4C wrapper). blank_code=0x01
  20. // matches the observed 0x55 white clear (code 01 x4). If colors come out wrong
  21. // on hardware the palette/codes are the thing to re-check for JD79676.
  22. //
  23. // Bench-confirmed 2026-10-18: 4 colors, clean lines/gradients, ~15.5s full
  24. // refresh. Needed the engine's new post-reset busy wait (cycle_engine.h) - the
  25. // JD79676 holds BUSY while loading from OTP after reset, which the command
  26. // capture can't see; without it every busy-wait returned in ~8ms and nothing
  27. // refreshed. busy_level LOW (the HIGH experiment hung on idle-HIGH) is correct.
  28. #include "epd_command.h"
  29. namespace esphome::gxepd2 {
  30. inline const uint8_t PANEL_213C_GDEY0213F52_CMD_E9[] = {0x01};
  31. inline const EpdCommand PANEL_213C_GDEY0213F52_INIT[] = {
  32. {0xE9, PANEL_213C_GDEY0213F52_CMD_E9, 1},
  33. {0x04, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, // power on
  34. };
  35. inline const uint8_t PANEL_213C_GDEY0213F52_REFRESH_TRIGGER[] = {0x00};
  36. inline const EpdCommand PANEL_213C_GDEY0213F52_REFRESH[] = {
  37. {0x12, PANEL_213C_GDEY0213F52_REFRESH_TRIGGER, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0,
  38. /*wait_busy_after=*/true},
  39. };
  40. inline const EpdPanelDescriptor PANEL_213C_GDEY0213F52 = {
  41. .width = 128,
  42. .height = 250,
  43. .busy_active_level = false, // GxEPD2_EPD(..., /*busy_level=*/LOW, ...) - confirmed: HIGH hangs
  44. .busy_timeout_ms = 30000, // vendor full_refresh_time ~16000ms; err long
  45. .init_sequence = PANEL_213C_GDEY0213F52_INIT,
  46. .init_sequence_len = sizeof(PANEL_213C_GDEY0213F52_INIT) / sizeof(PANEL_213C_GDEY0213F52_INIT[0]),
  47. .window_sequence = {nullptr, nullptr}, // OTP-default full frame; driver sets no window
  48. .window_sequence_len = {0, 0},
  49. .plane_count = 1,
  50. .plane_write_cmd = {0x10, 0x00},
  51. .plane_invert = {false, false}, // unused for packed panels
  52. .bits_per_pixel = 2,
  53. .palette = GXEPD2_PALETTE_4C,
  54. .palette_len = GXEPD2_PALETTE_4C_LEN,
  55. .blank_code = 0x01, // white; matches the observed 0x55 clear (code 01 x4)
  56. .refresh_sequence = PANEL_213C_GDEY0213F52_REFRESH,
  57. .refresh_sequence_len = sizeof(PANEL_213C_GDEY0213F52_REFRESH) / sizeof(PANEL_213C_GDEY0213F52_REFRESH[0]),
  58. };
  59. } // namespace esphome::gxepd2