fix: suppress all e-ink refreshes during boot with setAutoDisplay(false)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-03 11:31:36 -04:00
parent 26e30620c4
commit 127205de2e
2 changed files with 16 additions and 3 deletions

View File

@@ -16,6 +16,9 @@ void DisplayManager::begin(PowerManager& power) {
_power = &power;
_display = &M5.Display;
// Ensure no automatic e-ink refreshes happen
_display->setAutoDisplay(false);
// Set rotation for landscape (device physically rotated)
_display->setRotation(3);
@@ -26,10 +29,11 @@ void DisplayManager::begin(PowerManager& power) {
void DisplayManager::showSetupScreen() {
_power->enableEPDPower();
// Batch all drawing — nothing hits the panel until display() at the end
_display->startWrite();
_display->fillScreen(TFT_WHITE);
// Generate QR code for WiFi auto-connect
// Format: WIFI:T:nopass;S:PaperColor-Setup;;
const char* qrData = "WIFI:T:nopass;S:PaperColor-Setup;;";
QRCode qrcode;
uint8_t qrcodeData[qrcode_getBufferSize(6)];
@@ -37,7 +41,7 @@ void DisplayManager::showSetupScreen() {
// Draw QR code centered vertically, left-of-center horizontally
int qrSize = qrcode.size;
int scale = 4; // pixels per QR module
int scale = 4;
int qrPixels = qrSize * scale;
int qrX = (DISPLAY_WIDTH / 3) - (qrPixels / 2);
int qrY = (DISPLAY_HEIGHT - qrPixels) / 2;
@@ -49,7 +53,7 @@ void DisplayManager::showSetupScreen() {
}
}
// Draw text instructions to the right of QR code
// Text instructions to the right of QR code
int textX = DISPLAY_WIDTH / 2 + 40;
_display->setTextColor(TFT_BLACK);
_display->setTextDatum(middle_left);
@@ -64,6 +68,9 @@ void DisplayManager::showSetupScreen() {
_display->drawString("Then open:", textX, DISPLAY_HEIGHT / 2 + 70);
_display->drawString("192.168.4.1", textX, DISPLAY_HEIGHT / 2 + 95);
_display->endWrite();
// Single e-ink refresh — the only panel update during boot
triggerRefresh();
_power->disableEPDPower();
}
@@ -100,6 +107,7 @@ void DisplayManager::showImage(const ProcessedImage& img) {
void DisplayManager::showMessage(const char* title, const char* body) {
_power->enableEPDPower();
_display->startWrite();
_display->fillScreen(TFT_WHITE);
_display->setTextColor(TFT_BLACK);
_display->setTextDatum(middle_center);
@@ -107,6 +115,7 @@ void DisplayManager::showMessage(const char* title, const char* body) {
_display->drawString(title, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2 - 30);
_display->setTextSize(1);
_display->drawString(body, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2 + 20);
_display->endWrite();
triggerRefresh();
_power->disableEPDPower();

View File

@@ -173,8 +173,12 @@ void webActionCallback(const String& action) {
void setup() {
auto cfg = M5.config();
cfg.clear_display = false; // Don't clear/refresh e-ink on init
M5.begin(cfg);
// Prevent any automatic e-ink refreshes until we explicitly call display()
M5.Display.setAutoDisplay(false);
Serial.begin(115200);
Serial.println("[main] Immich Frame v1.0 booting...");