40 Commits

Author SHA1 Message Date
6c48d70284 moved pi components to its own repo 2026-02-17 12:01:19 +09:00
436e55a0c5 alarm image persist for 1 second longer 2026-02-16 23:42:16 +09:00
Mikkeli Matlock
776aee18fc pi gitignore 2026-02-16 23:35:09 +09:00
Mikkeli Matlock
41e0a6b81d ui tweaks 2026-02-16 23:33:42 +09:00
Mikkeli Matlock
e4da3687b4 pi gitignore 2026-02-16 23:33:18 +09:00
Mikkeli Matlock
05cd085b89 untracked alarm config 2026-02-16 23:32:32 +09:00
Mikkeli Matlock
d0d0b4dc39 untracked vscode settings 2026-02-16 22:38:07 +09:00
Mikkeli Matlock
25420d57b3 gitignore 2026-02-16 22:37:38 +09:00
Mikkeli Matlock
18984c29a3 smooth scrolling 2026-02-16 22:28:26 +09:00
Mikkeli Matlock
7555efcba9 Merge 2026-02-16 22:17:23 +09:00
379f8e105b fix? 2026-02-16 22:14:55 +09:00
3b4d61c56d process order fix 2026-02-16 22:00:23 +09:00
5ae0c64ba9 new client connection logic
- esp32 requests for image when ready to receive
- server serves initial image on request
2026-02-16 21:56:28 +09:00
Mikkeli Matlock
7f644652bb minor visual change 2026-02-16 21:31:43 +09:00
5c16e6deb7 pi status server update 2026-02-16 21:08:40 +09:00
Mikkeli Matlock
706c7ac21b merged changes 2026-02-16 20:55:12 +09:00
b33c658885 docker services real 2026-02-16 20:47:44 +09:00
Mikkeli Matlock
2e5ad58978 changed rx/tx to kByte/s 2026-02-16 16:40:28 +09:00
Mikkeli Matlock
8ffe8cdffb fixed charging heuristic threshold 2026-02-16 16:17:26 +09:00
Mikkeli Matlock
b0a5e05e4a changed charging heuristic voltage threshold 2026-02-16 15:34:26 +09:00
Mikkeli Matlock
4e2c714e1f new layout + 200px status images 2026-02-16 14:52:20 +09:00
Mikkeli Matlock
7165f56464 cosmetic: battery related stuff 2026-02-16 14:39:21 +09:00
Mikkeli Matlock
a25e4b2cb3 alarm audio normalisation 2026-02-15 23:12:25 +09:00
Mikkeli Matlock
76bf8c966d docs cleanup and disk usage target change 2026-02-15 23:00:30 +09:00
Mikkeli Matlock
d63322d304 esp32 improvements
- better clock seconds
- better alarm (image before audio, supposedly)
2026-02-15 22:55:53 +09:00
Mikkeli Matlock
0b2f274719 changed alarm time 2026-02-15 22:55:22 +09:00
Mikkeli Matlock
22c32f3538 config format fix and handling fix
multiple alarms supported
2026-02-15 22:46:59 +09:00
Mikkeli Matlock
89c975bf17 new alarm mechanism 2026-02-15 22:44:36 +09:00
Mikkeli Matlock
e5cc124dd3 monochrome threshold 2026-02-15 22:24:29 +09:00
Mikkeli Matlock
a0cec91845 preprocessed images 2026-02-15 22:23:28 +09:00
Mikkeli Matlock
1140de0fd4 removed docs folder: contents lives in respective scopes directly now 2026-02-15 22:14:35 +09:00
Mikkeli Matlock
37bdc8bb1b pi features docs 2026-02-15 22:14:06 +09:00
Mikkeli Matlock
33936650c6 image alarm 2026-02-15 21:46:18 +09:00
Mikkeli Matlock
7eb05ea983 audio_client.cpp fix 2026-02-15 21:36:56 +09:00
Mikkeli Matlock
dca989a01b feature: alarm 2026-02-15 21:11:33 +09:00
Mikkeli Matlock
12dbbd8942 custom fonts and further UI reworks 2026-02-15 18:13:53 +09:00
9ca0227214 pi server realised 2026-02-15 12:57:05 +09:00
Mikkeli Matlock
89f75c23ef added README and WS client watchdog 2026-02-15 12:35:25 +09:00
Mikkeli Matlock
747b22df28 hardcoded pi address 2026-02-15 04:21:32 +09:00
Mikkeli Matlock
86583f8410 hardcoded pi address 2026-02-15 04:21:25 +09:00
31 changed files with 7985 additions and 416 deletions

View File

@@ -1,8 +0,0 @@
{
"outputStyle": "iseri",
"permissions": {
"allow": [
"Bash(echo:*)"
]
}
}

6
.gitignore vendored
View File

@@ -3,3 +3,9 @@ managed_components/
sdkconfig sdkconfig
sdkconfig.old sdkconfig.old
dependencies.lock dependencies.lock
# vscode local settings
.vscode/
# claude local settings
.claude/

12
.vscode/settings.json vendored
View File

@@ -1,12 +0,0 @@
{
"idf.currentSetup": "J:\\esp\\.espressif\\v5.5.2\\esp-idf",
"idf.flashType": "UART",
"idf.portWin": "COM7",
"idf.openOcdConfigs": [
"interface/ftdi/esp_ftdi.cfg",
"target/esp32s3.cfg"
],
"idf.customExtraVars": {
"IDF_TARGET": "esp32s3"
}
}

211
PLAN.md
View File

@@ -1,211 +0,0 @@
# Pi Dashboard — ESP32-S3 RLCD 4.2" Project Plan
## Goal
WebSocket client on the ESP32-S3 RLCD board that receives system status from a
Raspberry Pi home server over LAN and renders a monitoring dashboard via LVGL.
---
## New project location
Create a new ESP-IDF project directory **outside** the Examples folder, e.g.:
```
J:\dev\arduino\ESP32-S3-RLCD-4.2-main\Projects\pi_dashboard\
```
---
## Files to copy from the factory example
Source root: `Example\ESP-IDF\10_FactoryProgram\`
### Must copy (build skeleton)
| File / Dir | Why |
|---|---|
| `CMakeLists.txt` | Project root cmake — edit project name, strip `EXTRA_COMPONENT_DIRS` if not using ExternLib |
| `partitions.csv` | Partition table (8MB app partition, NVS, PHY) |
| `sdkconfig.defaults` | Base config — **strip BT lines**, keep SPIRAM/flash/LVGL settings |
| `main/CMakeLists.txt` | Main component registration |
| `main/idf_component.yml` | Managed component deps — keep `lvgl/lvgl: ^8.4.0`, drop `avi_player` and `esp_new_jpeg`, **add `espressif/esp_websocket_client`** |
### Must copy (display driver)
| File | From | Why |
|---|---|---|
| `display_bsp.h` | `components/port_bsp/` | DisplayPort class — RLCD SPI driver with LUT pixel mapping |
| `display_bsp.cpp` | `components/port_bsp/` | Full implementation: SPI init, reset, command sequences, SetPixel, Display |
These two files are the entire RLCD hardware abstraction. No other display code
exists. Copy them into a `components/display_bsp/` component in the new project.
### Must copy (LVGL port)
| File | From | Why |
|---|---|---|
| `lvgl_bsp.h` | `components/app_bsp/` | Lvgl_PortInit, Lvgl_lock/unlock declarations |
| `lvgl_bsp.cpp` | `components/app_bsp/` | LVGL display driver registration, double-buffered PSRAM, tick timer, port task on Core 0 |
Copy into a `components/lvgl_port/` component. This file is self-contained — its
only dependency is `lvgl.h` and FreeRTOS.
### Copy as reference (WiFi STA)
| File | From | Why |
|---|---|---|
| `esp_wifi_bsp.h` | `Example/ESP-IDF/02_WIFI_STA/components/esp_wifi_bsp/` | Cleaner than the factory version — no scan-and-destroy, no BLE entanglement |
| `esp_wifi_bsp.c` | same | Simple STA init + connect + reconnect skeleton |
The `02_WIFI_STA` example is a better starting point than the factory program's
wifi code. The factory version tears down WiFi for BLE scanning — useless for a
persistent connection. You will need to modify the STA code to:
- Make SSID/password configurable (NVS or Kconfig)
- Add auto-reconnect on disconnect
- Signal connection readiness via event group so the WebSocket task knows when to start
### Do NOT copy
| Component | Why not |
|---|---|
| `components/port_bsp/` (everything except display_bsp) | I2C bus, buttons, SD card, ADC, codec — none needed for a dashboard |
| `components/ExternLib/` (SensorLib, codec_board) | Sensor drivers and audio codec — irrelevant |
| `components/app_bsp/ble_scan_bsp.c` | BLE scanning — not needed, and conflicts with persistent WiFi |
| `components/app_bsp/esp_wifi_bsp.c` | Factory version destroys WiFi for BLE — use 02_WIFI_STA instead |
| `components/ui_bsp/` | NXP GUI Guider generated UI — you will design your own dashboard layout |
| `components/user_app/` | Factory test logic — all replaced by your WebSocket + dashboard code |
| `managed_components/` | Auto-downloaded by ESP-IDF component manager from `idf_component.yml` — never copy these |
| `build/` | Build artifacts — never copy |
---
## New project structure
```
pi_dashboard/
CMakeLists.txt # from factory, edited
partitions.csv # from factory, as-is
sdkconfig.defaults # from factory, stripped (no BT)
main/
CMakeLists.txt # register main.cpp
idf_component.yml # lvgl ^8.4.0, esp_websocket_client
main.cpp # app_main: wifi init, display init, lvgl init, ws connect, task spawn
components/
display_bsp/
CMakeLists.txt # new: register display_bsp.cpp, REQUIRES driver esp_lcd
display_bsp.h # from port_bsp, as-is
display_bsp.cpp # from port_bsp, as-is
lvgl_port/
CMakeLists.txt # new: register lvgl_bsp.cpp, REQUIRES lvgl__lvgl esp_timer
lvgl_bsp.h # from app_bsp, as-is
lvgl_bsp.cpp # from app_bsp, as-is
wifi_sta/
CMakeLists.txt # new: register wifi_sta.c, REQUIRES esp_wifi esp_event nvs_flash
wifi_sta.h # based on 02_WIFI_STA, extended with reconnect + event group
wifi_sta.c # based on 02_WIFI_STA, extended
ws_client/
CMakeLists.txt # new: register ws_client.cpp, REQUIRES esp_websocket_client
ws_client.h # WebSocket connect/disconnect, message callback registration
ws_client.cpp # esp_websocket_client wrapper, reconnect logic, JSON parse
dashboard_ui/
CMakeLists.txt # new: register dashboard_ui.cpp, REQUIRES lvgl__lvgl
dashboard_ui.h # UI layout: create/update functions for dashboard widgets
dashboard_ui.cpp # LVGL widget creation, label/bar/table updates from parsed data
```
---
## sdkconfig.defaults (modified for this project)
Strip from the factory version:
- `CONFIG_BT_ENABLED=y` and all BT lines (saves ~300KB flash + significant RAM)
- `CONFIG_BT_BLE_*` lines
Keep:
- `CONFIG_IDF_TARGET="esp32s3"`
- `CONFIG_ESPTOOLPY_FLASHMODE_QIO=y`
- `CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y`
- `CONFIG_PARTITION_TABLE_CUSTOM=y`
- `CONFIG_SPIRAM=y` / `CONFIG_SPIRAM_MODE_OCT=y` / `CONFIG_SPIRAM_SPEED_80M=y`
- `CONFIG_FREERTOS_HZ=1000`
- `CONFIG_LV_MEM_SIZE_KILOBYTES=64`
- `CONFIG_LV_DISP_DEF_REFR_PERIOD=1`
Add:
- `CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y`
---
## Runtime architecture
```
Core 0 Core 1
------ ------
WiFi driver (system) main task (app_main, exits after init)
LVGL port task (priority 5) WebSocket event task (priority 3)
- lv_timer_handler loop - receives WS messages
- holds/releases lvgl_mux - parses JSON
- acquires lvgl_mux
- updates dashboard widgets
- releases lvgl_mux
```
### Boot sequence (app_main)
1. `wifi_sta_init()` — start WiFi STA, wait for IP
2. `RlcdPort.RLCD_Init()` — init display over SPI
3. `Lvgl_PortInit(400, 300, flush_cb)` — init LVGL with double-buffered PSRAM
4. Create initial dashboard UI (under LVGL lock)
5. `ws_client_start("ws://<pi_ip>:<port>")` — connect WebSocket, register message handler
6. app_main returns, FreeRTOS tasks take over
### Data flow
```
Pi server --[WebSocket JSON]--> ESP32 ws_client
--> parse message
--> Lvgl_lock()
--> update lv_label / lv_bar / lv_table widgets
--> Lvgl_unlock()
--> LVGL port task flushes on next cycle
--> flush_cb converts 16-bit to 1-bit, pushes to RLCD
```
---
## Pi side (not part of this ESP-IDF project, but for context)
A simple Python WebSocket server that:
- Collects system stats (psutil or /proc reads)
- Serializes to JSON
- Pushes to connected clients every N seconds
Example payload:
```json
{
"cpu_pct": 23,
"mem_pct": 61,
"mem_used_mb": 1952,
"disk_pct": 44,
"cpu_temp": 52,
"uptime_hrs": 342,
"services": [
{"name": "docker", "status": "running"},
{"name": "pihole", "status": "running"},
{"name": "nginx", "status": "stopped"}
],
"net_rx_kbps": 1240,
"net_tx_kbps": 320
}
```
---
## Key decisions still open
1. **WiFi credentials** — hardcode for now, or Kconfig menuconfig, or NVS provisioning?
2. **Dashboard layout** — what stats matter most? Single screen or multiple pages?
3. **Update frequency** — how often should the Pi push? 2s? 5s? On-change?
4. **Pi server location** — fixed IP or mDNS discovery?
5. **Error states** — what to show when WiFi drops or Pi goes offline?

52
README.md Normal file
View File

@@ -0,0 +1,52 @@
# Pi Dashboard
Raspberry Pi system monitor running on a Waveshare ESP32-S3 RLCD 4.2" board. Connects to a Pi over WebSocket, parses JSON stats, and renders a live dashboard on a 400x300 1-bit monochrome reflective LCD using LVGL.
## Hardware
- **Board:** Waveshare ESP32-S3 RLCD 4.2"
- **Display:** 400x300 reflective LCD (1-bit monochrome, no backlight needed)
- **Sensors:** SHTC3 temp/humidity (I2C 0x70), PCF85063 RTC (I2C 0x51)
## Architecture
```
Pi (server) ESP32-S3 (client)
stats_server.py --WS/JSON--> ws_client --> dashboard_ui (LVGL)
+ local sensors (SHTC3)
+ RTC clock (PCF85063)
```
The Pi runs a WebSocket server that pushes system stats (CPU, memory, disk, temperature, network, services) as JSON every 2 seconds. The ESP32 parses the JSON and updates LVGL widgets. A data staleness watchdog forces reconnection if the server goes silent.
The display uses a two-column layout: left half shows Pi stats (CPU/RAM/DISK bars, CPU temp) and a services table; right half shows a large HH:MM:SS clock (montserrat_36), date with day-of-week, and local sensor readings (room temp, humidity). The services table auto-scrolls when services exceed the visible area; row height and visible row count are measured from LVGL at runtime, so the scroll loop adapts automatically to font, padding, or border changes. The clock updates every second from the on-board RTC, which syncs from the Pi's time when drift exceeds 60 seconds.
## Configuration
Edit `components/esp_wifi_bsp/wifi_config.h`:
```c
#define WIFI_SSID "your_ssid"
#define WIFI_PASSWORD "your_password"
#define WS_SERVER_URI "ws://192.168.x.x:8765"
```
## Build and Flash
Requires ESP-IDF v5.5+.
```bash
idf.py build
idf.py flash monitor
```
## Mock Server
Test without a real Pi using the mock server:
```bash
pip install -r pi/requirements.txt
python pi/mock_server.py
```
Sends randomized stats on `ws://0.0.0.0:8765` every 2 seconds.

View File

@@ -0,0 +1,5 @@
idf_component_register(
SRCS "audio_client.cpp"
REQUIRES espressif__esp_websocket_client port_bsp codec_board lvgl__lvgl
PRIV_REQUIRES esp_event json
INCLUDE_DIRS "./")

View File

