Add third button: "scan to manage" QR overlay on the current photo
Pressing the manage button (GPIO1) overlays a small QR code -- "SCAN TO MANAGE" -- in the top-right corner of whatever photo is currently on screen, linking to the server's config page, then reverts to the plain photo after 30 seconds. The overlay is spliced into the existing streaming fetch as chunks pass through (frame_client.c's http_read_fn), rather than buffering the full 192,000-byte frame in RAM: only the small overlay rectangle itself (~30KB) is ever held in memory, generated via new stride-parameterized drawing helpers (epd_draw_*_ex in epd_draw.c) that let the existing QR/text drawing code target an arbitrarily-sized buffer instead of a full-frame one. epd7in3e.c is untouched -- it has no idea an overlay exists.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
typedef struct {
|
||||
uint8_t *buf; /* malloc'd (w/2)*h bytes, packed 2px/byte; caller must free */
|
||||
int x0, y0; /* top-left corner, panel pixel coordinates (x0 is always even) */
|
||||
int w, h; /* pixel dimensions (w is always even) */
|
||||
} manage_qr_overlay_t;
|
||||
|
||||
/**
|
||||
* Renders a small "scan to manage" overlay -- a QR code encoding
|
||||
* management_url plus a "SCAN TO" / "MANAGE" caption, on a white
|
||||
* padded background -- into a freshly allocated buffer sized just for
|
||||
* the overlay itself (not a full EPD_FRAME_BYTES frame), positioned for
|
||||
* the panel's top-right corner. Caller must call manage_qr_overlay_free().
|
||||
*/
|
||||
esp_err_t manage_qr_overlay_render(const char *management_url, manage_qr_overlay_t *out);
|
||||
|
||||
void manage_qr_overlay_free(manage_qr_overlay_t *overlay);
|
||||
Reference in New Issue
Block a user