gxepddisplay: better handling of full refresh (no faint partial afterwards !!!)

This commit is contained in:
Florent
2026-08-16 11:40:13 -04:00
parent 3e82827706
commit 0a595ae79d
+8 -10
View File
@@ -88,7 +88,7 @@ void GxEPDDisplay::turnOff() {
display.fillScreen(GxEPD_WHITE); display.fillScreen(GxEPD_WHITE);
display.display(true); display.display(true);
forceFullRefresh(); forceFullRefresh();
display.powerOff(); display.hibernate();
} }
void GxEPDDisplay::clear() { void GxEPDDisplay::clear() {
@@ -101,11 +101,15 @@ void GxEPDDisplay::startFrame(ColorVal bkg) {
display.fillScreen(bkg); display.fillScreen(bkg);
display.setTextColor(_curr_color = UIColor::primary_txt); display.setTextColor(_curr_color = UIColor::primary_txt);
display_crc.reset(); display_crc.reset();
if (_cycles_before_full_refresh <= 0) { if (_cycles_before_full_refresh != 0) {
display.setPartialWindow(0, 0, display.width(), display.height()); display.setPartialWindow(0, 0, display.width(), display.height());
} else { } else {
display.setFullWindow(); // forces a full wipe of the screen ...
display.writeScreenBuffer(); display.clearScreen(0xFF); // Clears microcontroller side RAM
display.writeScreenBuffer(0xFF); // Forces 0xFF (White) into the display controller's history registers
// we'll need a partial refresh after that (whatever crc value is)
last_display_crc_value = 0;
resetPartialRefreshCounter();
} }
} }
@@ -211,16 +215,10 @@ void GxEPDDisplay::endFrame() {
if (_isOn == false) return; if (_isOn == false) return;
uint32_t crc = display_crc.finalize(); uint32_t crc = display_crc.finalize();
if (crc != last_display_crc_value) { if (crc != last_display_crc_value) {
if (_cycles_before_full_refresh == 0) {
display.display(false);
display.writeScreenBuffer();
resetPartialRefreshCounter();
} else {
display.display(true); display.display(true);
if (_cycles_before_full_refresh > 0) { if (_cycles_before_full_refresh > 0) {
_cycles_before_full_refresh--; _cycles_before_full_refresh--;
} }
} }
last_display_crc_value = crc; last_display_crc_value = crc;
}
} }