New panel design
This commit is contained in:
1 parent
face2432e4
commit
b5d6b4a897
30 files changed
+4540
-171
No files matched your search
+31
-3
@@ -3,19 +3,47 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ha_data.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
/*
|
||||
* The screen layout.
|
||||
*
|
||||
* This file is compiled into the desktop simulator as well as the firmware
|
||||
* (see sim/README.md), so it must never touch a driver, a socket or ESP-IDF
|
||||
* directly. Data arrives as ha_data_t; commands leave through the callback
|
||||
* below. Everything in between is drawing.
|
||||
*/
|
||||
|
||||
void ui_init(void);
|
||||
|
||||
/* Safe to call from any task -- these take the LVGL lock internally. */
|
||||
void ui_update_weather(int16_t temp_f, const char *condition);
|
||||
|
||||
/* Redraw every panel from `data`. Cheap to call when nothing changed: every
|
||||
* label goes through a comparison first, so an unchanged value costs no
|
||||
* invalidation and therefore no flush. */
|
||||
void ui_update(const ha_data_t *data);
|
||||
|
||||
void ui_set_status(const char *status);
|
||||
|
||||
/*
|
||||
* Mark the displayed reading as no longer trustworthy. Dims the temperature
|
||||
* Mark the displayed readings as no longer trustworthy. Dims the temperature
|
||||
* so a value that stopped updating is visibly distinct from a live one,
|
||||
* rather than sitting there at full styling looking current.
|
||||
*/
|
||||
void ui_set_weather_stale(bool stale);
|
||||
void ui_set_stale(bool stale);
|
||||
|
||||
/*
|
||||
* Called when the user operates a light tile.
|
||||
*
|
||||
* `index` indexes HA_LIGHTS. `brightness` is 0-255, or -1 for a plain on/off
|
||||
* with no brightness change (a tile tap, or any switch-domain entity).
|
||||
*
|
||||
* Runs on the LVGL task with the LVGL lock held, so the implementation must
|
||||
* not block: hand the command to another task rather than doing HTTP here.
|
||||
*/
|
||||
typedef void (*ui_light_cmd_cb_t)(int index, bool on, int16_t brightness);
|
||||
void ui_set_light_cb(ui_light_cmd_cb_t cb);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user