@@ -0,0 +1,306 @@
#include "audio_client.h"
#include "codec_bsp.h"
#include "esp_websocket_client.h"
#include "esp_log.h"
#include "cJSON.h"
#include <string.h>
#include <freertos/FreeRTOS.h>
#include <freertos/queue.h>
#include <freertos/task.h>
#include <esp_heap_caps.h>
static const char *TAG = "audio_client";
#define AUDIO_CHUNK_SIZE 4096
#define PCM_QUEUE_DEPTH 10
#define PLAYBACK_STACK_SIZE (4 * 1024)
#define PLAYBACK_PRIORITY 4
#define WS_BUFFER_SIZE 8192
/* Status image constants */
#define STATUS_IMG_W 200
#define STATUS_IMG_H 200
#define STATUS_IMG_BYTES (STATUS_IMG_W * STATUS_IMG_H / 8) /* 5000 */
static esp_websocket_client_handle_t s_client = NULL;
static CodecPort *s_codec = NULL;
static QueueHandle_t s_pcm_queue = NULL;
static TaskHandle_t s_playback_task = NULL;
static volatile audio_state_t s_state = AUDIO_IDLE;
static volatile bool s_playing = false;
/* Status image state */
static uint8_t s_img_buf[STATUS_IMG_BYTES];
static lv_img_dsc_t s_img_dsc;
static volatile bool s_img_pending = false; /* expecting binary frame with image data */
static volatile bool s_img_updated = false; /* new image ready for UI consumption */
static volatile bool s_need_request_image = false; /* deferred image request on connect */
static TaskHandle_t s_img_notify_task = NULL; /* task to wake on new image */
/* Forward declarations */
static void playback_task(void *arg);
static void ws_event_handler(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data);
/* ---------- Queue helpers ---------- */
static void flush_queue(void)
{
uint8_t *chunk;
while (xQueueReceive(s_pcm_queue, &chunk, 0) == pdTRUE) {
heap_caps_free(chunk);
}
}
/* ---------- WebSocket event handler ---------- */
static void handle_text_frame(const char *data, int len)
{
cJSON *root = cJSON_ParseWithLength(data, len);
if (!root) {
ESP_LOGW(TAG, "JSON parse failed");
return;
}
cJSON *type = cJSON_GetObjectItem(root, "type");
if (!cJSON_IsString(type)) {
cJSON_Delete(root);
return;
}
if (strcmp(type->valuestring, "status_image") == 0) {
ESP_LOGI(TAG, "Status image header received");
s_img_pending = true;
cJSON_Delete(root);
return;
}
if (strcmp(type->valuestring, "alarm_start") == 0) {
int sr = 24000;
int ch = 2;
int bits = 16;
cJSON *item;
item = cJSON_GetObjectItem(root, "sample_rate");
if (cJSON_IsNumber(item)) sr = item->valueint;
item = cJSON_GetObjectItem(root, "channels");
if (cJSON_IsNumber(item)) ch = item->valueint;
item = cJSON_GetObjectItem(root, "bits");
if (cJSON_IsNumber(item)) bits = item->valueint;
ESP_LOGI(TAG, "Alarm start: %dHz %dch %dbit", sr, ch, bits);
/* Flush any stale data */
flush_queue();
/* Open codec for playback */
s_codec->CodecPort_SetInfo("es8311", 1, sr, ch, bits);
s_codec->CodecPort_SetSpeakerVol(70);
s_playing = true;
s_state = AUDIO_PLAYING;
} else if (strcmp(type->valuestring, "alarm_stop") == 0) {
ESP_LOGI(TAG, "Alarm stop");
s_playing = false;
/* Let playback task drain remaining chunks, then close */
vTaskDelay(pdMS_TO_TICKS(100));
flush_queue();
s_codec->CodecPort_CloseSpeaker();
s_state = AUDIO_CONNECTED;
}
cJSON_Delete(root);
}
static void handle_binary_frame(const uint8_t *data, int len)
{
/* Status image binary payload */
if (s_img_pending) {
if (len == STATUS_IMG_BYTES) {
memcpy(s_img_buf, data, STATUS_IMG_BYTES);
s_img_updated = true;
if (s_img_notify_task) {
xTaskNotifyGive(s_img_notify_task);
}
ESP_LOGI(TAG, "Status image received (%d bytes)", len);
} else {
ESP_LOGW(TAG, "Status image size mismatch: got %d, expected %d", len, STATUS_IMG_BYTES);
}
s_img_pending = false;
return;
}
if (!s_playing) return;
uint8_t *chunk = (uint8_t *)heap_caps_malloc(len, MALLOC_CAP_SPIRAM);
if (!chunk) {
ESP_LOGW(TAG, "PSRAM alloc failed (%d bytes)", len);
return;
}
memcpy(chunk, data, len);
if (xQueueSend(s_pcm_queue, &chunk, 0) != pdTRUE) {
ESP_LOGW(TAG, "PCM queue full, dropping chunk");
heap_caps_free(chunk);
}
}
static void ws_event_handler(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
esp_websocket_event_data_t *ev = (esp_websocket_event_data_t *)event_data;
switch (event_id) {
case WEBSOCKET_EVENT_CONNECTED:
ESP_LOGI(TAG, "Audio WS connected");
s_state = AUDIO_CONNECTED;
s_img_pending = false;
s_need_request_image = true;
if (s_img_notify_task) {
xTaskNotifyGive(s_img_notify_task);
}
break;
case WEBSOCKET_EVENT_DISCONNECTED:
ESP_LOGW(TAG, "Audio WS disconnected");
s_playing = false;
s_img_pending = false;
flush_queue();
s_state = AUDIO_IDLE;
break;
case WEBSOCKET_EVENT_DATA:
if (ev->op_code == 0x01 && ev->data_len > 0) {
handle_text_frame(ev->data_ptr, ev->data_len);
} else if (ev->op_code == 0x02 && ev->data_len > 0) {
handle_binary_frame((const uint8_t *)ev->data_ptr, ev->data_len);
}
break;
case WEBSOCKET_EVENT_ERROR:
ESP_LOGE(TAG, "Audio WS error");
s_playing = false;
s_state = AUDIO_ERROR;
break;
default:
break;
}
}
/* ---------- Playback task ---------- */
static void playback_task(void *arg)
{
uint8_t *chunk;
for (;;) {
if (xQueueReceive(s_pcm_queue, &chunk, pdMS_TO_TICKS(500)) == pdTRUE) {
if (s_playing) {
s_codec->CodecPort_PlayWrite(chunk, AUDIO_CHUNK_SIZE);
}
heap_caps_free(chunk);
}
}
}
/* ---------- Public API ---------- */
void audio_client_init(const char *uri, void *codec)
{
s_codec = (CodecPort *)codec;
/* Initialize status image descriptor */
memset(&s_img_dsc, 0, sizeof(s_img_dsc));
s_img_dsc.header.cf = LV_IMG_CF_ALPHA_1BIT;
s_img_dsc.header.w = STATUS_IMG_W;
s_img_dsc.header.h = STATUS_IMG_H;
s_img_dsc.data_size = STATUS_IMG_BYTES;
s_img_dsc.data = s_img_buf;
s_pcm_queue = xQueueCreate(PCM_QUEUE_DEPTH, sizeof(uint8_t *));
if (!s_pcm_queue) {
ESP_LOGE(TAG, "Failed to create PCM queue");
return;
}
esp_websocket_client_config_t config = {};
config.uri = uri;
config.reconnect_timeout_ms = 5000;
config.buffer_size = WS_BUFFER_SIZE;
s_client = esp_websocket_client_init(&config);
esp_websocket_register_events(s_client, WEBSOCKET_EVENT_ANY, ws_event_handler, NULL);
ESP_LOGI(TAG, "Audio client initialized: %s", uri);
}
void audio_client_start(void)
{
if (!s_client) return;
/* Create playback task pinned to Core 1 */
xTaskCreatePinnedToCore(playback_task, "audio_play", PLAYBACK_STACK_SIZE,
NULL, PLAYBACK_PRIORITY, &s_playback_task, 1);
esp_websocket_client_start(s_client);
ESP_LOGI(TAG, "Audio client started");
}
void audio_client_stop(void)
{
if (!s_client) return;
s_playing = false;
esp_websocket_client_stop(s_client);
flush_queue();
if (s_playback_task) {
vTaskDelete(s_playback_task);
s_playback_task = NULL;
}
s_state = AUDIO_IDLE;
ESP_LOGI(TAG, "Audio client stopped");
}
audio_state_t audio_client_get_state(void)
{
return s_state;
}
void audio_client_set_image_notify_task(TaskHandle_t task)
{
s_img_notify_task = task;
}
const lv_img_dsc_t *audio_client_get_status_image(bool *updated)
{
if (updated) {
*updated = s_img_updated;
}
return &s_img_dsc;
}
void audio_client_ack_status_image(void)
{
s_img_updated = false;
}
bool audio_client_send_pending_request(void)
{
if (!s_need_request_image || !s_client) return false;
s_need_request_image = false;
static const char REQUEST_IMG_JSON[] = "{\"type\":\"request_image\"}";
int ret = esp_websocket_client_send_text(s_client, REQUEST_IMG_JSON, strlen(REQUEST_IMG_JSON), pdMS_TO_TICKS(1000));
if (ret < 0) {
ESP_LOGE(TAG, "Failed to send image request: %d", ret);
return false;
}
ESP_LOGI(TAG, "Sent image request to server");
return true;
}

View File

@@ -0,0 +1,63 @@
#pragma once
#include <stdbool.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include "lvgl.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
AUDIO_IDLE = 0,
AUDIO_CONNECTED,
AUDIO_PLAYING,
AUDIO_ERROR,
} audio_state_t;
/**
* Initialize the audio streaming client.
* @param uri WebSocket URI (e.g. "ws://192.168.2.199:8766")
* @param codec Pointer to CodecPort instance (passed as void* for C linkage)
*/
void audio_client_init(const char *uri, void *codec);
/** Start the WebSocket connection and playback task. */
void audio_client_start(void);
/** Stop playback and disconnect. */
void audio_client_stop(void);
/** Get current audio client state. */
audio_state_t audio_client_get_state(void);
/**
* Register a task to be notified (via xTaskNotifyGive) when a new status
* image arrives. Call before audio_client_start().
*/
void audio_client_set_image_notify_task(TaskHandle_t task);
/**
* Get the latest status image descriptor.
* @param updated Set to true if a new image arrived since last call.
* @return Pointer to the static image descriptor (always valid).
*/
const lv_img_dsc_t *audio_client_get_status_image(bool *updated);
/**
* Acknowledge that the status image was successfully rendered.
* Clears the updated flag so subsequent get_status_image calls return false.
*/
void audio_client_ack_status_image(void);
/**
* Send any pending image request to the server.
* Call from a task context (not from an event handler).
* @return true if a request was sent, false if none pending or send failed.
*/
bool audio_client_send_pending_request(void);
#ifdef __cplusplus
}
#endif

View File

@@ -1,4 +1,4 @@
idf_component_register( idf_component_register(
SRCS "dashboard_ui.c" SRCS "dashboard_ui.c"
REQUIRES lvgl__lvgl ws_client REQUIRES lvgl__lvgl ws_client user_fonts
INCLUDE_DIRS "./") INCLUDE_DIRS "./")

View File

