Redesign setup screen: title + two-step layout with a config QR

Adds a "2. CONFIGURATION" step alongside WiFi setup: a second QR code
linking straight to the captive portal page (http://<ap-ip>/), for anyone
who's joined the AP but wants a one-scan shortcut to the config form
instead of relying on the captive-portal popup. The AP netif is now
created (but not started) before the display renders, since the AP's IP
is fixed at netif creation and needed for this QR before the network is
actually up.

Pulls the pixel/text drawing primitives (previously private to
qr_onboarding.c) out into epd_draw.c/.h so the upcoming status screen can
reuse them instead of duplicating.
This commit is contained in:
2026-07-18 14:07:56 -04:00
parent 1b9226326a
commit ecc42f23c0
5 changed files with 190 additions and 80 deletions
+16 -5
View File
@@ -374,12 +374,24 @@ void wifi_provisioning_start(void)
ESP_LOGI(TAG, "Provisioning AP: SSID='%s' password='%s'", ap_ssid, ap_password);
/* Bring up the display and show the join QR/password before the AP
* goes up, so the instructions are already on-screen by the time the
* network is joinable. */
/* Create (but don't yet start) the AP netif so its IP is known for the
* config QR before the network is actually joinable -- the default AP
* IP is fixed at netif creation, not at esp_wifi_start(). */
esp_netif_create_default_wifi_ap();
esp_netif_ip_info_t ap_ip_info;
esp_netif_get_ip_info(esp_netif_get_handle_from_ifkey("WIFI_AP_DEF"), &ap_ip_info);
char ap_ip_addr[16];
inet_ntoa_r(ap_ip_info.ip.addr, ap_ip_addr, sizeof(ap_ip_addr));
char config_url[32];
snprintf(config_url, sizeof(config_url), "http://%s/", ap_ip_addr);
/* Bring up the display and show the join QR/password + config QR
* before the AP goes up, so the instructions are already on-screen by
* the time the network is joinable. */
esp_err_t epd_err = epd_init();
if (epd_err == ESP_OK) {
esp_err_t qr_err = qr_onboarding_show(ap_ssid, ap_password);
esp_err_t qr_err = qr_onboarding_show(ap_ssid, ap_password, config_url);
if (qr_err != ESP_OK) {
ESP_LOGW(TAG, "QR onboarding render failed (%s)", esp_err_to_name(qr_err));
}
@@ -387,7 +399,6 @@ void wifi_provisioning_start(void)
ESP_LOGW(TAG, "EPD init failed (%s), continuing without display", esp_err_to_name(epd_err));
}
esp_netif_create_default_wifi_ap();
wifi_init_softap(ap_ssid, ap_password);
#ifdef CONFIG_ESP_ENABLE_DHCP_CAPTIVEPORTAL