24 lines
932 B
C
24 lines
932 B
C
#pragma once
|
|
#include <lvgl.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
typedef struct {
|
|
uint8_t brightness; /* 20..100 percent */
|
|
uint16_t dim_after_s; /* 0, 30, 60, 120 */
|
|
} ui_display_config_t;
|
|
typedef struct {
|
|
bool wifi_connected, influx_ok, mdns_ok;
|
|
char ip[16];
|
|
uint64_t last_influx_success_ms; /* zero until first successful HTTP 204 */
|
|
} ui_device_status_t;
|
|
typedef void (*ui_brightness_cb_t)(uint8_t percent);
|
|
typedef void (*ui_save_config_cb_t)(const ui_display_config_t *config);
|
|
|
|
/* All calls run on the LVGL task or while its lock is held. */
|
|
void ui_dashboard_init(ui_display_config_t config, ui_brightness_cb_t brightness,
|
|
ui_save_config_cb_t save);
|
|
void ui_dashboard_tick(uint64_t now_ms, const ui_device_status_t *status);
|
|
/* Wrap the touch read callback, so the wake-up touch cannot activate controls. */
|
|
void ui_dashboard_filter_touch(lv_indev_data_t *data);
|