@@ -1,4 +1,5 @@
#include "dashboard_ui.h" #include "dashboard_ui.h"
#include "user_fonts.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -6,18 +7,26 @@
#define SCREEN_W 400 #define SCREEN_W 400
#define SCREEN_H 300 #define SCREEN_H 300
#define TOP_BAR_H 24 #define TOP_BAR_H 24
#define STATS_H 80 #define TIME_BAR_H 50
#define MID_H 140 #define BOT_H 24
#define BOT_H 32 #define MAIN_Y (TOP_BAR_H + TIME_BAR_H) /* 74 */
#define MAIN_H (SCREEN_H - MAIN_Y - BOT_H) /* 202 */
#define LEFT_COL_W 200
#define RIGHT_COL_X 200
/* ---------- Static widget handles ---------- */ /* ---------- Static widget handles ---------- */
/* Top bar */ /* Top bar */
static lv_obj_t *lbl_ip; static lv_obj_t *lbl_ip;
static lv_obj_t *lbl_batt; static lv_obj_t *lbl_batt;
static lv_obj_t *lbl_time; static lv_obj_t *lbl_batt_v;
static lv_obj_t *bar_batt_top;
static lv_obj_t *lbl_ws; static lv_obj_t *lbl_ws;
/* Time bar */
static lv_obj_t *lbl_clock;
static lv_obj_t *lbl_date;
/* Pi stats bars + labels */ /* Pi stats bars + labels */
static lv_obj_t *bar_cpu; static lv_obj_t *bar_cpu;
static lv_obj_t *lbl_cpu_val; static lv_obj_t *lbl_cpu_val;
@@ -29,19 +38,28 @@ static lv_obj_t *lbl_cpu_temp;
/* Services table */ /* Services table */
static lv_obj_t *tbl_services; static lv_obj_t *tbl_services;
static int s_service_count;
static int s_dup_rows; /* duplicate rows appended for looping */
static lv_coord_t s_row_h; /* measured row height in px */
/* Local sensors */ /* Local sensors (bottom bar) */
static lv_obj_t *lbl_room_temp; static lv_obj_t *lbl_local;
static lv_obj_t *lbl_room_humi;
static lv_obj_t *lbl_local_batt;
static lv_obj_t *lbl_uptime; static lv_obj_t *lbl_uptime;
/* Status image placeholder */
static lv_obj_t *img_status;
/* Network */ /* Network */
static lv_obj_t *lbl_net; static lv_obj_t *lbl_net;
/* ---------- Style ---------- */ /* Auto-scroll timer */
static lv_timer_t *s_scroll_timer;
/* ---------- Styles ---------- */
static lv_style_t style_bar_bg; static lv_style_t style_bar_bg;
static lv_style_t style_bar_ind; static lv_style_t style_bar_ind;
static lv_style_t style_bar_batt_bg;
static lv_style_t style_bar_batt_ind;
static void init_styles(void) static void init_styles(void)
{ {
@@ -58,6 +76,19 @@ static void init_styles(void)
lv_style_set_bg_color(&style_bar_ind, lv_color_black()); lv_style_set_bg_color(&style_bar_ind, lv_color_black());
lv_style_set_bg_opa(&style_bar_ind, LV_OPA_COVER); lv_style_set_bg_opa(&style_bar_ind, LV_OPA_COVER);
lv_style_set_radius(&style_bar_ind, 0); lv_style_set_radius(&style_bar_ind, 0);
/* Battery bar on black top bar: inverted colors */
lv_style_init(&style_bar_batt_bg);
lv_style_set_bg_color(&style_bar_batt_bg, lv_color_black());
lv_style_set_bg_opa(&style_bar_batt_bg, LV_OPA_COVER);
lv_style_set_border_color(&style_bar_batt_bg, lv_color_white());
lv_style_set_border_width(&style_bar_batt_bg, 1);
lv_style_set_radius(&style_bar_batt_bg, 0);
lv_style_init(&style_bar_batt_ind);
lv_style_set_bg_color(&style_bar_batt_ind, lv_color_white());
lv_style_set_bg_opa(&style_bar_batt_ind, LV_OPA_COVER);
lv_style_set_radius(&style_bar_batt_ind, 0);
} }
static lv_obj_t *create_bar(lv_obj_t *parent, int x, int y, int w, int h) static lv_obj_t *create_bar(lv_obj_t *parent, int x, int y, int w, int h)
@@ -82,7 +113,62 @@ static lv_obj_t *create_label(lv_obj_t *parent, int x, int y, const lv_font_t *f
return lbl; return lbl;
} }
/* ---------- Create UI ---------- */ /* ---------- Auto-scroll callback ---------- */
static void scroll_timer_cb(lv_timer_t *timer)
{
(void)timer;
if (s_dup_rows <= 0 || s_row_h <= 0) {
/* Too few services or not yet measured — no scrolling */
lv_obj_scroll_to_y(tbl_services, 0, LV_ANIM_OFF);
return;
}
lv_coord_t cur_y = lv_obj_get_scroll_y(tbl_services);
lv_coord_t wrap_y = s_service_count * s_row_h;
if (cur_y >= wrap_y) {
lv_obj_scroll_to_y(tbl_services, 0, LV_ANIM_OFF);
cur_y = 0;
}
// lv_obj_scroll_to_y(tbl_services, cur_y + s_row_h, LV_ANIM_OFF);
const int delta_y = s_row_h / 8;
lv_obj_scroll_to_y(tbl_services, cur_y + delta_y, LV_ANIM_ON);
}
/* Measure row height, compute visible rows, append duplicates for seamless loop */
static void fill_duplicate_rows(int count)
{
s_dup_rows = 0;
s_row_h = 0;
if (count <= 0) return;
/* Trim table to exactly count rows so measurement is clean */
lv_table_set_row_cnt(tbl_services, count);
lv_obj_update_layout(tbl_services);
lv_coord_t content_h = lv_obj_get_self_height(tbl_services);
lv_coord_t row_h = content_h / count;
if (row_h <= 0) return;
lv_coord_t visible_h = lv_obj_get_content_height(tbl_services);
int visible_rows = (visible_h + row_h - 1) / row_h; /* ceil */
if (count <= visible_rows) return; /* everything fits — no scrolling */
for (int i = 0; i < visible_rows; i++) {
lv_table_set_cell_value(tbl_services, count + i, 0,
lv_table_get_cell_value(tbl_services, i, 0));
lv_table_set_cell_value(tbl_services, count + i, 1,
lv_table_get_cell_value(tbl_services, i, 1));
}
s_dup_rows = visible_rows;
s_row_h = row_h;
}
/* ---------- Create UI sections ---------- */
static void create_top_bar(lv_obj_t *parent) static void create_top_bar(lv_obj_t *parent)
{ {
@@ -96,97 +182,153 @@ static void create_top_bar(lv_obj_t *parent)
lv_obj_set_style_pad_all(bar_cont, 2, 0); lv_obj_set_style_pad_all(bar_cont, 2, 0);
lv_obj_clear_flag(bar_cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_clear_flag(bar_cont, LV_OBJ_FLAG_SCROLLABLE);
/* IP address — left */
lbl_ip = lv_label_create(bar_cont); lbl_ip = lv_label_create(bar_cont);
lv_obj_set_style_text_color(lbl_ip, lv_color_white(), 0); lv_obj_set_style_text_color(lbl_ip, lv_color_white(), 0);
lv_obj_set_style_text_font(lbl_ip, &lv_font_montserrat_12, 0); lv_obj_set_style_text_font(lbl_ip, &InziuIosevka_Slab_CC_12px, 0);
lv_obj_align(lbl_ip, LV_ALIGN_LEFT_MID, 2, 0); lv_obj_align(lbl_ip, LV_ALIGN_LEFT_MID, 2, 0);
lv_label_set_text(lbl_ip, "N/A"); lv_label_set_text(lbl_ip, "N/A");
lbl_batt = lv_label_create(bar_cont); /* WS status — center-left */
lv_obj_set_style_text_color(lbl_batt, lv_color_white(), 0);
lv_obj_set_style_text_font(lbl_batt, &lv_font_montserrat_12, 0);
lv_obj_align(lbl_batt, LV_ALIGN_LEFT_MID, 120, 0);
lv_label_set_text(lbl_batt, "Batt:--%");
lbl_time = lv_label_create(bar_cont);
lv_obj_set_style_text_color(lbl_time, lv_color_white(), 0);
lv_obj_set_style_text_font(lbl_time, &lv_font_montserrat_12, 0);
lv_obj_align(lbl_time, LV_ALIGN_LEFT_MID, 220, 0);
lv_label_set_text(lbl_time, "--:--");
lbl_ws = lv_label_create(bar_cont); lbl_ws = lv_label_create(bar_cont);
lv_obj_set_style_text_color(lbl_ws, lv_color_white(), 0); lv_obj_set_style_text_color(lbl_ws, lv_color_white(), 0);
lv_obj_set_style_text_font(lbl_ws, &lv_font_montserrat_12, 0); lv_obj_set_style_text_font(lbl_ws, &InziuIosevka_Slab_CC_12px, 0);
lv_obj_align(lbl_ws, LV_ALIGN_RIGHT_MID, -2, 0); lv_obj_align(lbl_ws, LV_ALIGN_LEFT_MID, 140, 0);
lv_label_set_text(lbl_ws, "WS:---"); lv_label_set_text(lbl_ws, "WS:---");
/* Battery voltage — left of bar */
lbl_batt_v = lv_label_create(bar_cont);
lv_obj_set_style_text_color(lbl_batt_v, lv_color_white(), 0);
lv_obj_set_style_text_font(lbl_batt_v, &InziuIosevka_Slab_CC_12px, 0);
lv_obj_align(lbl_batt_v, LV_ALIGN_RIGHT_MID, -72, 0);
lv_label_set_text(lbl_batt_v, "-.--V");
/* Battery bar (24x10) — right */
bar_batt_top = lv_bar_create(bar_cont);
lv_obj_set_size(bar_batt_top, 24, 10);
lv_obj_align(bar_batt_top, LV_ALIGN_RIGHT_MID, -40, 0);
lv_bar_set_range(bar_batt_top, 0, 100);
lv_bar_set_value(bar_batt_top, 0, LV_ANIM_OFF);
lv_obj_add_style(bar_batt_top, &style_bar_batt_bg, LV_PART_MAIN);
lv_obj_add_style(bar_batt_top, &style_bar_batt_ind, LV_PART_INDICATOR);
/* Battery positive terminal nub */
lv_obj_t *batt_nub = lv_obj_create(bar_cont);
lv_obj_set_size(batt_nub, 2, 4);
lv_obj_align(batt_nub, LV_ALIGN_RIGHT_MID, -38, 0);
lv_obj_set_style_bg_color(batt_nub, lv_color_white(), 0);
lv_obj_set_style_bg_opa(batt_nub, LV_OPA_COVER, 0);
lv_obj_set_style_border_width(batt_nub, 0, 0);
lv_obj_set_style_radius(batt_nub, 0, 0);
lv_obj_set_style_pad_all(batt_nub, 0, 0);
lv_obj_clear_flag(batt_nub, LV_OBJ_FLAG_SCROLLABLE);
/* Battery text — right of bar */
lbl_batt = lv_label_create(bar_cont);
lv_obj_set_style_text_color(lbl_batt, lv_color_white(), 0);
lv_obj_set_style_text_font(lbl_batt, &InziuIosevka_Slab_CC_12px, 0);
lv_obj_align(lbl_batt, LV_ALIGN_RIGHT_MID, -2, 0);
lv_label_set_text(lbl_batt, "--%");
} }
static void create_stats_section(lv_obj_t *parent) static void create_time_bar(lv_obj_t *parent)
{ {
int y0 = TOP_BAR_H + 2; lv_obj_t *bar_cont = lv_obj_create(parent);
int col_w = 80; lv_obj_set_pos(bar_cont, 0, TOP_BAR_H);
int bar_w = 50; lv_obj_set_size(bar_cont, SCREEN_W, TIME_BAR_H);
int bar_h = 40; lv_obj_set_style_bg_color(bar_cont, lv_color_white(), 0);
lv_obj_set_style_bg_opa(bar_cont, LV_OPA_COVER, 0);
lv_obj_set_style_border_color(bar_cont, lv_color_black(), 0);
lv_obj_set_style_border_width(bar_cont, 1, 0);
lv_obj_set_style_border_side(bar_cont, LV_BORDER_SIDE_BOTTOM, 0);
lv_obj_set_style_radius(bar_cont, 0, 0);
lv_obj_set_style_pad_all(bar_cont, 0, 0);
lv_obj_clear_flag(bar_cont, LV_OBJ_FLAG_SCROLLABLE);
/* Section header */ /* Clock HH:MM:SS — left */
create_label(parent, 4, y0, &lv_font_montserrat_12, "PI SERVER STATS"); lbl_clock = lv_label_create(bar_cont);
lv_obj_set_style_text_font(lbl_clock, &DSEG14C_BI_32px, 0);
lv_obj_set_style_text_color(lbl_clock, lv_color_black(), 0);
lv_obj_align(lbl_clock, LV_ALIGN_LEFT_MID, 10, 0);
lv_label_set_text(lbl_clock, "--:--:--");
y0 += 14; /* Date YYYY/MM/DD DAY — right */
lbl_date = lv_label_create(bar_cont);
/* CPU */ lv_obj_set_style_text_font(lbl_date, &InziuIosevka_Slab_CC_20px, 0);
create_label(parent, 10, y0, &lv_font_montserrat_12, "CPU"); lv_obj_set_style_text_color(lbl_date, lv_color_black(), 0);
bar_cpu = create_bar(parent, 10, y0 + 14, bar_w, bar_h); lv_obj_align(lbl_date, LV_ALIGN_RIGHT_MID, -20, 0);
lbl_cpu_val = create_label(parent, 10, y0 + 56, &lv_font_montserrat_14, "--%"); lv_label_set_text(lbl_date, "----/--/-- ---");
/* RAM */
create_label(parent, 10 + col_w, y0, &lv_font_montserrat_12, "RAM");
bar_ram = create_bar(parent, 10 + col_w, y0 + 14, bar_w, bar_h);
lbl_ram_val = create_label(parent, 10 + col_w, y0 + 56, &lv_font_montserrat_14, "--%");
/* DISK */
create_label(parent, 10 + col_w * 2, y0, &lv_font_montserrat_12, "DISK");
bar_disk = create_bar(parent, 10 + col_w * 2, y0 + 14, bar_w, bar_h);
lbl_disk_val = create_label(parent, 10 + col_w * 2, y0 + 56, &lv_font_montserrat_14, "--%");
/* CPU TEMP - no bar, just big value */
create_label(parent, 10 + col_w * 3, y0, &lv_font_montserrat_12, "TEMP");
lbl_cpu_temp = create_label(parent, 10 + col_w * 3, y0 + 24, &lv_font_montserrat_20, "--C");
} }
static void create_mid_section(lv_obj_t *parent) static void create_main_section(lv_obj_t *parent)
{ {
int y0 = TOP_BAR_H + STATS_H + 4; /* === Left column: Services + Pi Vitals === */
create_label(parent, 4, MAIN_Y + 1, &InziuIosevka_Slab_CC_12px, "SERVICES");
/* --- Left column: Services --- */
create_label(parent, 4, y0, &lv_font_montserrat_12, "SERVICES");
tbl_services = lv_table_create(parent); tbl_services = lv_table_create(parent);
lv_obj_set_pos(tbl_services, 4, y0 + 14); lv_obj_set_pos(tbl_services, 4, MAIN_Y + 16);
lv_obj_set_size(tbl_services, 195, 110); lv_obj_set_size(tbl_services, 190, 82);
lv_table_set_col_cnt(tbl_services, 2); lv_table_set_col_cnt(tbl_services, 2);
lv_table_set_col_width(tbl_services, 0, 110); lv_table_set_col_width(tbl_services, 0, 110);
lv_table_set_col_width(tbl_services, 1, 70); lv_table_set_col_width(tbl_services, 1, 65);
lv_obj_set_style_text_font(tbl_services, &lv_font_montserrat_12, 0); lv_obj_set_style_text_font(tbl_services, &InziuIosevka_Slab_CC_12px, 0);
lv_obj_set_style_border_color(tbl_services, lv_color_black(), 0); lv_obj_set_style_border_color(tbl_services, lv_color_black(), 0);
lv_obj_set_style_border_width(tbl_services, 1, 0); lv_obj_set_style_border_width(tbl_services, 1, 0);
lv_obj_set_style_pad_ver(tbl_services, 2, LV_PART_ITEMS); lv_obj_set_style_pad_ver(tbl_services, 2, LV_PART_ITEMS);
lv_obj_set_style_pad_hor(tbl_services, 4, LV_PART_ITEMS); lv_obj_set_style_pad_hor(tbl_services, 4, LV_PART_ITEMS);
lv_obj_clear_flag(tbl_services, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_flag(tbl_services, LV_OBJ_FLAG_SCROLLABLE);
/* Pre-fill with empty rows */
for (int i = 0; i < WS_MAX_SERVICES; i++) { for (int i = 0; i < WS_MAX_SERVICES; i++) {
lv_table_set_cell_value(tbl_services, i, 0, "---"); lv_table_set_cell_value(tbl_services, i, 0, "---");
lv_table_set_cell_value(tbl_services, i, 1, "---"); lv_table_set_cell_value(tbl_services, i, 1, "---");
} }
/* --- Right column: Local sensors --- */ /* Timer for each shift of 1/8 line's height */
int rx = 205; s_scroll_timer = lv_timer_create(scroll_timer_cb, 120, NULL);
create_label(parent, rx, y0, &lv_font_montserrat_12, "LOCAL SENSORS");
lbl_room_temp = create_label(parent, rx, y0 + 18, &lv_font_montserrat_14, "Room: --.-C"); /* === Left column: Pi Vitals (below services) === */
lbl_room_humi = create_label(parent, rx, y0 + 38, &lv_font_montserrat_14, "Humi: --%"); int rx = 0;
lbl_local_batt = create_label(parent, rx, y0 + 58, &lv_font_montserrat_14, "Batt: --%"); int row_h = 18; /* vertical spacing per stat row */
lbl_uptime = create_label(parent, rx, y0 + 78, &lv_font_montserrat_14, "Uptime: --h"); int lbl_w = 36; /* width reserved for "CPU " etc */
int bar_w = 82;
int bar_h = 12;
int val_x = rx + 4 + lbl_w + bar_w + 4; /* value label after bar */
int temp_x = rx + 155; /* TEMP column, right of value labels */
/* Pi Vitals header */
create_label(parent, rx + 4, 175, &InziuIosevka_Slab_CC_12px, "PI VITALS");
int ry = 192;
/* CPU [========] 12% TEMP */
create_label(parent, rx + 4, ry, &InziuIosevka_Slab_CC_12px, "CPU");
bar_cpu = create_bar(parent, rx + 4 + lbl_w, ry, bar_w, bar_h);
lbl_cpu_val = create_label(parent, val_x, ry, &InziuIosevka_Slab_CC_12px, "--%");
create_label(parent, temp_x, ry, &InziuIosevka_Slab_CC_12px, "TEMP");
/* RAM [========] 58% 45 C */
ry += row_h;
create_label(parent, rx + 4, ry, &InziuIosevka_Slab_CC_12px, "RAM");
bar_ram = create_bar(parent, rx + 4 + lbl_w, ry, bar_w, bar_h);
lbl_ram_val = create_label(parent, val_x, ry, &InziuIosevka_Slab_CC_12px, "--%");
lbl_cpu_temp = create_label(parent, temp_x, ry, &InziuIosevka_Slab_CC_20px, "-- C");
/* DISK [========] 44% */
ry += row_h;
create_label(parent, rx + 4, ry, &InziuIosevka_Slab_CC_12px, "DISK");
bar_disk = create_bar(parent, rx + 4 + lbl_w, ry, bar_w, bar_h);
lbl_disk_val = create_label(parent, val_x, ry, &InziuIosevka_Slab_CC_12px, "--%");
/* uptime */
ry += row_h;
lbl_uptime = create_label(parent, rx + 4, ry, &InziuIosevka_Slab_CC_12px, "Uptime: --h");
/* === Right column: Status image (200x200) === */
img_status = lv_img_create(parent);
lv_obj_set_pos(img_status, 200, MAIN_Y + 1);
lv_obj_set_size(img_status, 200, 200);
lv_obj_set_style_bg_color(img_status, lv_color_white(), 0);
lv_obj_set_style_bg_opa(img_status, LV_OPA_COVER, 0);
} }
static void create_bottom_bar(lv_obj_t *parent) static void create_bottom_bar(lv_obj_t *parent)
@@ -196,7 +338,7 @@ static void create_bottom_bar(lv_obj_t *parent)
lv_obj_t *bot_cont = lv_obj_create(parent); lv_obj_t *bot_cont = lv_obj_create(parent);
lv_obj_set_pos(bot_cont, 0, y0); lv_obj_set_pos(bot_cont, 0, y0);
lv_obj_set_size(bot_cont, SCREEN_W, BOT_H); lv_obj_set_size(bot_cont, SCREEN_W, BOT_H);
lv_obj_set_style_bg_color(bot_cont, lv_color_white(), 0); lv_obj_set_style_bg_color(bot_cont, lv_color_black(), 0);
lv_obj_set_style_bg_opa(bot_cont, LV_OPA_COVER, 0); lv_obj_set_style_bg_opa(bot_cont, LV_OPA_COVER, 0);
lv_obj_set_style_border_color(bot_cont, lv_color_black(), 0); lv_obj_set_style_border_color(bot_cont, lv_color_black(), 0);
lv_obj_set_style_border_width(bot_cont, 1, 0); lv_obj_set_style_border_width(bot_cont, 1, 0);
@@ -206,10 +348,17 @@ static void create_bottom_bar(lv_obj_t *parent)
lv_obj_clear_flag(bot_cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_clear_flag(bot_cont, LV_OBJ_FLAG_SCROLLABLE);
lbl_net = lv_label_create(bot_cont); lbl_net = lv_label_create(bot_cont);
lv_obj_set_style_text_font(lbl_net, &lv_font_montserrat_12, 0); lv_obj_set_style_text_font(lbl_net, &InziuIosevka_Slab_CC_12px, 0);
lv_obj_set_style_text_color(lbl_net, lv_color_black(), 0); lv_obj_set_style_text_color(lbl_net, lv_color_white(), 0);
lv_obj_align(lbl_net, LV_ALIGN_LEFT_MID, 0, 0); lv_obj_align(lbl_net, LV_ALIGN_LEFT_MID, 0, 0);
lv_label_set_text(lbl_net, "NETWORK RX: ---- kbps TX: ---- kbps"); lv_label_set_text(lbl_net, "NETWORK DOWN: ---- kBps / UP: ---- kBps");
/* Local sensor readings — right-aligned */
lbl_local = lv_label_create(bot_cont);
lv_obj_set_style_text_font(lbl_local, &InziuIosevka_Slab_CC_12px, 0);
lv_obj_set_style_text_color(lbl_local, lv_color_white(), 0);
lv_obj_align(lbl_local, LV_ALIGN_RIGHT_MID, 0, 0);
lv_label_set_text(lbl_local, "T: --.- H: --%");
} }
void dashboard_ui_create(void) void dashboard_ui_create(void)
@@ -222,8 +371,8 @@ void dashboard_ui_create(void)
lv_obj_clear_flag(scr, LV_OBJ_FLAG_SCROLLABLE); lv_obj_clear_flag(scr, LV_OBJ_FLAG_SCROLLABLE);
create_top_bar(scr); create_top_bar(scr);
create_stats_section(scr); create_time_bar(scr);
create_mid_section(scr); create_main_section(scr);
create_bottom_bar(scr); create_bottom_bar(scr);
} }
@@ -249,20 +398,23 @@ void dashboard_ui_update_stats(const pi_stats_t *stats)
lv_label_set_text(lbl_disk_val, buf); lv_label_set_text(lbl_disk_val, buf);
/* CPU temp */ /* CPU temp */
snprintf(buf, sizeof(buf), "%.0fC", stats->cpu_temp); snprintf(buf, sizeof(buf), "%.0f C", stats->cpu_temp);
lv_label_set_text(lbl_cpu_temp, buf); lv_label_set_text(lbl_cpu_temp, buf);
/* Services table */ /* Services table */
s_service_count = stats->service_count;
for (int i = 0; i < stats->service_count && i < WS_MAX_SERVICES; i++) { for (int i = 0; i < stats->service_count && i < WS_MAX_SERVICES; i++) {
const char *tag;
switch (stats->services[i].status) {
case SVC_RUNNING: tag = "[RUN]"; break;
case SVC_WARNING: tag = "[WARN]"; break;
default: tag = "[STOP]"; break;
}
lv_table_set_cell_value(tbl_services, i, 0, stats->services[i].name); lv_table_set_cell_value(tbl_services, i, 0, stats->services[i].name);
lv_table_set_cell_value(tbl_services, i, 1, lv_table_set_cell_value(tbl_services, i, 1, tag);
stats->services[i].running ? "[RUN]" : "[STOP]");
}
/* Clear unused rows */
for (int i = stats->service_count; i < WS_MAX_SERVICES; i++) {
lv_table_set_cell_value(tbl_services, i, 0, "");
lv_table_set_cell_value(tbl_services, i, 1, "");
} }
/* Measure row height, compute visible rows, append duplicates */
fill_duplicate_rows(stats->service_count);
/* Uptime */ /* Uptime */
snprintf(buf, sizeof(buf), "Uptime: %.0fh", stats->uptime_hrs); snprintf(buf, sizeof(buf), "Uptime: %.0fh", stats->uptime_hrs);
@@ -270,34 +422,39 @@ void dashboard_ui_update_stats(const pi_stats_t *stats)
/* Network */ /* Network */
char net_buf[64]; char net_buf[64];
snprintf(net_buf, sizeof(net_buf), "NETWORK RX: %.0f kbps TX: %.0f kbps", snprintf(net_buf, sizeof(net_buf), "NETWORK DOWN: %.0f kBps / UP: %.0f kBps",
stats->net_rx_kbps, stats->net_tx_kbps); stats->net_rx_kbps, stats->net_tx_kbps);
lv_label_set_text(lbl_net, net_buf); lv_label_set_text(lbl_net, net_buf);
} }
void dashboard_ui_update_local(float temp, float humidity, uint8_t battery) void dashboard_ui_update_local(float temp, float humidity, uint8_t battery, bool charging, float voltage)
{ {
char buf[32]; char buf[32];
snprintf(buf, sizeof(buf), "Room: %.1fC", temp); snprintf(buf, sizeof(buf), "T: %.1f H: %.0f%%", temp, humidity);
lv_label_set_text(lbl_room_temp, buf); lv_label_set_text(lbl_local, buf);
snprintf(buf, sizeof(buf), "Humi: %.0f%%", humidity); /* Update top bar battery voltage */
lv_label_set_text(lbl_room_humi, buf); snprintf(buf, sizeof(buf), "%.2fV", voltage);
lv_label_set_text(lbl_batt_v, buf);
snprintf(buf, sizeof(buf), "Batt: %d%%", battery); /* Update top bar battery text + bar */
lv_label_set_text(lbl_local_batt, buf); snprintf(buf, sizeof(buf), charging ? "%d%%C" : "%d%%", battery);
/* Also update top bar battery */
snprintf(buf, sizeof(buf), "Batt:%d%%", battery);
lv_label_set_text(lbl_batt, buf); lv_label_set_text(lbl_batt, buf);
lv_bar_set_value(bar_batt_top, battery, LV_ANIM_OFF);
} }
void dashboard_ui_update_time(int h, int m, int s) void dashboard_ui_update_time(int h, int m, int s, int year, int month, int day, int weekday)
{ {
char buf[16]; static const char *day_names[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
snprintf(buf, sizeof(buf), "%02d:%02d", h, m);
lv_label_set_text(lbl_time, buf); char buf[32];
snprintf(buf, sizeof(buf), "%02d:%02d:%02d", h, m, s);
lv_label_set_text(lbl_clock, buf);
const char *wd = (weekday >= 0 && weekday <= 6) ? day_names[weekday] : "---";
snprintf(buf, sizeof(buf), "%04d/%02d/%02d %s", year, month, day, wd);
lv_label_set_text(lbl_date, buf);
} }
void dashboard_ui_update_connection(ws_state_t ws_state, bool wifi_connected, const char *ip_str) void dashboard_ui_update_connection(ws_state_t ws_state, bool wifi_connected, const char *ip_str)
@@ -316,3 +473,10 @@ void dashboard_ui_update_connection(ws_state_t ws_state, bool wifi_connected, co
} }
lv_label_set_text(lbl_ws, ws_str); lv_label_set_text(lbl_ws, ws_str);
} }
void dashboard_ui_update_status_image(const lv_img_dsc_t *dsc)
{
if (dsc) {
lv_img_set_src(img_status, dsc);
}
}

