Add QR-code WiFi onboarding screen

Vendors two small MIT/BSD-3-Clause libraries rather than hand-rolling
either: Nayuki's qrcodegen (QR matrix generation) and Waveshare's Font24
bitmap table from their e-Paper repo (same repo the epd7in3e driver came
from) for rendering readable text on the panel.

qr_onboarding_show() builds a standard WIFI:T:WPA;S:...;P:...;; payload,
rasterizes the QR module matrix plus the SSID and password as plaintext
underneath (for anyone provisioning from a device that can't scan a QR)
onto a malloc'd frame buffer, and pushes it to the panel via
epd_display_buffer(). The buffer is heap-allocated on demand rather than
statically reserved, since 192KB held permanently in BSS would eat into
the RAM budget the HTTP fetch path (task 6) is specifically trying to keep
free.

Wired into wifi_provisioning_start() before the softAP comes up, so the
join instructions are already on-screen by the time the network is
joinable.
This commit is contained in:
2026-07-18 11:20:43 -04:00
parent 9c855ede47
commit 1dd02da70a
12 changed files with 4197 additions and 7 deletions
+8 -5
View File
@@ -20,6 +20,7 @@
#include "freertos/task.h"
#include "epd7in3e.h"
#include "qr_onboarding.h"
#include "wifi_provisioning.h"
#define NVS_NAMESPACE "frame_cfg"
@@ -373,13 +374,15 @@ void wifi_provisioning_start(void)
ESP_LOGI(TAG, "Provisioning AP: SSID='%s' password='%s'", ap_ssid, ap_password);
/* Bring up the display before the AP so join instructions are on-screen
* by the time the network is joinable.
* TODO(step 5): replace this clear with the WiFi-join QR code +
* plaintext 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. */
esp_err_t epd_err = epd_init();
if (epd_err == ESP_OK) {
epd_clear(EPD_COLOR_WHITE);
esp_err_t qr_err = qr_onboarding_show(ap_ssid, ap_password);
if (qr_err != ESP_OK) {
ESP_LOGW(TAG, "QR onboarding render failed (%s)", esp_err_to_name(qr_err));
}
} else {
ESP_LOGW(TAG, "EPD init failed (%s), continuing without display", esp_err_to_name(epd_err));
}