panel_583_gdeq0583t31.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #pragma once
  2. // Hand-derived from vendor/src/gdeq/GxEPD2_583_GDEQ0583T31.{h,cpp}
  3. // (GDEQ0583T31, UC8179 controller, 648x480, monochrome).
  4. //
  5. // Structurally the oddest of the panels covered so far: UC8179 has no
  6. // SSD1680/1677-style 0x44/0x45/0x4E/0x4F window registers at all - a single
  7. // 0x90 command carries the whole region, bracketed by 0x91 "partial in" /
  8. // 0x92 "partial out" markers that live *around* the plane write, not just
  9. // before it. 0x91+0x90 fits this engine's existing window_sequence slot
  10. // fine; 0x92 has nowhere else to go but the front of refresh_sequence,
  11. // since it must fire after the plane byte burst and before the refresh
  12. // trigger, and those are the only two sequence slots this engine has.
  13. //
  14. // Also the only panel here where _InitDisplay() (0x00 panel setting + 0x50
  15. // VCOM/data-interval) genuinely runs twice in one real update cycle even
  16. // with GxEPD2's own priming dropped: the vendor driver's _using_partial_mode
  17. // flag flips between _Init_Part() (before the write, TSSET=0x6E) and
  18. // _Init_Full() (before the refresh trigger, TSSET=0x5A) on *every* call, not
  19. // just the first - confirmed by reading refresh()/writeImage() themselves,
  20. // not just the traced first call. This engine has no persistent
  21. // _using_partial_mode to skip either pass, and resets the panel via a real
  22. // hardware reset pulse every cycle anyway (see CycleEngine's
  23. // request_full_update()), so re-running both init variants every time
  24. // matches the vendor driver's own behavior under that same "always reset,
  25. // never assume prior state" model, not a shortcut around it.
  26. #include "epd_command.h"
  27. namespace esphome::gxepd2 {
  28. inline const uint8_t PANEL_583_GDEQ0583T31_PANEL_SETTING[] = {0x1F};
  29. inline const uint8_t PANEL_583_GDEQ0583T31_VCOM_DATA_INTERVAL[] = {0x29, 0x07};
  30. inline const uint8_t PANEL_583_GDEQ0583T31_CASCADE_SETTING[] = {0x02};
  31. inline const uint8_t PANEL_583_GDEQ0583T31_TEMP_PARTIAL[] = {0x6E}; // TSSET, _Init_Part's value (110)
  32. inline const EpdCommand PANEL_583_GDEQ0583T31_INIT[] = {
  33. // _Init_Part(): _InitDisplay() + cascade/temp-force + _PowerOn().
  34. {0x00, PANEL_583_GDEQ0583T31_PANEL_SETTING, 1},
  35. {0x50, PANEL_583_GDEQ0583T31_VCOM_DATA_INTERVAL, 2},
  36. {0xE0, PANEL_583_GDEQ0583T31_CASCADE_SETTING, 1},
  37. {0xE5, PANEL_583_GDEQ0583T31_TEMP_PARTIAL, 1},
  38. {0x04, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, // power on
  39. };
  40. // _setPartialRamArea(0, 0, 648, 480): xe = (0+648-1)|0x0007 = 655 (byte-
  41. // boundary inclusive), ye = 479; x masked to byte boundary is 0 either way.
  42. inline const uint8_t PANEL_583_GDEQ0583T31_WINDOW_REGION[] = {
  43. 0x00, 0x00, // x/256, x%256 = 0, 0
  44. 0x02, 0x8F, // xe/256, xe%256 = 655
  45. 0x00, 0x00, // y/256, y%256 = 0, 0
  46. 0x01, 0xDF, // ye/256, ye%256 = 479
  47. 0x01,
  48. };
  49. inline const EpdCommand PANEL_583_GDEQ0583T31_WINDOW[] = {
  50. {0x91, nullptr, 0}, // partial in
  51. {0x90, PANEL_583_GDEQ0583T31_WINDOW_REGION, 9},
  52. };
  53. // _Init_Full() + _Update_Full(): cascade/temp-force (full-context value)
  54. // re-run before the trigger, matching what the vendor driver actually does
  55. // on every call (see file header comment) - then 0x92 "partial out" closes
  56. // the window this engine's window_sequence opened, since it has to fire
  57. // after the plane write and there's no other slot for it.
  58. inline const uint8_t PANEL_583_GDEQ0583T31_TEMP_FULL[] = {0x5A}; // TSSET, _Init_Full's value (90)
  59. inline const EpdCommand PANEL_583_GDEQ0583T31_REFRESH[] = {
  60. {0x92, nullptr, 0}, // partial out
  61. {0x00, PANEL_583_GDEQ0583T31_PANEL_SETTING, 1},
  62. {0x50, PANEL_583_GDEQ0583T31_VCOM_DATA_INTERVAL, 2},
  63. {0xE0, PANEL_583_GDEQ0583T31_CASCADE_SETTING, 1},
  64. {0xE5, PANEL_583_GDEQ0583T31_TEMP_FULL, 1},
  65. {0x12, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, // display refresh
  66. };
  67. inline const EpdPanelDescriptor PANEL_583_GDEQ0583T31 = {
  68. .width = 648,
  69. .height = 480,
  70. .busy_active_level = false, // GxEPD2_EPD(..., /*busy_level=*/LOW, ...) - inverted vs. the SSD1677/1680 panels
  71. .busy_timeout_ms = 20000, // full_refresh_time is 1200ms; generous ceiling, matches PANEL_213_Z98C's style
  72. .init_sequence = PANEL_583_GDEQ0583T31_INIT,
  73. .init_sequence_len = sizeof(PANEL_583_GDEQ0583T31_INIT) / sizeof(PANEL_583_GDEQ0583T31_INIT[0]),
  74. .window_sequence = PANEL_583_GDEQ0583T31_WINDOW,
  75. .window_sequence_len = sizeof(PANEL_583_GDEQ0583T31_WINDOW) / sizeof(PANEL_583_GDEQ0583T31_WINDOW[0]),
  76. .plane_count = 1,
  77. .plane_write_cmd = {0x13, 0x00},
  78. .plane_invert = {false, false},
  79. .refresh_sequence = PANEL_583_GDEQ0583T31_REFRESH,
  80. .refresh_sequence_len = sizeof(PANEL_583_GDEQ0583T31_REFRESH) / sizeof(PANEL_583_GDEQ0583T31_REFRESH[0]),
  81. };
  82. } // namespace esphome::gxepd2