View File

@@ -21,12 +21,13 @@ void dashboard_ui_update_stats(const pi_stats_t *stats);
/** /**
* Update local sensor readings. LVGL lock must be held by caller. * Update local sensor readings. LVGL lock must be held by caller.
*/ */
void dashboard_ui_update_local(float temp, float humidity, uint8_t battery); void dashboard_ui_update_local(float temp, float humidity, uint8_t battery, bool charging, float voltage);
/** /**
* Update time display. LVGL lock must be held by caller. * Update clock and date display. LVGL lock must be held by caller.
* weekday: 0=Sun, 1=Mon, ..., 6=Sat
*/ */
void dashboard_ui_update_time(int h, int m, int s); void dashboard_ui_update_time(int h, int m, int s, int year, int month, int day, int weekday);
/** /**
* Update connection status indicators. LVGL lock must be held by caller. * Update connection status indicators. LVGL lock must be held by caller.
@@ -34,6 +35,12 @@ void dashboard_ui_update_time(int h, int m, int s);
*/ */
void dashboard_ui_update_connection(ws_state_t ws_state, bool wifi_connected, const char *ip_str); void dashboard_ui_update_connection(ws_state_t ws_state, bool wifi_connected, const char *ip_str);
/**
* Update the status image widget. LVGL lock must be held by caller.
* @param dsc Image descriptor (1-bit monochrome, 120x120)
*/
void dashboard_ui_update_status_image(const lv_img_dsc_t *dsc);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -3,6 +3,7 @@
#define WIFI_SSID "Novoyuuparosk_H3C" #define WIFI_SSID "Novoyuuparosk_H3C"
#define WIFI_PASSWORD "northwich" #define WIFI_PASSWORD "northwich"
#define WS_SERVER_URI "ws://192.168.1.100:8765" #define WS_SERVER_URI "ws://192.168.2.199:8765"
#define AUDIO_SERVER_URI "ws://192.168.2.199:8766"
#endif #endif

View File

@@ -48,3 +48,7 @@ uint8_t Adc_GetBatteryLevel() {
//ESP_LOGW("Battery","Voltage: %.3f V, Level: %.1f %%",vol,level); //ESP_LOGW("Battery","Voltage: %.3f V, Level: %.1f %%",vol,level);
return (uint8_t)level; return (uint8_t)level;
} }
bool Adc_IsCharging() {
return Adc_GetBatteryVoltage() > 4.10f;
}

View File

@@ -5,3 +5,4 @@
void Adc_PortInit(); void Adc_PortInit();
float Adc_GetBatteryVoltage(); float Adc_GetBatteryVoltage();
uint8_t Adc_GetBatteryLevel(); uint8_t Adc_GetBatteryLevel();
bool Adc_IsCharging();

View File

@@ -1,5 +1,5 @@
idf_component_register( idf_component_register(
SRCS "user_app.cpp" "alert.cpp" SRCS "user_app.cpp" "alert.cpp"
REQUIRES app_bsp REQUIRES app_bsp
PRIV_REQUIRES esp_wifi_bsp ws_client dashboard_ui port_bsp esp_timer codec_board PRIV_REQUIRES esp_wifi_bsp ws_client dashboard_ui port_bsp esp_timer codec_board audio_client
INCLUDE_DIRS "./") INCLUDE_DIRS "./")

View File

