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.
42 lines
1.9 KiB
C
42 lines
1.9 KiB
C
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include "epd7in3e.h"
|
|
#include "fonts.h"
|
|
|
|
/** Sets one pixel in a malloc'd EPD_FRAME_BYTES buffer (packed 2px/byte, per epd7in3e.h). */
|
|
void epd_draw_pixel(uint8_t *frame, int x, int y, epd_color_t color);
|
|
|
|
/**
|
|
* Draws text (uppercased) in the given sFONT (see components/epaper_fonts)
|
|
* with its top-left corner at (origin_x, origin_y).
|
|
*/
|
|
void epd_draw_text(uint8_t *frame, const sFONT *font, const char *text, int origin_x, int origin_y);
|
|
|
|
/** Same as epd_draw_text(), but horizontally centered on center_x. */
|
|
void epd_draw_text_centered(uint8_t *frame, const sFONT *font, const char *text, int center_x, int y);
|
|
|
|
/**
|
|
* Same as epd_draw_pixel()/epd_draw_text()/epd_draw_text_centered(), but
|
|
* against an arbitrarily-sized buffer instead of a full EPD_FRAME_BYTES
|
|
* one -- stride is bytes per row (packed 2px/byte, so width/2), width and
|
|
* height are that buffer's pixel dimensions, used for bounds-checking
|
|
* instead of the panel's fixed EPD_WIDTH/EPD_HEIGHT. The non-_ex
|
|
* functions above are thin wrappers around these, passing
|
|
* EPD_BYTES_PER_ROW/EPD_WIDTH/EPD_HEIGHT -- existing callers are
|
|
* unaffected.
|
|
*/
|
|
void epd_draw_pixel_ex(uint8_t *buf, int stride, int width, int height, int x, int y, epd_color_t color);
|
|
void epd_draw_text_ex(uint8_t *buf, int stride, int width, int height, const sFONT *font, const char *text,
|
|
int origin_x, int origin_y);
|
|
void epd_draw_text_centered_ex(uint8_t *buf, int stride, int width, int height, const sFONT *font, const char *text,
|
|
int center_x, int y);
|
|
|
|
/** Draws a line of the given thickness (in pixels) between two points. */
|
|
void epd_draw_line(uint8_t *frame, int x0, int y0, int x1, int y1, int thickness);
|
|
|
|
/** Draws a checkmark (short down-stroke, long up-stroke) inside a size x size box at (x, y). */
|
|
void epd_draw_checkmark(uint8_t *frame, int x, int y, int size);
|