From e7f0a11ad333f00e9a64c08200a27a86cf32577e Mon Sep 17 00:00:00 2001 From: Matt Edholm Date: Fri, 8 May 2026 19:11:02 -0400 Subject: [PATCH] fix(provisioning): drop the 2-minute QR display delay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 15s FIRST_IMAGE_POLL_INTERVAL_MS bootstrap already keeps the QR on the panel (204 responses don't trigger a redraw) until the user claims via /setup/{mac} and the server's bootstrap-bypass serves an image. The hard-coded delay(120000) was just dead time between WiFi save and the first poll — observed in the field as ~110s of nothing happening after login. Also touches operation.h header comments to match the "hold until the screen flashes" terminology and document the short-press fast-poll gesture. --- src/main.cpp | 6 ++++-- src/operation.h | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d5ec7cf..3dba3ee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -261,8 +261,10 @@ void loop() { g_provisioning = false; - // Give user time to scan the QR, then start normal operation - delay(120000); // 2 minutes + // Go straight into the polling loop. The 15s FIRST_IMAGE_POLL_INTERVAL_MS + // bootstrap keeps the QR painted (204s don't redraw the panel) until + // the user claims via /setup/{mac} and the server's bootstrap-bypass + // serves an image — no need for an artificial display delay here. normal_operation(mac); } else { // Connection failed — fill red, restart AP diff --git a/src/operation.h b/src/operation.h index 7bafc61..81bc584 100644 --- a/src/operation.h +++ b/src/operation.h @@ -316,13 +316,16 @@ void normal_operation_impl(const String& mac, HTTP& http, const String& url, Pre } esp_sleep_enable_timer_wakeup(sleepMs * 1000ULL); - // Wake on the BOOT button so the user-facing 5-second-hold reset works - // even during deep sleep. Without this, the button only does anything - // during the brief poll-and-paint window when the device is awake, and - // a full sleep cycle (default minutes) of holding does nothing. + // Wake on the BOOT button so the user-facing "hold until the screen + // starts to flash" reset works even during deep sleep. Without this, + // the button only did anything during the brief awake window during + // a poll, and a full sleep cycle of holding did nothing. // Pin is GPIO 0 (PIN_BTN_RESET); active-low because BOOT is pulled-up // and shorts to ground on press. After EXT0 wakes the chip, setup() // runs and check_reset_button() handles the remainder of the hold. + // A too-short press wakes the device but check_reset_button returns + // false → normal_operation_impl runs → the next poll fetches a fresh + // image, which doubles as a "force refresh" gesture. esp_sleep_enable_ext0_wakeup((gpio_num_t)PIN_BTN_RESET, 0); esp_deep_sleep_start(); }