fix: single boot refresh with QR code, async WiFi scan, skip light sleep in AP mode

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-03 11:25:41 -04:00
parent 37670e56a2
commit 90eed9d5ff
6 changed files with 88 additions and 10 deletions

View File

@@ -21,8 +21,51 @@ void DisplayManager::begin(PowerManager& power) {
Serial.printf("[display] Initialized: %dx%d, rotation=%d\n",
_display->width(), _display->height(), _display->getRotation());
}
showMessage("Immich Frame", "Starting up...");
void DisplayManager::showSetupScreen() {
_power->enableEPDPower();
_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)];
qrcode_initText(&qrcode, qrcodeData, 6, ECC_LOW, qrData);
// Draw QR code centered vertically, left-of-center horizontally
int qrSize = qrcode.size;
int scale = 4; // pixels per QR module
int qrPixels = qrSize * scale;
int qrX = (DISPLAY_WIDTH / 3) - (qrPixels / 2);
int qrY = (DISPLAY_HEIGHT - qrPixels) / 2;
for (int y = 0; y < qrSize; y++) {
for (int x = 0; x < qrSize; x++) {
uint16_t color = qrcode_getModule(&qrcode, x, y) ? TFT_BLACK : TFT_WHITE;
_display->fillRect(qrX + x * scale, qrY + y * scale, scale, scale, color);
}
}
// Draw text instructions to the right of QR code
int textX = DISPLAY_WIDTH / 2 + 40;
_display->setTextColor(TFT_BLACK);
_display->setTextDatum(middle_left);
_display->setTextSize(2);
_display->drawString("PaperColor", textX, DISPLAY_HEIGHT / 2 - 60);
_display->setTextSize(1);
_display->drawString("Scan QR to connect", textX, DISPLAY_HEIGHT / 2 - 20);
_display->drawString("or join WiFi:", textX, DISPLAY_HEIGHT / 2 + 10);
_display->setTextSize(1.5);
_display->drawString("PaperColor-Setup", textX, DISPLAY_HEIGHT / 2 + 40);
_display->setTextSize(1);
_display->drawString("Then open:", textX, DISPLAY_HEIGHT / 2 + 70);
_display->drawString("192.168.4.1", textX, DISPLAY_HEIGHT / 2 + 95);
triggerRefresh();
_power->disableEPDPower();
}
void DisplayManager::showImage(const ProcessedImage& img) {