@@ -1,4 +1,5 @@
#include "alert.h" #include "alert.h"
#include "audio_client.h"
#include "codec_bsp.h" #include "codec_bsp.h"
#include "i2c_bsp.h" #include "i2c_bsp.h"
#include <esp_log.h> #include <esp_log.h>
@@ -14,7 +15,7 @@ static const char *TAG = "alert";
#define SAMPLE_RATE 24000 #define SAMPLE_RATE 24000
#define CHANNELS 2 #define CHANNELS 2
#define BITS 16 #define BITS 16
#define TONE_FREQ 1000 #define TONE_FREQ 762
#define TONE_DURATION_MS 200 #define TONE_DURATION_MS 200
/* Tone buffer: 200ms at 24kHz * 2ch * 2bytes = 19200 bytes */ /* Tone buffer: 200ms at 24kHz * 2ch * 2bytes = 19200 bytes */
@@ -41,8 +42,8 @@ static const int64_t s_cooldown_us[ALERT_TYPE_COUNT] = {
static const int s_beep_count[ALERT_TYPE_COUNT] = { static const int s_beep_count[ALERT_TYPE_COUNT] = {
0, /* SERVICE_DOWN: triple beep */ /* DISABLED FOR TESTING */ 0, /* SERVICE_DOWN: triple beep */ /* DISABLED FOR TESTING */
2, /* HIGH_TEMP: double beep */ 2, /* HIGH_TEMP: double beep */
1, /* WS_DISCONNECT: single beep */ 0, /* WS_DISCONNECT: single beep */ /* DISABLED FOR TESTING */
1, /* CONNECT_OK: single short beep */ 0, /* CONNECT_OK: single short beep */ /* DISABLED FOR TESTING */
}; };
static void generate_tone_buffer(void) static void generate_tone_buffer(void)
@@ -84,6 +85,7 @@ void alert_trigger(alert_type_t type)
if (type >= ALERT_TYPE_COUNT) return; if (type >= ALERT_TYPE_COUNT) return;
if (s_muted) return; if (s_muted) return;
if (!s_tone_buf || !s_codec) return; if (!s_tone_buf || !s_codec) return;
if (audio_client_get_state() == AUDIO_PLAYING) return; /* don't fight over codec */
if (xSemaphoreTake(s_alert_mutex, pdMS_TO_TICKS(50)) != pdTRUE) return; if (xSemaphoreTake(s_alert_mutex, pdMS_TO_TICKS(50)) != pdTRUE) return;

View File

@@ -9,6 +9,7 @@
#include "button_bsp.h" #include "button_bsp.h"
#include "codec_bsp.h" #include "codec_bsp.h"
#include "alert.h" #include "alert.h"
#include "audio_client.h"
#include "lvgl_bsp.h" #include "lvgl_bsp.h"
#include <esp_log.h> #include <esp_log.h>
@@ -57,6 +58,9 @@ void UserApp_AppInit(void)
alert_init(); alert_init();
alert_set_codec(s_codec); alert_set_codec(s_codec);
/* Audio streaming client */
audio_client_init(AUDIO_SERVER_URI, s_codec);
/* WebSocket client init (not started yet) */ /* WebSocket client init (not started yet) */
ws_client_init(WS_SERVER_URI); ws_client_init(WS_SERVER_URI);
ws_client_set_data_callback(ws_data_cb); ws_client_set_data_callback(ws_data_cb);
@@ -79,7 +83,12 @@ void UserApp_TaskInit(void)
ws_client_start(); ws_client_start();
/* Sensor polling task - Core 1, 4KB stack */ /* Sensor polling task - Core 1, 4KB stack */
xTaskCreatePinnedToCore(sensor_task, "sensor", 4 * 1024, NULL, 3, NULL, 1); TaskHandle_t sensor_handle = NULL;
xTaskCreatePinnedToCore(sensor_task, "sensor", 4 * 1024, NULL, 3, &sensor_handle, 1);
/* Start audio streaming client, notify sensor task on new images */
audio_client_set_image_notify_task(sensor_handle);
audio_client_start();
/* Button handling task - Core 1 */ /* Button handling task - Core 1 */
xTaskCreatePinnedToCore(button_task, "button", 2 * 1024, NULL, 2, NULL, 1); xTaskCreatePinnedToCore(button_task, "button", 2 * 1024, NULL, 2, NULL, 1);
@@ -89,6 +98,33 @@ void UserApp_TaskInit(void)
/* ---------- WebSocket callbacks ---------- */ /* ---------- WebSocket callbacks ---------- */
static void rtc_sync_if_needed(const pi_stats_t *stats)
{
if (!stats->time_valid) return;
rtcTimeStruct_t rtc = {};
Rtc_GetTime(&rtc);
/* Convert both to seconds-since-midnight for comparison */
int pi_secs = stats->time_hour * 3600 + stats->time_minute * 60 + stats->time_second;
int rtc_secs = rtc.hour * 3600 + rtc.minute * 60 + rtc.second;
int delta = pi_secs - rtc_secs;
if (delta < 0) delta = -delta;
/* Also check date mismatch as an immediate trigger */
bool date_mismatch = (rtc.year != stats->time_year ||
rtc.month != stats->time_month ||
rtc.day != stats->time_day);
if (date_mismatch || delta > 60) {
Rtc_SetTime(stats->time_year, stats->time_month, stats->time_day,
stats->time_hour, stats->time_minute, stats->time_second);
ESP_LOGI(TAG, "RTC synced from Pi: %04d-%02d-%02d %02d:%02d:%02d (drift: %ds)",
stats->time_year, stats->time_month, stats->time_day,
stats->time_hour, stats->time_minute, stats->time_second, delta);
}
}
static void ws_data_cb(const pi_stats_t *stats) static void ws_data_cb(const pi_stats_t *stats)
{ {
/* Check alert conditions */ /* Check alert conditions */
@@ -97,12 +133,15 @@ static void ws_data_cb(const pi_stats_t *stats)
} }
for (int i = 0; i < stats->service_count; i++) { for (int i = 0; i < stats->service_count; i++) {
if (!stats->services[i].running) { if (stats->services[i].status != SVC_RUNNING) {
alert_trigger(ALERT_SERVICE_DOWN); alert_trigger(ALERT_SERVICE_DOWN);
break; break;
} }
} }
/* Sync RTC if Pi time drifts from board clock */
rtc_sync_if_needed(stats);
/* Update UI under LVGL lock */ /* Update UI under LVGL lock */
if (Lvgl_lock(100)) { if (Lvgl_lock(100)) {
dashboard_ui_update_stats(stats); dashboard_ui_update_stats(stats);
@@ -144,28 +183,64 @@ static void sensor_task(void *arg)
{ {
float temp = 0, humidity = 0; float temp = 0, humidity = 0;
rtcTimeStruct_t rtc_time = {}; rtcTimeStruct_t rtc_time = {};
int sensor_divider = 0;
TickType_t last_sensor_tick = xTaskGetTickCount();
for (;;) { for (;;) {
/* Read SHTC3 */ /*
* Sleep until either:
* - a new status image arrives (xTaskNotifyGive from audio_client), or
* - 1 second elapses (clock refresh cadence)
*/
ulTaskNotifyTake(pdTRUE, pdMS_TO_TICKS(1000));
/* Send deferred image request if connect just happened */
audio_client_send_pending_request();
/* Check for status image updates immediately */
bool img_updated = false;
const lv_img_dsc_t *img = audio_client_get_status_image(&img_updated);
if (img_updated && Lvgl_lock(100)) {
dashboard_ui_update_status_image(img);
Lvgl_unlock();
audio_client_ack_status_image();
}
/* Sensor + clock updates at ~1s cadence (skip if woken early) */
TickType_t now = xTaskGetTickCount();
if ((now - last_sensor_tick) < pdMS_TO_TICKS(900)) {
continue;
}
last_sensor_tick = now;
/* Read RTC */
Rtc_GetTime(&rtc_time);
/* Read SHTC3 + battery every 5 seconds */
if (sensor_divider == 0) {
s_shtc3->Shtc3_Wakeup(); s_shtc3->Shtc3_Wakeup();
vTaskDelay(pdMS_TO_TICKS(20)); vTaskDelay(pdMS_TO_TICKS(20));
s_shtc3->Shtc3_ReadTempHumi(&temp, &humidity); s_shtc3->Shtc3_ReadTempHumi(&temp, &humidity);
s_shtc3->Shtc3_Sleep(); s_shtc3->Shtc3_Sleep();
/* Read RTC */ float batt_v = Adc_GetBatteryVoltage();
Rtc_GetTime(&rtc_time);
/* Read battery */
uint8_t batt = Adc_GetBatteryLevel(); uint8_t batt = Adc_GetBatteryLevel();
bool charging = Adc_IsCharging();
/* Update UI under LVGL lock */
if (Lvgl_lock(100)) { if (Lvgl_lock(100)) {
dashboard_ui_update_local(temp, humidity, batt); dashboard_ui_update_local(temp, humidity, batt, charging, batt_v);
dashboard_ui_update_time(rtc_time.hour, rtc_time.minute, rtc_time.second);
Lvgl_unlock(); Lvgl_unlock();
} }
}
sensor_divider = (sensor_divider + 1) % 5;
vTaskDelay(pdMS_TO_TICKS(5000)); /* Update clock */
if (Lvgl_lock(100)) {
dashboard_ui_update_time(rtc_time.hour, rtc_time.minute, rtc_time.second,
rtc_time.year, rtc_time.month, rtc_time.day,
rtc_time.week);
Lvgl_unlock();
}
} }
} }
@@ -174,10 +249,10 @@ static void sensor_task(void *arg)
static void button_task(void *arg) static void button_task(void *arg)
{ {
for (;;) { for (;;) {
/* Wait for GP18 button event (single click = bit 0) */ /* Wait for GP18 button event (single click = bit 0, long press = bit 2) */
EventBits_t bits = xEventGroupWaitBits( EventBits_t bits = xEventGroupWaitBits(
GP18ButtonGroups, GP18ButtonGroups,
set_bit_button(0), /* single press bit */ set_bit_button(0) | set_bit_button(2),
pdTRUE, /* clear on exit */ pdTRUE, /* clear on exit */
pdFALSE, /* any bit */ pdFALSE, /* any bit */
pdMS_TO_TICKS(500) pdMS_TO_TICKS(500)
@@ -186,7 +261,12 @@ static void button_task(void *arg)
if (bits & set_bit_button(0)) { if (bits & set_bit_button(0)) {
bool muted = !alert_is_muted(); bool muted = !alert_is_muted();
alert_mute(muted); alert_mute(muted);
ESP_LOGI(TAG, "GP18 pressed: alerts %s", muted ? "muted" : "unmuted"); ESP_LOGI(TAG, "GP18 single press: alerts %s", muted ? "muted" : "unmuted");
}
if (bits & set_bit_button(2)) {
ESP_LOGI(TAG, "GP18 long press: forcing WS reconnect");
ws_client_reconnect();
} }
} }
} }

View File

@@ -0,0 +1,11 @@
idf_component_register(
SRCS "DSEG14C_BI_32px.c"
"DSEG14C_BI_40px.c"
"DSEG14C_BI_50px.c"
"InziuIosevka_Slab_CC_12px.c"
"InziuIosevka_Slab_CC_16px.c"
"InziuIosevka_Slab_CC_20px.c"
"InziuIosevka_Slab_CC_24px.c"
"InziuIosevka_Slab_CC_32px.c"
REQUIRES lvgl__lvgl
INCLUDE_DIRS "./")

View File

@@ -0,0 +1,270 @@
/*******************************************************************************
* Size: 32 px
* Bpp: 1
* Opts: --bpp 1 --size 32 --no-compress --stride 1 --align 1 --font DSEG14Classic-BoldItalic.ttf --symbols 0123456789:;,. --format lvgl -o DSEG14C_BI_32px.c
******************************************************************************/
#ifdef __has_include
#if __has_include("lvgl.h")
#ifndef LV_LVGL_H_INCLUDE_SIMPLE
#define LV_LVGL_H_INCLUDE_SIMPLE
#endif
#endif
#endif
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#ifndef DSEG14C_BI_32PX
#define DSEG14C_BI_32PX 1
#endif
#if DSEG14C_BI_32PX
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+002C "," */
0x2f, 0xff, 0xf6, 0x80,
/* U+002E "." */
0xee, 0xfe,
/* U+0030 "0" */
0xf, 0xff, 0xf0, 0x3f, 0xff, 0xc3, 0x7f, 0xfe,
0xce, 0xff, 0xf7, 0x3c, 0x0, 0x3c, 0xf0, 0x2,
0xf3, 0xc0, 0x1b, 0xcf, 0x0, 0xef, 0x3c, 0x3,
0xbc, 0xf0, 0xe, 0xf3, 0xc0, 0x3f, 0x8f, 0x0,
0xde, 0x78, 0x3, 0x79, 0xe0, 0x1, 0xe7, 0x0,
0x3, 0x98, 0x0, 0x6, 0x60, 0x0, 0x19, 0xc0,
0x0, 0xe7, 0x80, 0x7, 0x9e, 0xc0, 0x1e, 0x7b,
0x0, 0x79, 0xfc, 0x3, 0xc7, 0xf0, 0xf, 0x3f,
0xc0, 0x3c, 0xf7, 0x0, 0xf3, 0xd8, 0x3, 0xcf,
0x40, 0xf, 0x3c, 0x0, 0x3c, 0xef, 0xff, 0x73,
0x7f, 0xfe, 0xc3, 0xff, 0xfc, 0xf, 0xff, 0xf0,
/* U+0031 "1" */
0x0, 0x31, 0xcf, 0x3c, 0xf3, 0xcf, 0x3d, 0xe7,
0x9e, 0x78, 0xe1, 0x8e, 0x79, 0xe7, 0x9e, 0xf3,
0xcf, 0x3c, 0xf3, 0xcf, 0x1c, 0x20,
/* U+0032 "2" */
0xf, 0xff, 0xf0, 0x3f, 0xff, 0xc0, 0x7f, 0xfe,
0xc0,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, 0xcf,
0x0, 0xf, 0x3c, 0x0, 0x3c, 0xef, 0xff, 0x73,
0x7f, 0xfe, 0xc3, 0xff, 0xfc, 0xf, 0xff, 0xf0,
/* U+0039 "9" */
0x1f, 0xff, 0xe0, 0xff, 0xff, 0x1b, 0xff, 0xf6,
0xef, 0xff, 0x77, 0x80, 0x7, 0xbc, 0x0, 0x3d,
0xe0, 0x1, 0xef, 0x0, 0xf, 0x78, 0x0, 0x7b,
0xc0, 0x3, 0xde, 0x0, 0x3c, 0xf0, 0x1, 0xef,
0x0, 0xf, 0x78, 0x0, 0x7b, 0xbe, 0x7d, 0xdb,
0xf3, 0xf6, 0x1f, 0x9f, 0xb0, 0x7c, 0xfb, 0x80,
0x0, 0x3c, 0x0, 0x1, 0xe0, 0x0, 0xf, 0x0,
0x0, 0xf0, 0x0, 0x7, 0x80, 0x0, 0x3c, 0x0,
0x1, 0xe0, 0x0, 0xf, 0x0, 0x0, 0x78, 0x0,
0x3, 0xc1, 0xff, 0xee, 0x1f, 0xff, 0xb1, 0xff,
0xfe, 0xf, 0xff, 0xf0,
/* U+003A ":" */
0x73, 0xde, 0xe0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x73, 0xde, 0xe0
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 418, .box_w = 3, .box_h = 9, .ofs_x = 7, .ofs_y = 5},
{.bitmap_index = 4, .adv_w = 0, .box_w = 4, .box_h = 4, .ofs_x = -3, .ofs_y = 0},
{.bitmap_index = 6, .adv_w = 418, .box_w = 22, .box_h = 32, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 94, .adv_w = 418, .box_w = 6, .box_h = 29, .ofs_x = 18, .ofs_y = 2},
{.bitmap_index = 116, .adv_w = 418, .box_w = 22, .box_h = 32, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 204, .adv_w = 418, .box_w = 21, .box_h = 32, .ofs_x = 3, .ofs_y = 0},
{.bitmap_index = 288, .adv_w = 418, .box_w = 21, .box_h = 30, .ofs_x = 3, .ofs_y = 1},
{.bitmap_index = 367, .adv_w = 418, .box_w = 20, .box_h = 32, .ofs_x = 3, .ofs_y = 0},
{.bitmap_index = 447, .adv_w = 418, .box_w = 21, .box_h = 32, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 531, .adv_w = 418, .box_w = 21, .box_h = 31, .ofs_x = 3, .ofs_y = 1},
{.bitmap_index = 613, .adv_w = 418, .box_w = 22, .box_h = 32, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 701, .adv_w = 418, .box_w = 21, .box_h = 32, .ofs_x = 3, .ofs_y = 0},
{.bitmap_index = 785, .adv_w = 102, .box_w = 5, .box_h = 17, .ofs_x = 1, .ofs_y = 7}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
static const uint8_t glyph_id_ofs_list_0[] = {
0, 0, 1, 0, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12
};
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 44, .range_length = 15, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = glyph_id_ofs_list_0, .list_length = 15, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LVGL_VERSION_MAJOR == 8
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
#endif
#if LVGL_VERSION_MAJOR >= 8
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
.kern_scale = 0,
.cmap_num = 1,
.bpp = 1,
.kern_classes = 0,
.bitmap_format = 0,
#if LVGL_VERSION_MAJOR == 8
.cache = &cache
#endif
};
extern const lv_font_t lv_font_montserrat_12;
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t DSEG14C_BI_32px = {
#else
lv_font_t DSEG14C_BI_32px = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 32, /*The maximum line height required by the font*/
.base_line = 0, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
.underline_position = -4,
.underline_thickness = 2,
#endif
.dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
#if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9
.fallback = &lv_font_montserrat_12,
#endif
.user_data = NULL,
};
#endif /*#if DSEG14C_BI_32PX*/

View File

@@ -0,0 +1,329 @@
/*******************************************************************************
* Size: 40 px
* Bpp: 1
* Opts: --bpp 1 --size 40 --no-compress --stride 1 --align 1 --font DSEG14Classic-BoldItalic.ttf --symbols 0123456789:;., --format lvgl -o DSEG14C_BI_40px.c
******************************************************************************/
#ifdef __has_include
#if __has_include("lvgl.h")
#ifndef LV_LVGL_H_INCLUDE_SIMPLE
#define LV_LVGL_H_INCLUDE_SIMPLE
#endif
#endif
#endif
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#ifndef DSEG14C_BI_40PX
#define DSEG14C_BI_40PX 1
#endif
#if DSEG14C_BI_40PX
/*-----------------
* BITMAPS
*----------------*/
/*Store the image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0xff, 0xff, 0xc0,
/* U+0039 "9" */
0xf, 0xff, 0xff, 0x3, 0xff, 0xff, 0xc2, 0x7f,
0xff, 0xe1, 0xdf, 0xff, 0xf3, 0x7b, 0xff, 0xf9,
0xdf, 0x0, 0x0, 0xf7, 0xc0, 0x0, 0x7d, 0xf0,
0x0, 0x1f, 0x7c, 0x0, 0x7, 0xdf, 0x0, 0x1,
0xf7, 0xc0, 0x0, 0x7d, 0xf0, 0x0, 0x3e, 0x7c,
0x0, 0xf, 0x9f, 0x0, 0x3, 0xef, 0x80, 0x0,
0xfb, 0xe0, 0x0, 0x3e, 0xf8, 0x0, 0xf, 0xbe,
0x0, 0x3, 0xef, 0x7e, 0x3f, 0x7b, 0xbf, 0x9f,
0xee, 0x1f, 0xf7, 0xfc, 0x3, 0xf9, 0xfe, 0xe0,
0x7e, 0x3f, 0xf8, 0x0, 0x0, 0x7c, 0x0, 0x0,
0x1f, 0x0, 0x0, 0x7, 0xc0, 0x0, 0x1, 0xf0,
0x0, 0x0, 0x7c, 0x0, 0x0, 0x1f, 0x0, 0x0,
0x7, 0xc0, 0x0, 0x1, 0xf0, 0x0, 0x0, 0x7c,
0x0, 0x0, 0x1f, 0x0, 0x0, 0x7, 0xc0, 0x0,
0x3, 0xe0, 0x3f, 0xff, 0x78, 0x1f, 0xff, 0xee,
0x1f, 0xff, 0xfd, 0x8f, 0xff, 0xff, 0x81, 0xff,
0xff, 0xc0,
/* U+003A ":" */
0x39, 0xf7, 0xdf, 0x38, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x73, 0xef, 0xbe, 0x70
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 522, .box_w = 5, .box_h = 11, .ofs_x = 8, .ofs_y = 6},
{.bitmap_index = 7, .adv_w = 0, .box_w = 5, .box_h = 5, .ofs_x = -4, .ofs_y = 0},
{.bitmap_index = 11, .adv_w = 522, .box_w = 28, .box_h = 40, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 151, .adv_w = 522, .box_w = 8, .box_h = 37, .ofs_x = 22, .ofs_y = 1},
{.bitmap_index = 188, .adv_w = 522, .box_w = 28, .box_h = 40, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 328, .adv_w = 522, .box_w = 26, .box_h = 40, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 458, .adv_w = 522, .box_w = 26, .box_h = 37, .ofs_x = 4, .ofs_y = 2},
{.bitmap_index = 579, .adv_w = 522, .box_w = 25, .box_h = 40, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 704, .adv_w = 522, .box_w = 27, .box_h = 40, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 839, .adv_w = 522, .box_w = 26, .box_h = 38, .ofs_x = 4, .ofs_y = 2},
{.bitmap_index = 963, .adv_w = 522, .box_w = 28, .box_h = 40, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1103, .adv_w = 522, .box_w = 26, .box_h = 40, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 1233, .adv_w = 128, .box_w = 6, .box_h = 21, .ofs_x = 1, .ofs_y = 9}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
static const uint8_t glyph_id_ofs_list_0[] = {
0, 0, 1, 0, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12
};
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 44, .range_length = 15, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = glyph_id_ofs_list_0, .list_length = 15, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LVGL_VERSION_MAJOR == 8
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
#endif
#if LVGL_VERSION_MAJOR >= 8
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
.kern_scale = 0,
.cmap_num = 1,
.bpp = 1,
.kern_classes = 0,
.bitmap_format = 0,
#if LVGL_VERSION_MAJOR == 8
.cache = &cache
#endif
};
extern const lv_font_t lv_font_montserrat_12;
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t DSEG14C_BI_40px = {
#else
lv_font_t DSEG14C_BI_40px = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 40, /*The maximum line height required by the font*/
.base_line = 0, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
.underline_position = -5,
.underline_thickness = 2,
#endif
.dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
#if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9
.fallback = &lv_font_montserrat_12,
#endif
.user_data = NULL,
};
#endif /*#if DSEG14C_BI_40PX*/

View File

@@ -0,0 +1,417 @@
/*******************************************************************************
* Size: 50 px
* Bpp: 1
* Opts: --bpp 1 --size 50 --no-compress --stride 1 --align 1 --font DSEG14Classic-BoldItalic.ttf --symbols 0123456789:;., --format lvgl -o DSEG14C_BI_50px.c
******************************************************************************/
#ifdef __has_include
#if __has_include("lvgl.h")
#ifndef LV_LVGL_H_INCLUDE_SIMPLE
#define LV_LVGL_H_INCLUDE_SIMPLE
#endif
#endif
#endif
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#ifndef DSEG14C_BI_50PX
#define DSEG14C_BI_50PX 1
#endif
#if DSEG14C_BI_50PX
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+002C "," */
0x19, 0xce, 0xff, 0xff, 0xde, 0xf7, 0xbd, 0xcc,
0x60,
/* U+002E "." */
0x7b, 0xef, 0xff, 0xf9, 0xe0,
/* U+0030 "0" */
0x1, 0xff, 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff,
0xf0, 0x17, 0xff, 0xff, 0xfd, 0x7, 0x7f, 0xff,
0xfe, 0x60, 0xf7, 0xff, 0xff, 0x9e, 0x1f, 0x7f,
0xff, 0xe7, 0xc3, 0xf0, 0x0, 0x1, 0xf0, 0xfe,
0x0, 0x3, 0x7e, 0x1f, 0xc0, 0x0, 0x6f, 0xc3,
0xf8, 0x0, 0x1d, 0xf8, 0x7e, 0x0, 0x7, 0xbf,
0xf, 0xc0, 0x0, 0xf7, 0xe1, 0xf8, 0x0, 0x1e,
0xfc, 0x3f, 0x0, 0x7, 0xdf, 0x87, 0xe0, 0x0,
0xfb, 0xf0, 0xfc, 0x0, 0x1e, 0xfe, 0x1f, 0x80,
0x3, 0xdf, 0xc3, 0xf0, 0x0, 0x7b, 0xf8, 0xfe,
0x0, 0xe, 0x7e, 0x1f, 0xc0, 0x1, 0xcf, 0xc3,
0xf8, 0x0, 0x31, 0xf8, 0x7e, 0x0, 0x0, 0x3f,
0xf, 0x80, 0x0, 0x3, 0xe1, 0xe0, 0x0, 0x0,
0x3c, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0,
0x0, 0x70, 0xf0, 0x0, 0x0, 0x1e, 0x1f, 0x0,
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ff, 0xbc, 0xef, 0xfe, 0xff, 0xce, 0x7,
0xfe, 0x7f, 0xf0, 0x1, 0xff, 0x1f, 0xe7, 0x80,
0x7f, 0xf, 0xe7, 0xc0, 0x0, 0x0, 0x7, 0xe0,
0x0, 0x0, 0x7, 0xe0, 0x0, 0x0, 0x3, 0xf0,
0x0, 0x0, 0x1, 0xf8, 0x0, 0x0, 0x0, 0xfc,
0x0, 0x0, 0x0, 0x7e, 0x0, 0x0, 0x0, 0x3f,
0x0, 0x0, 0x0, 0x1f, 0x80, 0x0, 0x0, 0xf,
0xc0, 0x0, 0x0, 0x7, 0xe0, 0x0, 0x0, 0x7,
0xf0, 0x0, 0x0, 0x3, 0xf8, 0x0, 0x0, 0x1,
0xfc, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0,
0x7e, 0x0, 0x0, 0x0, 0x3f, 0x0, 0x7f, 0xff,
0xef, 0x80, 0x7f, 0xff, 0xfb, 0xc0, 0xff, 0xff,
0xfe, 0xe0, 0xff, 0xff, 0xff, 0xa0, 0xff, 0xff,
0xff, 0xe0, 0x3f, 0xff, 0xff, 0xc0, 0x0,
/* U+003A ":" */
0x1e, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x78, 0xfc, 0xfc,
0xfc, 0xfc, 0x78
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 653, .box_w = 5, .box_h = 14, .ofs_x = 11, .ofs_y = 7},
{.bitmap_index = 9, .adv_w = 0, .box_w = 6, .box_h = 6, .ofs_x = -5, .ofs_y = 0},
{.bitmap_index = 14, .adv_w = 653, .box_w = 35, .box_h = 50, .ofs_x = 3, .ofs_y = 0},
{.bitmap_index = 233, .adv_w = 653, .box_w = 10, .box_h = 45, .ofs_x = 28, .ofs_y = 2},
{.bitmap_index = 290, .adv_w = 653, .box_w = 35, .box_h = 50, .ofs_x = 3, .ofs_y = 0},
{.bitmap_index = 509, .adv_w = 653, .box_w = 33, .box_h = 50, .ofs_x = 5, .ofs_y = 0},
{.bitmap_index = 716, .adv_w = 653, .box_w = 33, .box_h = 46, .ofs_x = 5, .ofs_y = 2},
{.bitmap_index = 906, .adv_w = 653, .box_w = 31, .box_h = 50, .ofs_x = 5, .ofs_y = 0},
{.bitmap_index = 1100, .adv_w = 653, .box_w = 33, .box_h = 50, .ofs_x = 3, .ofs_y = 0},
{.bitmap_index = 1307, .adv_w = 653, .box_w = 33, .box_h = 48, .ofs_x = 5, .ofs_y = 2},
{.bitmap_index = 1505, .adv_w = 653, .box_w = 35, .box_h = 50, .ofs_x = 3, .ofs_y = 0},
{.bitmap_index = 1724, .adv_w = 653, .box_w = 33, .box_h = 50, .ofs_x = 5, .ofs_y = 0},
{.bitmap_index = 1931, .adv_w = 160, .box_w = 8, .box_h = 27, .ofs_x = 1, .ofs_y = 11}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
static const uint8_t glyph_id_ofs_list_0[] = {
0, 0, 1, 0, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12
};
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 44, .range_length = 15, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = glyph_id_ofs_list_0, .list_length = 15, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LVGL_VERSION_MAJOR == 8
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
#endif
#if LVGL_VERSION_MAJOR >= 8
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
.kern_scale = 0,
.cmap_num = 1,
.bpp = 1,
.kern_classes = 0,
.bitmap_format = 0,
#if LVGL_VERSION_MAJOR == 8
.cache = &cache
#endif
};
extern const lv_font_t lv_font_montserrat_12;
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t DSEG14C_BI_50px = {
#else
lv_font_t DSEG14C_BI_50px = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 50, /*The maximum line height required by the font*/
.base_line = 0, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
.underline_position = -6,
.underline_thickness = 3,
#endif
.dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
#if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9
.fallback = &lv_font_montserrat_12,
#endif
.user_data = NULL,
};
#endif /*#if DSEG14C_BI_50PX*/

