Files
t-embed-insecam-widget/main/ui.h
T
Juli d92a2e53cc On-device menu, persistent settings and 12 favourite slots
Hold the knob to open a six-row menu: save/remove the playing camera as
a favourite (12 NVS slots), play or forget favourites, choose the
source (random insecam or favourites), time per camera, listing,
screen and ring brightness, caption, and reboot into Wi-Fi setup.
Settings live in NVS and override the Kconfig first-boot defaults.
Camera URLs are stored with their COUNTER placeholder so favourites get
a fresh cache-buster on every visit.
2026-09-17 00:57:02 +02:00

37 lines
1.4 KiB
C

#pragma once
#include <stdbool.h>
#include <stdint.h>
// All calls take the LVGL lock themselves; safe from any task.
void ui_init(void);
// Full-screen text page (boot, Wi-Fi setup, fatal errors).
void ui_status(const char *title, const char *msg);
// Switch to the camera page.
void ui_show_camera_page(void);
// Hand a freshly decoded 320x170 RGB565 frame to the canvas. The buffer stays
// owned by the caller and must not be written until the next swap.
void ui_present_frame(uint16_t *rgb565);
void ui_set_caption(const char *place, const char *meta);
// Badge in the top-right corner: "LIVE", "PAUSED", "..." — NULL hides it.
void ui_set_badge(const char *text, uint32_t rgb);
// 0..1000 countdown bar; <0 hides the bar.
void ui_set_progress(int permille);
void ui_toast(const char *msg, uint32_t ms);
void ui_set_overlay_visible(bool visible);
bool ui_overlay_visible(void);
// Small marker in the top-left corner of the camera page ("FAV 3"); NULL hides it.
void ui_set_marker(const char *text);
// --- menu page ---
#define UI_MENU_ROWS 6
typedef struct {
const char *label;
const char *value; // right-aligned; may be NULL
bool dim; // informational row, drawn greyed
} ui_menu_row_t;
// Draws rows[top .. top+UI_MENU_ROWS) with `selected` highlighted; `editing` recolours the value.
void ui_menu_show(const char *title, const ui_menu_row_t *rows, int count, int top, int selected, bool editing);
void ui_menu_hide(void);