Просмотр исходного кода

Fix swapped master/slave PSR bytes against Waveshare's own reference

GxEPD2's driver has master(0x01)->PSR{0x07,0x29}, slave(0x02)->{0x03,0x29}.
Waveshare's own epd5in79g.cpp (extracted from their official demo archive
for this exact module) has them swapped: master->{0x03,0x29},
slave->{0x07,0x29}. The two values differ only in the SHL bit (source/
column scan-shift direction per the HX8717 command table) - GxEPD2
appears to have this backwards for this specific panel, consistent with
the left-right-mirrored text seen on real hardware. Followed Waveshare's
reference, not GxEPD2's, since it's the panel manufacturer's own code for
this exact module and GxEPD2's driver has never been hardware-verified by
us (unlike GDEY0579T93/SSD1683, corroborated independently two ways).
ZiB 1 месяц назад
Родитель
Сommit
064b381825

+ 12 - 2
components/gxepd2/panel_579c_gdey0579f51.h

@@ -20,6 +20,16 @@
 // is region 0 here (window_sequence[0], written first, right after init
 // leaves the controller select=master already) and slave is region 1.
 //
+// PSR values corrected (2026-09-19) against Waveshare's own epd5in79g.cpp
+// reference driver (extracted from their official demo archive for this
+// exact module) - GxEPD2's driver has master(0x01)->{0x07,0x29},
+// slave(0x02)->{0x03,0x29}; Waveshare's has them swapped:
+// master(0x01)->{0x03,0x29}, slave(0x02)->{0x07,0x29}. The two PSR values
+// differ only in the SHL bit (source/column scan-shift direction per the
+// HX8717 command table) - GxEPD2 apparently has this backwards for this
+// panel, which lines up with the left-right-mirrored text seen on
+// hardware. Followed Waveshare's reference here, not GxEPD2's.
+//
 // The master-only descriptor's single-region run showed real, correctly-
 // decoded content but compressed/duplicated within half the driven
 // region's own width, plus noise/black bands on the untouched slave half.
@@ -38,8 +48,8 @@ namespace esphome::gxepd2 {
 inline const uint8_t PANEL_579C_GDEY0579F51_SELECT_MASTER[] = {0x01};
 inline const uint8_t PANEL_579C_GDEY0579F51_SELECT_SLAVE[] = {0x02};
 inline const uint8_t PANEL_579C_GDEY0579F51_SELECT_BOTH[] = {0x00};
-inline const uint8_t PANEL_579C_GDEY0579F51_PSR_MASTER[] = {0x07, 0x29};
-inline const uint8_t PANEL_579C_GDEY0579F51_PSR_SLAVE[] = {0x03, 0x29};
+inline const uint8_t PANEL_579C_GDEY0579F51_PSR_MASTER[] = {0x03, 0x29};
+inline const uint8_t PANEL_579C_GDEY0579F51_PSR_SLAVE[] = {0x07, 0x29};
 inline const uint8_t PANEL_579C_GDEY0579F51_BTST[] = {0x32, 0x32, 0x32, 0x32};
 inline const uint8_t PANEL_579C_GDEY0579F51_TRES[] = {0x01, 0x8C, 0x01, 0x10};  // 396x272 - one region's resolution
 inline const uint8_t PANEL_579C_GDEY0579F51_CDI_INIT[] = {0x97};

+ 4 - 1
components/gxepd2/panel_579c_gdey0579f51_master_only.h

@@ -49,7 +49,10 @@ namespace esphome::gxepd2 {
 
 inline const uint8_t PANEL_579C_GDEY0579F51_MO_SELECT_MASTER[] = {0x01};
 inline const uint8_t PANEL_579C_GDEY0579F51_MO_SELECT_BOTH[] = {0x00};
-inline const uint8_t PANEL_579C_GDEY0579F51_MO_PSR_MASTER[] = {0x07, 0x29};
+// 0x03, not 0x07 - see panel_579c_gdey0579f51.h's header comment: this
+// value's SHL bit was backwards relative to Waveshare's own reference
+// driver for this panel (2026-09-19).
+inline const uint8_t PANEL_579C_GDEY0579F51_MO_PSR_MASTER[] = {0x03, 0x29};
 inline const uint8_t PANEL_579C_GDEY0579F51_MO_BTST[] = {0x32, 0x32, 0x32, 0x32};
 inline const uint8_t PANEL_579C_GDEY0579F51_MO_TRES[] = {0x01, 0x8C, 0x01, 0x10};  // 396x272
 inline const uint8_t PANEL_579C_GDEY0579F51_MO_CDI_INIT[] = {0x97};