panel_579c_gdey0579f51_master_only.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #pragma once
  2. // Hand-derived from vendor/src/epd4c/GxEPD2_579c_GDEY0579F51.{h,cpp}
  3. // (GDEY0579F51, HX8717 controller, 792x272, same JD79667-family 2bpp/4-color
  4. // packing as GDEY029F51 - see panel_290c_gdey029f51.h). This is the actual
  5. // dual-CS-like split panel from the original bench list: NOT two physical
  6. // CS pins, but two logical regions ("master"/"slave", left/right halves)
  7. // selected over one bus via an 0xA2 command, each with its own window-set
  8. // and its own 0x10 plane-write burst.
  9. //
  10. // Deliberate scope cut (2026-09-19, per user): CycleEngine's state machine
  11. // only knows one window-set + one plane-write per update cycle, and
  12. // extending it to loop over two regions is real work, not just descriptor
  13. // data - so this descriptor addresses the master half ONLY, as if it were
  14. // a self-contained 396x272 single-region panel, to validate the 2bpp
  15. // packing and this controller family's init/refresh shape before building
  16. // the master+slave loop. Driving only the left half of the physical
  17. // screen is the expected/correct result of this descriptor, not a bug.
  18. // The slave half (right half) is simply never written or refreshed here.
  19. //
  20. // _InitDisplay()'s reset pulse is gated the same way GDEY029F51's is
  21. // (`_hibernating || _initial_write`) - this engine always does a real
  22. // hardware reset every cycle regardless, a superset of the vendor
  23. // driver's own first-cycle behavior, so no special-casing needed.
  24. #include "epd_command.h"
  25. namespace esphome::gxepd2 {
  26. inline const uint8_t PANEL_579C_GDEY0579F51_MO_SELECT_MASTER[] = {0x01};
  27. inline const uint8_t PANEL_579C_GDEY0579F51_MO_SELECT_BOTH[] = {0x00};
  28. inline const uint8_t PANEL_579C_GDEY0579F51_MO_PSR_MASTER[] = {0x07, 0x29};
  29. inline const uint8_t PANEL_579C_GDEY0579F51_MO_BTST[] = {0x32, 0x32, 0x32, 0x32};
  30. inline const uint8_t PANEL_579C_GDEY0579F51_MO_TRES[] = {0x01, 0x8C, 0x01, 0x10}; // 396x272
  31. inline const uint8_t PANEL_579C_GDEY0579F51_MO_CDI_INIT[] = {0x97};
  32. inline const uint8_t PANEL_579C_GDEY0579F51_MO_E9[] = {0x01};
  33. inline const uint8_t PANEL_579C_GDEY0579F51_MO_E0[] = {0x01};
  34. inline const EpdCommand PANEL_579C_GDEY0579F51_MO_INIT[] = {
  35. {0xA2, PANEL_579C_GDEY0579F51_MO_SELECT_MASTER, 1},
  36. {0x00, PANEL_579C_GDEY0579F51_MO_PSR_MASTER, 2},
  37. {0xA2, PANEL_579C_GDEY0579F51_MO_SELECT_BOTH, 1},
  38. {0x06, PANEL_579C_GDEY0579F51_MO_BTST, 4},
  39. {0x61, PANEL_579C_GDEY0579F51_MO_TRES, 4},
  40. {0x50, PANEL_579C_GDEY0579F51_MO_CDI_INIT, 1},
  41. {0xE9, PANEL_579C_GDEY0579F51_MO_E9, 1},
  42. {0xE0, PANEL_579C_GDEY0579F51_MO_E0, 1},
  43. {0xA2, PANEL_579C_GDEY0579F51_MO_SELECT_MASTER, 1},
  44. {0x04, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, // power on
  45. };
  46. // _setPartialRamAreaMaster(0, 0, 396, 272), default partial_mode=true.
  47. inline const uint8_t PANEL_579C_GDEY0579F51_MO_WINDOW[] = {
  48. 0x00, 0x00, // x/256, x%256 = 0
  49. 0x01, 0x8B, // xe/256, xe%256 = 395
  50. 0x00, 0x00, // y/256, y%256 = 0
  51. 0x01, 0x0F, // ye/256, ye%256 = 271
  52. 0x01,
  53. };
  54. inline const EpdCommand PANEL_579C_GDEY0579F51_MO_WINDOW_SEQ[] = {
  55. {0xA2, PANEL_579C_GDEY0579F51_MO_SELECT_MASTER, 1},
  56. {0x83, PANEL_579C_GDEY0579F51_MO_WINDOW, 9},
  57. };
  58. // refresh(false): _setPartialRamAreaBoth(0,0,396,272) (select=Both, same
  59. // region, harmless even though only master was ever written), then
  60. // _refresh(false): 0x50=0x37, 0x12+delay(1)+busywait collapsed into one
  61. // wait_busy_after.
  62. inline const uint8_t PANEL_579C_GDEY0579F51_MO_WINDOW_BOTH[] = {
  63. 0x00, 0x00, 0x01, 0x8B, 0x00, 0x00, 0x01, 0x0F, 0x01,
  64. };
  65. inline const uint8_t PANEL_579C_GDEY0579F51_MO_CDI_REFRESH[] = {0x37};
  66. inline const uint8_t PANEL_579C_GDEY0579F51_MO_REFRESH_TRIGGER[] = {0x00};
  67. inline const EpdCommand PANEL_579C_GDEY0579F51_MO_REFRESH[] = {
  68. {0xA2, PANEL_579C_GDEY0579F51_MO_SELECT_BOTH, 1},
  69. {0x83, PANEL_579C_GDEY0579F51_MO_WINDOW_BOTH, 9},
  70. {0x50, PANEL_579C_GDEY0579F51_MO_CDI_REFRESH, 1},
  71. {0x12, PANEL_579C_GDEY0579F51_MO_REFRESH_TRIGGER, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0,
  72. /*wait_busy_after=*/true},
  73. };
  74. inline const EpdPanelDescriptor PANEL_579C_GDEY0579F51_MASTER_ONLY = {
  75. .width = 396, // WIDTH/2 of the real 792-wide panel - master half only
  76. .height = 272,
  77. .busy_active_level = false, // GxEPD2_EPD(..., /*busy_level=*/LOW, ...)
  78. .busy_timeout_ms = 25000, // full_refresh_time is 21000ms
  79. .init_sequence = PANEL_579C_GDEY0579F51_MO_INIT,
  80. .init_sequence_len = sizeof(PANEL_579C_GDEY0579F51_MO_INIT) / sizeof(PANEL_579C_GDEY0579F51_MO_INIT[0]),
  81. .window_sequence = PANEL_579C_GDEY0579F51_MO_WINDOW_SEQ,
  82. .window_sequence_len =
  83. sizeof(PANEL_579C_GDEY0579F51_MO_WINDOW_SEQ) / sizeof(PANEL_579C_GDEY0579F51_MO_WINDOW_SEQ[0]),
  84. .plane_count = 1,
  85. .plane_write_cmd = {0x10, 0x00},
  86. .plane_invert = {false, false},
  87. .packed_2bpp_plane = true,
  88. .refresh_sequence = PANEL_579C_GDEY0579F51_MO_REFRESH,
  89. .refresh_sequence_len = sizeof(PANEL_579C_GDEY0579F51_MO_REFRESH) / sizeof(PANEL_579C_GDEY0579F51_MO_REFRESH[0]),
  90. };
  91. } // namespace esphome::gxepd2