d8cbf35572
Three follow-ups after the reading game landed. - WiFi: a "Réglages" home tile (gear) opens LISAEL_MODE_WIFI which forces the SoftAP + captive portal up on demand (lisael_ui_goto starts them; the screen's "Fermer" button tears them down), so the provisioning portal can be tested/used without waiting for the station to fail. - Lire: the content generator now also takes words that have no emoji (optional img in the regex) -> 366 words instead of 286 (the extra ~80 are abstract words: text + spoken audio, no picture). - Cleanup: removed 21 baked word icons that became dead weight once the reading game started loading its pictures from the SD (~315 KB flash), plus their declarations and gen_icons.py specs.
67 lines
2.8 KiB
C
67 lines
2.8 KiB
C
// LVGL UI shell + mode router for Lisael Box.
|
|
//
|
|
// The UI runs entirely on the LVGL task created by the esp-box BSP
|
|
// (bsp_display_start / esp_lvgl_port). ALL LVGL calls from other tasks (e.g.
|
|
// the weather task pushing an update) MUST be wrapped in
|
|
// bsp_display_lock()/bsp_display_unlock(). Helpers here assume they are called
|
|
// while holding that lock unless noted otherwise.
|
|
#pragma once
|
|
|
|
#include "lvgl.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// The available screens / modes.
|
|
typedef enum {
|
|
LISAEL_MODE_HOME = 0, // accueil: date FR + meteo + capteurs + tuiles
|
|
LISAEL_MODE_RADIO, // webradios enfants
|
|
LISAEL_MODE_CALM, // coin calme / respiration
|
|
LISAEL_MODE_CLOCK, // horloge / veilleuse
|
|
LISAEL_MODE_GAMES, // jeux (memory, compter)
|
|
LISAEL_MODE_HISTOIRES, // podcasts Radio France jeunesse (Oli, Bestioles)
|
|
LISAEL_MODE_LIRE, // jeu apprendre à lire (mot <-> image + voix)
|
|
LISAEL_MODE_WIFI, // réglages WiFi (force le SoftAP + portail captif)
|
|
LISAEL_MODE_COUNT,
|
|
} lisael_mode_t;
|
|
|
|
// Build the UI (call once, while holding the display lock). Loads HOME.
|
|
void lisael_ui_init(void);
|
|
|
|
// Switch to a mode. Each mode lazily (re-)builds its screen and is loaded with
|
|
// a gentle slide animation. Safe to call from LVGL callbacks.
|
|
void lisael_ui_goto(lisael_mode_t mode);
|
|
|
|
// Convenience used by every mode screen to add a top-left "← Accueil" button
|
|
// (big, icon-only) that returns HOME. Returns the button object.
|
|
lv_obj_t *lisael_ui_add_back_button(lv_obj_t *parent);
|
|
|
|
// Shared style accessors (lazily initialised). Big rounded buttons, soft
|
|
// pastel palette suited to a young child.
|
|
const lv_style_t *lisael_ui_style_tile(void); // home menu tiles
|
|
const lv_style_t *lisael_ui_style_button(void); // generic big buttons
|
|
|
|
// --- Each mode exposes a builder that returns its root screen object. --------
|
|
// (Implemented in modes/*.c.)
|
|
lv_obj_t *lisael_screen_home(void);
|
|
lv_obj_t *lisael_screen_radio(void);
|
|
lv_obj_t *lisael_screen_calm(void);
|
|
lv_obj_t *lisael_screen_clock(void);
|
|
lv_obj_t *lisael_screen_games(void);
|
|
lv_obj_t *lisael_screen_balloons(void); // "Calme ta colère" anger game
|
|
lv_obj_t *lisael_screen_histoires(void); // "Histoires" — vignette podcasts
|
|
lv_obj_t *lisael_screen_wifi_setup(void); // SoftAP provisioning info screen
|
|
lv_obj_t *lisael_screen_lire(void); // "Lire" learn-to-read game
|
|
lv_obj_t *lisael_screen_wifi(void); // on-demand WiFi settings (force AP)
|
|
|
|
// Home screen live-update hooks (called from background tasks; they take the
|
|
// display lock internally — do NOT hold it when calling these).
|
|
void lisael_home_update_clock(void); // refresh date/time labels
|
|
void lisael_home_update_weather(void); // pull latest weather snapshot
|
|
void lisael_home_update_sensors(void); // pull latest sensor readings
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|