View File

@@ -0,0 +1,924 @@
/*******************************************************************************
* Size: 12 px
* Bpp: 1
* Opts: --bpp 1 --size 12 --no-compress --stride 1 --align 1 --font Inziu-IosevkaCC-Slab-J-Regular-04.ttf --range 0-254 --format lvgl -o InziuIosevka_Slab_CC_12px.c
******************************************************************************/
#ifdef __has_include
#if __has_include("lvgl.h")
#ifndef LV_LVGL_H_INCLUDE_SIMPLE
#define LV_LVGL_H_INCLUDE_SIMPLE
#endif
#endif
#endif
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#ifndef INZIUIOSEVKA_SLAB_CC_12PX
#define INZIUIOSEVKA_SLAB_CC_12PX 1
#endif
#if INZIUIOSEVKA_SLAB_CC_12PX
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+000D "\r" */
0x0,
/* U+0020 " " */
0x0,
/* U+0021 "!" */
0x55, 0x50, 0xf0,
/* U+0022 "\"" */
0xb6, 0xd0,
/* U+0023 "#" */
0x52, 0x95, 0xf5, 0x29, 0x4a, 0xfa, 0x94, 0xa0,
/* U+0024 "$" */
0x21, 0x1d, 0xda, 0x51, 0x86, 0x2d, 0x7c, 0x42,
0x0,
/* U+0025 "%" */
0x99, 0xa2, 0x24, 0x45, 0x99,
/* U+0026 "&" */
0x64, 0xa5, 0x66, 0x36, 0xf3, 0x8b, 0xc0,
/* U+0027 "'" */
0xf0,
/* U+0028 "(" */
0x2, 0x44, 0x88, 0x88, 0x88, 0x84, 0x42,
/* U+0029 ")" */
0x4, 0x22, 0x11, 0x11, 0x11, 0x12, 0x24,
/* U+002A "*" */
0x21, 0x3e, 0xa5, 0x0,
/* U+002B "+" */
0x21, 0x3e, 0x42, 0x0,
/* U+002C "," */
0xf6, 0x0,
/* U+002D "-" */
0xf0,
/* U+002E "." */
0xf0,
/* U+002F "/" */
0x11, 0x12, 0x22, 0x24, 0x44, 0x48, 0x88,
/* U+0030 "0" */
0x74, 0x63, 0x3a, 0xd7, 0x31, 0xcb, 0x80,
/* U+0031 "1" */
0x67, 0x8, 0x42, 0x10, 0x84, 0x27, 0xc0,
/* U+0032 "2" */
0x72, 0x42, 0x11, 0x19, 0x88, 0x4f, 0xc0,
/* U+0033 "3" */
0x72, 0x42, 0x33, 0xc, 0x21, 0x4b, 0x80,
/* U+0034 "4" */
0x11, 0x8c, 0xa5, 0x4b, 0xe2, 0x11, 0xc0,
/* U+0035 "5" */
0xfc, 0x61, 0xf, 0x4c, 0x21, 0x8b, 0x80,
/* U+0036 "6" */
0x11, 0x11, 0x8f, 0x46, 0x31, 0x8b, 0x80,
/* U+0037 "7" */
0xfc, 0x84, 0x22, 0x10, 0x84, 0x42, 0x0,
/* U+0038 "8" */
0x74, 0x63, 0x37, 0x2a, 0x31, 0x8b, 0x80,
/* U+0039 "9" */
0x74, 0x63, 0x18, 0xbc, 0x31, 0xdb, 0x80,
/* U+003A ":" */
0xf0, 0x3c,
/* U+003B ";" */
0xf0, 0x3d, 0x80,
/* U+003C "<" */
0x0, 0x99, 0x88, 0x20, 0xc3,
/* U+003D "=" */
0xf0, 0xf,
/* U+003E ">" */
0x2, 0xc, 0x30, 0x89, 0x98,
/* U+003F "?" */
0x74, 0x42, 0x11, 0x10, 0x80, 0x63, 0x0,
/* U+0040 "@" */
0x74, 0x42, 0x1e, 0xd6, 0xb5, 0xad, 0x6b, 0xb0,
/* U+0041 "A" */
0x30, 0xc3, 0xc, 0x31, 0x24, 0x9e, 0x4b, 0x30,
/* U+0042 "B" */
0xf1, 0x24, 0x92, 0x49, 0xc4, 0xd1, 0x4f, 0xe0,
/* U+0043 "C" */
0x74, 0xe1, 0x8, 0x42, 0x10, 0x9b, 0x80,
/* U+0044 "D" */
0xf9, 0x34, 0x51, 0x45, 0x14, 0x51, 0x4f, 0xe0,
/* U+0045 "E" */
0xfa, 0x50, 0x84, 0x39, 0x8, 0x4f, 0xc0,
/* U+0046 "F" */
0xfa, 0x50, 0x84, 0x39, 0x8, 0x47, 0x0,
/* U+0047 "G" */
0x74, 0x61, 0x8, 0x4e, 0x31, 0x8b, 0x80,
/* U+0048 "H" */
0xcd, 0x24, 0x92, 0x79, 0x24, 0x92, 0x4b, 0x30,
/* U+0049 "I" */
0xe9, 0x24, 0x92, 0x5c,
/* U+004A "J" */
0x71, 0x11, 0x11, 0x11, 0x9e,
/* U+004B "K" */
0xed, 0x25, 0x14, 0x71, 0xc5, 0x12, 0x4b, 0xb0,
/* U+004C "L" */
0xe2, 0x10, 0x84, 0x21, 0x8, 0x4f, 0xc0,
/* U+004D "M" */
0xcd, 0x27, 0x9e, 0x79, 0x64, 0x92, 0x4b, 0x30,
/* U+004E "N" */
0xcd, 0xa6, 0x9a, 0x69, 0xa5, 0x96, 0x5b, 0x20,
/* U+004F "O" */
0x74, 0x63, 0x18, 0xc6, 0x31, 0x8b, 0x80,
/* U+0050 "P" */
0xf2, 0x52, 0x94, 0xb9, 0x8, 0x46, 0x0,
/* U+0051 "Q" */
0x74, 0x63, 0x18, 0xc6, 0x31, 0x8b, 0x88, 0x30,
/* U+0052 "R" */
0xf9, 0x14, 0x51, 0x45, 0xe5, 0x92, 0x4b, 0x90,
/* U+0053 "S" */
0x69, 0x88, 0x42, 0x11, 0x96,
/* U+0054 "T" */
0xfd, 0x48, 0x42, 0x10, 0x84, 0x23, 0x80,
/* U+0055 "U" */
0xcd, 0x24, 0x92, 0x49, 0x24, 0x92, 0x48, 0xc0,
/* U+0056 "V" */
0xcd, 0x24, 0x92, 0x48, 0xc3, 0xc, 0x30, 0xc0,
/* U+0057 "W" */
0xcd, 0x24, 0x92, 0x49, 0xa7, 0x9e, 0x31, 0x40,
/* U+0058 "X" */
0xcd, 0x24, 0x8c, 0x30, 0xc3, 0x12, 0x4b, 0x30,
/* U+0059 "Y" */
0xee, 0x89, 0x11, 0x42, 0x82, 0x4, 0x8, 0x10,
0x70,
/* U+005A "Z" */
0xfc, 0x84, 0x42, 0x31, 0x8, 0x8f, 0xc0,
/* U+005B "[" */
0xf8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x8f,
/* U+005C "\\" */
0x88, 0x84, 0x44, 0x42, 0x22, 0x21, 0x11,
/* U+005D "]" */
0xf1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1f,
/* U+005E "^" */
0x6f, 0x90,
/* U+005F "_" */
0xf0,
/* U+0060 "`" */
0x88, 0x80,
/* U+0061 "a" */
0x71, 0x20, 0x9e, 0x4a, 0x27, 0xc0,
/* U+0062 "b" */
0xc1, 0x4, 0x1e, 0x45, 0x14, 0x51, 0x47, 0xe0,
/* U+0063 "c" */
0x74, 0xe1, 0x8, 0x4d, 0xc0,
/* U+0064 "d" */
0x18, 0x20, 0x9e, 0x8a, 0x28, 0xa2, 0x89, 0xf0,
/* U+0065 "e" */
0x74, 0x63, 0xf8, 0x45, 0xc0,
/* U+0066 "f" */
0x75, 0x4f, 0x44, 0x44, 0x4f,
/* U+0067 "g" */
0x7c, 0x63, 0x17, 0x41, 0xd3, 0x9b, 0x80,
/* U+0068 "h" */
0xc1, 0x4, 0x1c, 0x49, 0x24, 0x92, 0x4b, 0x30,
/* U+0069 "i" */
0x60, 0x1, 0xc2, 0x10, 0x84, 0x27, 0xc0,
/* U+006A "j" */
0x10, 0x7, 0x11, 0x11, 0x11, 0x19, 0x60,
/* U+006B "k" */
0xc1, 0x4, 0x13, 0x51, 0x47, 0x14, 0x4b, 0xb0,
/* U+006C "l" */
0xe1, 0x8, 0x42, 0x10, 0x84, 0x27, 0xc0,
/* U+006D "m" */
0xfd, 0x6b, 0x5a, 0xd6, 0xa0,
/* U+006E "n" */
0xf1, 0x24, 0x92, 0x49, 0x2c, 0xc0,
/* U+006F "o" */
0x74, 0x63, 0x18, 0xc5, 0xc0,
/* U+0070 "p" */
0xf9, 0x14, 0x51, 0x45, 0x17, 0x90, 0x43, 0x80,
/* U+0071 "q" */
0x7e, 0x28, 0xa2, 0x8a, 0x27, 0x82, 0x8, 0x70,
/* U+0072 "r" */
0xfa, 0x10, 0x84, 0x23, 0x80,
/* U+0073 "s" */
0x74, 0xa0, 0xe1, 0x49, 0xc0,
/* U+0074 "t" */
0x42, 0x11, 0xe4, 0x21, 0x8, 0x49, 0x80,
/* U+0075 "u" */
0xc9, 0x24, 0x92, 0x49, 0x23, 0xc0,
/* U+0076 "v" */
0xcd, 0x24, 0x92, 0x30, 0xc3, 0x0,
/* U+0077 "w" */
0xcd, 0x24, 0x9a, 0x78, 0xc3, 0x0,
/* U+0078 "x" */
0xcd, 0x23, 0xc, 0x31, 0x2c, 0xc0,
/* U+0079 "y" */
0xcd, 0x24, 0x92, 0x30, 0xc3, 0x8, 0x21, 0x80,
/* U+007A "z" */
0xfc, 0x8c, 0x44, 0x67, 0xe0,
/* U+007B "{" */
0x36, 0x46, 0x22, 0xc6, 0x22, 0x44, 0x63,
/* U+007C "|" */
0xff, 0xfc,
/* U+007D "}" */
0xc6, 0x26, 0x44, 0x34, 0x44, 0x22, 0x6c,
/* U+007E "~" */
0x1, 0xa9, 0x80,
/* U+00A0 " " */
0x0,
/* U+00A1 "¡" */
0xf0, 0x55, 0x50,
/* U+00A2 "¢" */
0x23, 0xa7, 0x8, 0x42, 0x6e, 0x20,
/* U+00A3 "£" */
0x32, 0x90, 0x8e, 0x21, 0x8, 0xc7, 0xc0,
/* U+00A4 "¤" */
0xfc, 0x63, 0x1f, 0x80,
/* U+00A5 "¥" */
0xcd, 0x24, 0x9c, 0x31, 0xe2, 0x1e, 0x20, 0xc0,
/* U+00A6 "¦" */
0xfc, 0xfc,
/* U+00A7 "§" */
0x74, 0x61, 0x6, 0x6e, 0x31, 0xd9, 0x82, 0x18,
0xb8,
/* U+00A8 "¨" */
0xf0,
/* U+00A9 "©" */
0x3e, 0x31, 0xb7, 0x72, 0x99, 0xc, 0x86, 0x53,
0xbb, 0x63, 0x1f, 0x0,
/* U+00AA "ª" */
0x7f, 0x9f, 0xf,
/* U+00AB "«" */
0x4a, 0xa9, 0x45, 0x28, 0xa0,
/* U+00AC "¬" */
0xf1, 0x10,
/* U+00AD "­" */
0xf0,
/* U+00AE "®" */
0x3e, 0x31, 0xb7, 0x72, 0x99, 0x4c, 0xc6, 0x53,
0xab, 0x63, 0x1f, 0x0,
/* U+00AF "¯" */
0xf0,
/* U+00B0 "°" */
0xf7, 0x80,
/* U+00B1 "±" */
0x21, 0x9, 0xf2, 0x10, 0x1f,
/* U+00B2 "²" */
0x79, 0x16, 0x4f,
/* U+00B3 "³" */
0x71, 0x31, 0x97,
/* U+00B4 "´" */
0x2a, 0x0,
/* U+00B5 "µ" */
0xc9, 0x24, 0x92, 0x49, 0x27, 0xd0, 0x43, 0x0,
/* U+00B6 "¶" */
0x6d, 0x6b, 0x5a, 0xb4, 0xa5, 0x29, 0x40,
/* U+00B7 "·" */
0xf0,
/* U+00B8 "¸" */
0x47, 0x80,
/* U+00B9 "¹" */
0xc9, 0x25, 0xc0,
/* U+00BA "º" */
0xf9, 0x9f, 0xf,
/* U+00BB "»" */
0xa2, 0x8a, 0x55, 0x2a, 0x80,
/* U+00BC "¼" */
0x26, 0x22, 0x26, 0xf, 0x2, 0x66, 0x62,
/* U+00BD "½" */
0x23, 0x8, 0x42, 0x38, 0x1f, 0x3, 0x84, 0x44,
0x38,
/* U+00BE "¾" */
0x62, 0x62, 0x60, 0xf0, 0x26, 0xaf, 0x20,
/* U+00BF "¿" */
0x63, 0x0, 0x42, 0x22, 0x10, 0x8b, 0x80,
/* U+00C0 "À" */
0x20, 0x80, 0xc, 0x30, 0xc3, 0xc, 0x49, 0x27,
0x92, 0xcc,
/* U+00C1 "Á" */
0x10, 0x40, 0xc, 0x30, 0xc3, 0xc, 0x49, 0x27,
0x92, 0xcc,
/* U+00C2 "Â" */
0x0, 0xc0, 0xc, 0x30, 0xc3, 0xc, 0x49, 0x27,
0x92, 0xcc,
/* U+00C3 "Ã" */
0x1, 0xa1, 0xc, 0x30, 0xc3, 0xc, 0x49, 0x27,
0x92, 0xcc,
/* U+00C4 "Ä" */
0x78, 0x3, 0xc, 0x30, 0xc3, 0x12, 0x49, 0xe4,
0xb3,
/* U+00C5 "Å" */
0x30, 0xc3, 0xc, 0x30, 0xc3, 0xc, 0x49, 0x27,
0x92, 0xcc,
/* U+00C6 "Æ" */
0x3c, 0xd3, 0xc, 0x39, 0x45, 0x1c, 0x57, 0xf0,
/* U+00C7 "Ç" */
0x79, 0x88, 0x88, 0x88, 0x97, 0x22, 0x60,
/* U+00C8 "È" */
0x41, 0x1, 0xf4, 0xa1, 0x8, 0x72, 0x10, 0x9f,
0x80,
/* U+00C9 "É" */
0x11, 0x81, 0xf4, 0xa1, 0x8, 0x72, 0x10, 0x9f,
0x80,
/* U+00CA "Ê" */
0x23, 0x91, 0xf4, 0xa1, 0x8, 0x72, 0x10, 0x9f,
0x80,
/* U+00CB "Ë" */
0x78, 0x3e, 0x94, 0x21, 0xe, 0x42, 0x13, 0xf0,
/* U+00CC "Ì" */
0x88, 0x74, 0x92, 0x49, 0x2e,
/* U+00CD "Í" */
0x28, 0x74, 0x92, 0x49, 0x2e,
/* U+00CE "Î" */
0x22, 0x80, 0xe2, 0x10, 0x84, 0x21, 0x8, 0x47,
0x0,
/* U+00CF "Ï" */
0xf0, 0x72, 0x22, 0x22, 0x22, 0x27,
/* U+00D0 "Ð" */
0xf9, 0x34, 0x51, 0x47, 0xd4, 0x51, 0x4f, 0xe0,
/* U+00D1 "Ñ" */
0x1, 0xa1, 0x33, 0x69, 0xa6, 0x9a, 0x69, 0x65,
0x96, 0xc8,
/* U+00D2 "Ò" */
0x41, 0x8, 0xe8, 0xc6, 0x31, 0x8c, 0x63, 0x17,
0x0,
/* U+00D3 "Ó" */
0x11, 0x8, 0xe8, 0xc6, 0x31, 0x8c, 0x63, 0x17,
0x0,
/* U+00D4 "Ô" */
0x22, 0x80, 0xe8, 0xc6, 0x31, 0x8c, 0x63, 0x17,
0x0,
/* U+00D5 "Õ" */
0x3, 0x80, 0xe8, 0xc6, 0x31, 0x8c, 0x63, 0x17,
0x0,
/* U+00D6 "Ö" */
0xf0, 0x1d, 0x18, 0xc6, 0x31, 0x8c, 0x62, 0xe0,
/* U+00D7 "×" */
0x85, 0x23, 0xc, 0x4b, 0x30,
/* U+00D8 "Ø" */
0x3, 0xe7, 0x3b, 0xd6, 0xbd, 0xce, 0x7c, 0x0,
/* U+00D9 "Ù" */
0x20, 0x80, 0x33, 0x49, 0x24, 0x92, 0x49, 0x24,
0x92, 0x30,
/* U+00DA "Ú" */
0x10, 0x40, 0x33, 0x49, 0x24, 0x92, 0x49, 0x24,
0x92, 0x30,
/* U+00DB "Û" */
0x31, 0xe0, 0x33, 0x49, 0x24, 0x92, 0x49, 0x24,
0x92, 0x30,
/* U+00DC "Ü" */
0x78, 0xc, 0xd2, 0x49, 0x24, 0x92, 0x49, 0x24,
0x8c,
/* U+00DD "Ý" */
0x8, 0x20, 0x7, 0x74, 0x48, 0x8a, 0x14, 0x10,
0x20, 0x40, 0x83, 0x80,
/* U+00DE "Þ" */
0xc2, 0x1c, 0x94, 0xa5, 0x2e, 0x46, 0x0,
/* U+00DF "ß" */
0x31, 0x24, 0x92, 0x49, 0x44, 0xd1, 0x4f, 0x60,
/* U+00E0 "à" */
0x40, 0x80, 0x1c, 0x48, 0x27, 0x92, 0x89, 0xf0,
/* U+00E1 "á" */
0x10, 0xc2, 0x1c, 0x48, 0x27, 0x92, 0x89, 0xf0,
/* U+00E2 "â" */
0x31, 0x64, 0x1c, 0x48, 0x27, 0x92, 0x89, 0xf0,
/* U+00E3 "ã" */
0x69, 0x60, 0x1c, 0x48, 0x27, 0x92, 0x89, 0xf0,
/* U+00E4 "ä" */
0x78, 0x0, 0x1c, 0x48, 0x27, 0x92, 0x89, 0xf0,
/* U+00E5 "å" */
0x30, 0xc3, 0x1c, 0x48, 0x27, 0x92, 0x89, 0xf0,
/* U+00E6 "æ" */
0x7d, 0x4b, 0xfa, 0x57, 0xe0,
/* U+00E7 "ç" */
0x79, 0x88, 0x89, 0x72, 0x26,
/* U+00E8 "è" */
0x41, 0x8, 0xe8, 0xc7, 0xf0, 0x8b, 0x80,
/* U+00E9 "é" */
0x11, 0x8, 0xe8, 0xc7, 0xf0, 0x8b, 0x80,
/* U+00EA "ê" */
0x22, 0x80, 0xe8, 0xc7, 0xf0, 0x8b, 0x80,
/* U+00EB "ë" */
0xf0, 0x0, 0xe8, 0xc7, 0xf0, 0x8b, 0x80,
/* U+00EC "ì" */
0x41, 0x9, 0xc2, 0x10, 0x84, 0x27, 0xc0,
/* U+00ED "í" */
0x11, 0x1, 0xc2, 0x10, 0x84, 0x27, 0xc0,
/* U+00EE "î" */
0x62, 0x81, 0xc2, 0x10, 0x84, 0x27, 0xc0,
/* U+00EF "ï" */
0xf0, 0x1, 0xc2, 0x10, 0x84, 0x27, 0xc0,
/* U+00F0 "ð" */
0x41, 0xe, 0xa7, 0xc6, 0x31, 0x8b, 0x80,
/* U+00F1 "ñ" */
0x29, 0x60, 0x3c, 0x49, 0x24, 0x92, 0x4b, 0x30,
/* U+00F2 "ò" */
0x41, 0x8, 0xe8, 0xc6, 0x31, 0x8b, 0x80,
/* U+00F3 "ó" */
0x11, 0x8, 0xe8, 0xc6, 0x31, 0x8b, 0x80,
/* U+00F4 "ô" */
0x22, 0x80, 0xe8, 0xc6, 0x31, 0x8b, 0x80,
/* U+00F5 "õ" */
0x6d, 0x80, 0xe8, 0xc6, 0x31, 0x8b, 0x80,
/* U+00F6 "ö" */
0xf0, 0x0, 0xe8, 0xc6, 0x31, 0x8b, 0x80,
/* U+00F7 "÷" */
0x30, 0x0, 0x3f, 0x0, 0x3, 0x0,
/* U+00F8 "ø" */
0x7c, 0xef, 0x5e, 0xe7, 0xc0,
/* U+00F9 "ù" */
0x20, 0x80, 0x32, 0x49, 0x24, 0x92, 0x48, 0xf0,
/* U+00FA "ú" */
0x10, 0x40, 0x32, 0x49, 0x24, 0x92, 0x48, 0xf0,
/* U+00FB "û" */
0x31, 0xe0, 0x32, 0x49, 0x24, 0x92, 0x48, 0xf0,
/* U+00FC "ü" */
0x78, 0x0, 0x32, 0x49, 0x24, 0x92, 0x48, 0xf0,
/* U+00FD "ý" */
0x18, 0x40, 0x33, 0x49, 0x24, 0x8c, 0x30, 0xc2,
0x8, 0x60,
/* U+00FE "þ" */
0xc1, 0x4, 0x1e, 0x45, 0x14, 0x51, 0x45, 0xe4,
0x10, 0xe0
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 192, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1, .adv_w = 96, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2, .adv_w = 96, .box_w = 2, .box_h = 10, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 5, .adv_w = 96, .box_w = 3, .box_h = 4, .ofs_x = 1, .ofs_y = 6},
{.bitmap_index = 7, .adv_w = 96, .box_w = 5, .box_h = 12, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 15, .adv_w = 96, .box_w = 5, .box_h = 13, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 24, .adv_w = 96, .box_w = 4, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 29, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 36, .adv_w = 96, .box_w = 1, .box_h = 4, .ofs_x = 3, .ofs_y = 6},
{.bitmap_index = 37, .adv_w = 96, .box_w = 4, .box_h = 14, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 44, .adv_w = 96, .box_w = 4, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 51, .adv_w = 96, .box_w = 5, .box_h = 5, .ofs_x = 1, .ofs_y = 6},
{.bitmap_index = 55, .adv_w = 96, .box_w = 5, .box_h = 5, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 59, .adv_w = 96, .box_w = 2, .box_h = 5, .ofs_x = 2, .ofs_y = -3},
{.bitmap_index = 61, .adv_w = 96, .box_w = 4, .box_h = 1, .ofs_x = 1, .ofs_y = 4},
{.bitmap_index = 62, .adv_w = 96, .box_w = 2, .box_h = 2, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 63, .adv_w = 96, .box_w = 4, .box_h = 14, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 70, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 77, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 84, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 91, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 98, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 105, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 112, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 119, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 126, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 133, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 140, .adv_w = 96, .box_w = 2, .box_h = 7, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 142, .adv_w = 96, .box_w = 2, .box_h = 10, .ofs_x = 2, .ofs_y = -3},
{.bitmap_index = 145, .adv_w = 96, .box_w = 5, .box_h = 8, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 150, .adv_w = 96, .box_w = 4, .box_h = 4, .ofs_x = 1, .ofs_y = 3},
{.bitmap_index = 152, .adv_w = 96, .box_w = 5, .box_h = 8, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 157, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 164, .adv_w = 96, .box_w = 5, .box_h = 12, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 172, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 180, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 188, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 195, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 203, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 210, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 217, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 224, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 232, .adv_w = 96, .box_w = 3, .box_h = 10, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 236, .adv_w = 96, .box_w = 4, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 241, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 249, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 256, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 264, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 272, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 279, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 286, .adv_w = 96, .box_w = 5, .box_h = 12, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 294, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 302, .adv_w = 96, .box_w = 4, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 307, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 314, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 322, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 330, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 338, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 346, .adv_w = 96, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 355, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 362, .adv_w = 96, .box_w = 4, .box_h = 14, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 369, .adv_w = 96, .box_w = 4, .box_h = 14, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 376, .adv_w = 96, .box_w = 4, .box_h = 14, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 383, .adv_w = 96, .box_w = 4, .box_h = 3, .ofs_x = 1, .ofs_y = 7},
{.bitmap_index = 385, .adv_w = 96, .box_w = 4, .box_h = 1, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 386, .adv_w = 96, .box_w = 3, .box_h = 3, .ofs_x = 1, .ofs_y = 7},
{.bitmap_index = 388, .adv_w = 96, .box_w = 6, .box_h = 7, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 394, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 402, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 407, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 415, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 420, .adv_w = 96, .box_w = 4, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 425, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 432, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 440, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 447, .adv_w = 96, .box_w = 4, .box_h = 13, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 454, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 462, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 469, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 474, .adv_w = 96, .box_w = 6, .box_h = 7, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 480, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 485, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 493, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 501, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 506, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 511, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 518, .adv_w = 96, .box_w = 6, .box_h = 7, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 524, .adv_w = 96, .box_w = 6, .box_h = 7, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 530, .adv_w = 96, .box_w = 6, .box_h = 7, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 536, .adv_w = 96, .box_w = 6, .box_h = 7, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 542, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 550, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 555, .adv_w = 96, .box_w = 4, .box_h = 14, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 562, .adv_w = 96, .box_w = 1, .box_h = 14, .ofs_x = 3, .ofs_y = -2},
{.bitmap_index = 564, .adv_w = 96, .box_w = 4, .box_h = 14, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 571, .adv_w = 96, .box_w = 6, .box_h = 3, .ofs_x = 0, .ofs_y = 3},
{.bitmap_index = 574, .adv_w = 96, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 575, .adv_w = 96, .box_w = 2, .box_h = 10, .ofs_x = 2, .ofs_y = -3},
{.bitmap_index = 578, .adv_w = 96, .box_w = 5, .box_h = 9, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 584, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 591, .adv_w = 192, .box_w = 5, .box_h = 5, .ofs_x = 3, .ofs_y = 2},
{.bitmap_index = 595, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 603, .adv_w = 96, .box_w = 1, .box_h = 14, .ofs_x = 3, .ofs_y = -2},
{.bitmap_index = 605, .adv_w = 192, .box_w = 5, .box_h = 14, .ofs_x = 3, .ofs_y = -2},
{.bitmap_index = 614, .adv_w = 96, .box_w = 4, .box_h = 1, .ofs_x = 1, .ofs_y = 8},
{.bitmap_index = 615, .adv_w = 192, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 627, .adv_w = 96, .box_w = 4, .box_h = 6, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 630, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 635, .adv_w = 96, .box_w = 4, .box_h = 3, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 637, .adv_w = 96, .box_w = 4, .box_h = 1, .ofs_x = 1, .ofs_y = 4},
{.bitmap_index = 638, .adv_w = 192, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 650, .adv_w = 96, .box_w = 4, .box_h = 1, .ofs_x = 1, .ofs_y = 8},
{.bitmap_index = 651, .adv_w = 96, .box_w = 3, .box_h = 3, .ofs_x = 2, .ofs_y = 7},
{.bitmap_index = 653, .adv_w = 192, .box_w = 5, .box_h = 8, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 658, .adv_w = 96, .box_w = 4, .box_h = 6, .ofs_x = 1, .ofs_y = 4},
{.bitmap_index = 661, .adv_w = 96, .box_w = 4, .box_h = 6, .ofs_x = 1, .ofs_y = 4},
{.bitmap_index = 664, .adv_w = 96, .box_w = 3, .box_h = 3, .ofs_x = 2, .ofs_y = 7},
{.bitmap_index = 666, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 674, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 681, .adv_w = 192, .box_w = 2, .box_h = 2, .ofs_x = 5, .ofs_y = 4},
{.bitmap_index = 682, .adv_w = 96, .box_w = 3, .box_h = 3, .ofs_x = 2, .ofs_y = -3},
{.bitmap_index = 684, .adv_w = 96, .box_w = 3, .box_h = 6, .ofs_x = 2, .ofs_y = 4},
{.bitmap_index = 687, .adv_w = 96, .box_w = 4, .box_h = 6, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 690, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 695, .adv_w = 96, .box_w = 4, .box_h = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 702, .adv_w = 96, .box_w = 5, .box_h = 14, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 711, .adv_w = 96, .box_w = 4, .box_h = 13, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 718, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 725, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 735, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 745, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 755, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 765, .adv_w = 96, .box_w = 6, .box_h = 12, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 774, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 784, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 792, .adv_w = 96, .box_w = 4, .box_h = 13, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 799, .adv_w = 96, .box_w = 5, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 808, .adv_w = 96, .box_w = 5, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 817, .adv_w = 96, .box_w = 5, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 826, .adv_w = 96, .box_w = 5, .box_h = 12, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 834, .adv_w = 96, .box_w = 3, .box_h = 13, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 839, .adv_w = 96, .box_w = 3, .box_h = 13, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 844, .adv_w = 96, .box_w = 5, .box_h = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 853, .adv_w = 96, .box_w = 4, .box_h = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 859, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 867, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 877, .adv_w = 96, .box_w = 5, .box_h = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 886, .adv_w = 96, .box_w = 5, .box_h = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 895, .adv_w = 96, .box_w = 5, .box_h = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 904, .adv_w = 96, .box_w = 5, .box_h = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 913, .adv_w = 96, .box_w = 5, .box_h = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 921, .adv_w = 192, .box_w = 6, .box_h = 6, .ofs_x = 3, .ofs_y = 2},
{.bitmap_index = 926, .adv_w = 96, .box_w = 5, .box_h = 12, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 934, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 944, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 954, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 964, .adv_w = 96, .box_w = 6, .box_h = 12, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 973, .adv_w = 96, .box_w = 7, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 985, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 992, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1000, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1008, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1016, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1024, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1032, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1040, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1048, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1053, .adv_w = 96, .box_w = 4, .box_h = 10, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 1058, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1065, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1072, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1079, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1086, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1093, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1100, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1107, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1114, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1121, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1129, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1136, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1143, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1150, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1157, .adv_w = 96, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1164, .adv_w = 192, .box_w = 6, .box_h = 7, .ofs_x = 3, .ofs_y = 1},
{.bitmap_index = 1170, .adv_w = 96, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1175, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1183, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1191, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1199, .adv_w = 96, .box_w = 6, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1207, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 1217, .adv_w = 96, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = -3}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 13, .range_length = 1, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
},
{
.range_start = 32, .range_length = 95, .glyph_id_start = 2,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
},
{
.range_start = 160, .range_length = 95, .glyph_id_start = 97,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LVGL_VERSION_MAJOR == 8
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
#endif
#if LVGL_VERSION_MAJOR >= 8
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
.kern_scale = 0,
.cmap_num = 3,
.bpp = 1,
.kern_classes = 0,
.bitmap_format = 0,
#if LVGL_VERSION_MAJOR == 8
.cache = &cache
#endif
};
extern const lv_font_t lv_font_montserrat_12;
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t InziuIosevka_Slab_CC_12px = {
#else
lv_font_t InziuIosevka_Slab_CC_12px = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 16, /*The maximum line height required by the font*/
.base_line = 3, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
.underline_position = -2,
.underline_thickness = 1,
#endif
.dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
#if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9
.fallback = &lv_font_montserrat_12,
#endif
.user_data = NULL,
};
#endif /*#if INZIUIOSEVKA_SLAB_CC_12PX*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
#ifndef USER_FONTS_H
#define USER_FONTS_H
#include "lvgl.h"
#ifdef __cplusplus
extern "C" {
#endif
/* DSEG14 Classic Bold Italic — segmented display digits only (0-9 : ; , .) */
extern const lv_font_t DSEG14C_BI_32px;
extern const lv_font_t DSEG14C_BI_40px;
extern const lv_font_t DSEG14C_BI_50px;
/* Inziu Iosevka Slab CC — monospace, Latin range 0-254 */
extern const lv_font_t InziuIosevka_Slab_CC_12px;
extern const lv_font_t InziuIosevka_Slab_CC_16px;
extern const lv_font_t InziuIosevka_Slab_CC_20px;
extern const lv_font_t InziuIosevka_Slab_CC_24px;
extern const lv_font_t InziuIosevka_Slab_CC_32px;
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -5,15 +5,32 @@
#include <string.h> #include <string.h>
#include <freertos/FreeRTOS.h> #include <freertos/FreeRTOS.h>
#include <freertos/semphr.h> #include <freertos/semphr.h>
#include <freertos/timers.h>
static const char *TAG = "ws_client"; static const char *TAG = "ws_client";
#define WS_WATCHDOG_PERIOD_MS 5000
#define WS_DATA_TIMEOUT_MS 10000
static esp_websocket_client_handle_t s_client = NULL; static esp_websocket_client_handle_t s_client = NULL;
static pi_stats_t s_stats = {}; static pi_stats_t s_stats = {};
static SemaphoreHandle_t s_stats_mutex = NULL; static SemaphoreHandle_t s_stats_mutex = NULL;
static ws_state_t s_state = WS_STATE_DISCONNECTED; static ws_state_t s_state = WS_STATE_DISCONNECTED;
static ws_data_callback_t s_data_cb = NULL; static ws_data_callback_t s_data_cb = NULL;
static ws_state_callback_t s_state_cb = NULL; static ws_state_callback_t s_state_cb = NULL;
static TickType_t s_last_data_tick = 0;
static TimerHandle_t s_watchdog_timer = NULL;
static void watchdog_callback(TimerHandle_t timer)
{
(void)timer;
if (s_state == WS_STATE_CONNECTED &&
(xTaskGetTickCount() - s_last_data_tick) > pdMS_TO_TICKS(WS_DATA_TIMEOUT_MS)) {
ESP_LOGW(TAG, "WS watchdog: no data for %ds, forcing reconnect",
WS_DATA_TIMEOUT_MS / 1000);
esp_websocket_client_close(s_client, pdMS_TO_TICKS(2000));
}
}
static void set_state(ws_state_t state) static void set_state(ws_state_t state)
{ {
@@ -75,14 +92,46 @@ static void parse_stats_json(const char *data, int len)
s_stats.services[i].name[WS_SERVICE_NAME_LEN - 1] = '\0'; s_stats.services[i].name[WS_SERVICE_NAME_LEN - 1] = '\0';
} }
if (status && status->valuestring) { if (status && status->valuestring) {
s_stats.services[i].running = (strcmp(status->valuestring, "running") == 0); if (strcmp(status->valuestring, "running") == 0) {
s_stats.services[i].status = SVC_RUNNING;
} else if (strcmp(status->valuestring, "warning") == 0) {
s_stats.services[i].status = SVC_WARNING;
} else {
s_stats.services[i].status = SVC_STOPPED;
}
} }
} }
} }
/* Parse local_time object for RTC sync */
cJSON *lt = cJSON_GetObjectItem(root, "local_time");
if (cJSON_IsObject(lt)) {
cJSON *y = cJSON_GetObjectItem(lt, "y");
cJSON *mo = cJSON_GetObjectItem(lt, "mo");
cJSON *d = cJSON_GetObjectItem(lt, "d");
cJSON *h = cJSON_GetObjectItem(lt, "h");
cJSON *m = cJSON_GetObjectItem(lt, "m");
cJSON *s = cJSON_GetObjectItem(lt, "s");
if (y && mo && d && h && m && s) {
s_stats.time_year = (uint16_t)y->valuedouble;
s_stats.time_month = (uint8_t)mo->valuedouble;
s_stats.time_day = (uint8_t)d->valuedouble;
s_stats.time_hour = (uint8_t)h->valuedouble;
s_stats.time_minute = (uint8_t)m->valuedouble;
s_stats.time_second = (uint8_t)s->valuedouble;
s_stats.time_valid = true;
} else {
s_stats.time_valid = false;
}
} else {
s_stats.time_valid = false;
}
s_stats.valid = true; s_stats.valid = true;
xSemaphoreGive(s_stats_mutex); xSemaphoreGive(s_stats_mutex);
s_last_data_tick = xTaskGetTickCount();
if (s_data_cb) { if (s_data_cb) {
s_data_cb(&s_stats); s_data_cb(&s_stats);
} }
@@ -99,6 +148,7 @@ static void ws_event_handler(void *arg, esp_event_base_t event_base,
switch (event_id) { switch (event_id) {
case WEBSOCKET_EVENT_CONNECTED: case WEBSOCKET_EVENT_CONNECTED:
ESP_LOGI(TAG, "WebSocket connected"); ESP_LOGI(TAG, "WebSocket connected");
s_last_data_tick = xTaskGetTickCount();
set_state(WS_STATE_CONNECTED); set_state(WS_STATE_CONNECTED);
break; break;
case WEBSOCKET_EVENT_DISCONNECTED: case WEBSOCKET_EVENT_DISCONNECTED:
@@ -132,6 +182,9 @@ void ws_client_init(const char *uri)
s_client = esp_websocket_client_init(&config); s_client = esp_websocket_client_init(&config);
esp_websocket_register_events(s_client, WEBSOCKET_EVENT_ANY, ws_event_handler, NULL); esp_websocket_register_events(s_client, WEBSOCKET_EVENT_ANY, ws_event_handler, NULL);
s_watchdog_timer = xTimerCreate("ws_wd", pdMS_TO_TICKS(WS_WATCHDOG_PERIOD_MS),
pdTRUE, NULL, watchdog_callback);
ESP_LOGI(TAG, "WS client initialized: %s", uri); ESP_LOGI(TAG, "WS client initialized: %s", uri);
} }
@@ -140,17 +193,31 @@ void ws_client_start(void)
if (s_client) { if (s_client) {
set_state(WS_STATE_CONNECTING); set_state(WS_STATE_CONNECTING);
esp_websocket_client_start(s_client); esp_websocket_client_start(s_client);
if (s_watchdog_timer) {
xTimerStart(s_watchdog_timer, 0);
}
} }
} }
void ws_client_stop(void) void ws_client_stop(void)
{ {
if (s_client) { if (s_client) {
if (s_watchdog_timer) {
xTimerStop(s_watchdog_timer, 0);
}
esp_websocket_client_stop(s_client); esp_websocket_client_stop(s_client);
set_state(WS_STATE_DISCONNECTED); set_state(WS_STATE_DISCONNECTED);
} }
} }
void ws_client_reconnect(void)
{
if (!s_client) return;
ESP_LOGI(TAG, "Manual WS reconnect triggered");
esp_websocket_client_close(s_client, pdMS_TO_TICKS(2000));
s_last_data_tick = xTaskGetTickCount();
}
ws_state_t ws_client_get_state(void) ws_state_t ws_client_get_state(void)
{ {
return s_state; return s_state;

View File

@@ -8,7 +8,7 @@
extern "C" { extern "C" {
#endif #endif
#define WS_MAX_SERVICES 8 #define WS_MAX_SERVICES 20
#define WS_SERVICE_NAME_LEN 16 #define WS_SERVICE_NAME_LEN 16
typedef enum { typedef enum {
@@ -18,9 +18,15 @@ typedef enum {
WS_STATE_ERROR, WS_STATE_ERROR,
} ws_state_t; } ws_state_t;
typedef enum {
SVC_STOPPED = 0,
SVC_WARNING,
SVC_RUNNING,
} ws_svc_status_t;
typedef struct { typedef struct {
char name[WS_SERVICE_NAME_LEN]; char name[WS_SERVICE_NAME_LEN];
bool running; ws_svc_status_t status;
} ws_service_t; } ws_service_t;
typedef struct { typedef struct {
@@ -36,6 +42,15 @@ typedef struct {
uint8_t service_count; uint8_t service_count;
uint32_t last_update; // timestamp from server uint32_t last_update; // timestamp from server
bool valid; // set true after first successful parse bool valid; // set true after first successful parse
/* Broken-down local time from Pi for RTC sync */
uint16_t time_year;
uint8_t time_month;
uint8_t time_day;
uint8_t time_hour;
uint8_t time_minute;
uint8_t time_second;
bool time_valid; // true when local_time object was parsed
} pi_stats_t; } pi_stats_t;
typedef void (*ws_data_callback_t)(const pi_stats_t *stats); typedef void (*ws_data_callback_t)(const pi_stats_t *stats);
@@ -44,6 +59,7 @@ typedef void (*ws_state_callback_t)(ws_state_t state);
void ws_client_init(const char *uri); void ws_client_init(const char *uri);
void ws_client_start(void); void ws_client_start(void);
void ws_client_stop(void); void ws_client_stop(void);
void ws_client_reconnect(void);
ws_state_t ws_client_get_state(void); ws_state_t ws_client_get_state(void);
void ws_client_get_stats(pi_stats_t *out); void ws_client_get_stats(pi_stats_t *out);
void ws_client_set_data_callback(ws_data_callback_t cb); void ws_client_set_data_callback(ws_data_callback_t cb);

View File

@@ -1,52 +0,0 @@
#!/usr/bin/env python3
"""Mock WebSocket server that sends randomized Pi stats every 2 seconds."""
import asyncio
import json
import random
import time
import websockets
def generate_stats():
services = [
{"name": "docker", "status": random.choice(["running", "running", "running", "stopped"])},
{"name": "pihole", "status": random.choice(["running", "running", "running", "stopped"])},
{"name": "nginx", "status": random.choice(["running", "running", "stopped"])},
{"name": "sshd", "status": "running"},
]
return {
"cpu_pct": round(random.uniform(5, 95), 1),
"mem_pct": round(random.uniform(30, 85), 1),
"mem_used_mb": random.randint(512, 3200),
"disk_pct": round(random.uniform(20, 80), 1),
"cpu_temp": round(random.uniform(35, 78), 1),
"uptime_hrs": round(random.uniform(1, 2000), 1),
"net_rx_kbps": round(random.uniform(0, 5000), 1),
"net_tx_kbps": round(random.uniform(0, 2000), 1),
"services": services,
"timestamp": int(time.time()),
}
async def handler(websocket):
addr = websocket.remote_address
print(f"Client connected: {addr}")
try:
while True:
stats = generate_stats()
await websocket.send(json.dumps(stats))
await asyncio.sleep(2)
except websockets.ConnectionClosed:
print(f"Client disconnected: {addr}")
async def main():
print("Mock Pi stats server starting on ws://0.0.0.0:8765")
async with websockets.serve(handler, "0.0.0.0", 8765):
await asyncio.Future() # run forever
if __name__ == "__main__":
asyncio.run(main())

View File

@@ -1 +0,0 @@
websockets>=12.0