Implement UI scaling and more (#501)

**New Features**
 * Runtime font accessors and new symbol fonts for text, launcher, statusbar, and shared icons.
 * Added font height base setting to device.properties
 * Text fonts now have 3 sizes: small, default, large

**Improvements**
 * Renamed `UiScale` to `UiDensity`
 * Statusbar, toolbar and many UI components now compute heights and spacing from fonts/density.
 * SSD1306 initialization sequence refined for more stable startup.
 * Multiple image assets replaced by symbol-font rendering.
 * Many layout improvements related to density, font scaling and icon scaling
 * Updated folder name capitalization for newer style
This commit is contained in:
Ken Van Hoeylandt
2026-02-15 01:41:47 +01:00
committed by GitHub
parent 72c9b2b113
commit 9a11e6f47b
264 changed files with 5923 additions and 494 deletions
@@ -0,0 +1,30 @@
#pragma once
#include <lvgl.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
enum LvglFontSize {
FONT_SIZE_SMALL,
FONT_SIZE_DEFAULT,
FONT_SIZE_LARGE,
};
const lv_font_t* lvgl_get_shared_icon_font();
uint32_t lvgl_get_shared_icon_font_height();
const lv_font_t* lvgl_get_text_font(enum LvglFontSize font_size);
uint32_t lvgl_get_text_font_height(enum LvglFontSize font_size);
const lv_font_t* lvgl_get_launcher_icon_font();
uint32_t lvgl_get_launcher_icon_font_height();
const lv_font_t* lvgl_get_statusbar_icon_font();
uint32_t lvgl_get_statusbar_icon_font_height();
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,91 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
/**
* @file lvgl_module.h
* @brief LVGL module for Tactility.
*
* This module manages the lifecycle of the LVGL library, including initialization,
* task management, and thread-safety.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
/**
* @brief The LVGL module instance.
*/
extern struct Module lvgl_module;
/**
* @brief Configuration for the LVGL module.
*/
struct LvglModuleConfig {
/**
* @brief Callback invoked when the LVGL task starts.
* Use this to add devices (e.g. displays, pointers), start services, create widgets, etc.
*/
void (*on_start)(void);
/**
* @brief Callback invoked when the LVGL task stops.
* Use this to remove devices, stop services, etc.
*/
void (*on_stop)(void);
/** @brief Priority of the LVGL task. */
int task_priority;
/** @brief Stack size of the LVGL task in bytes. */
int task_stack_size;
#ifdef ESP_PLATFORM
/** @brief CPU affinity of the LVGL task (ESP32 specific). */
int task_affinity;
#endif
};
/**
* @brief Configures the LVGL module.
*
* @warning This must be called before starting the module.
* @param config The configuration to apply.
*/
void lvgl_module_configure(struct LvglModuleConfig config);
/**
* @brief Locks the LVGL mutex.
*
* This should be called before any LVGL API calls from threads other than the LVGL task.
* It is a recursive mutex.
* @retval true when a lock was acquired, false otherwise
*/
bool lvgl_lock(void);
/**
* @brief Tries to lock the LVGL mutex with a timeout.
*
* @param timeout Timeout in ticks
* @return true if the lock was acquired, false otherwise.
*/
bool lvgl_try_lock_timed(uint32_t timeout);
/**
* @brief Unlocks the LVGL mutex.
*/
void lvgl_unlock(void);
/**
* @brief Checks if the LVGL module is currently running.
*
* @return true if running, false otherwise.
*/
bool lvgl_is_running(void);
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,5 @@
#pragma once
#define LVGL_SYMBOL_APPS "\xEE\x97\x83"
#define LVGL_SYMBOL_FOLDER "\xEE\x8B\x87"
#define LVGL_SYMBOL_SETTINGS "\xEE\xA2\xB8"
@@ -0,0 +1,44 @@
#pragma once
#define LVGL_SYMBOL_ADD "\xEE\x85\x85"
#define LVGL_SYMBOL_APPS "\xEE\x97\x83"
#define LVGL_SYMBOL_AREA_CHART "\xEE\x9D\xB0"
#define LVGL_SYMBOL_APP_REGISTRATION "\xEE\xBD\x80"
#define LVGL_SYMBOL_CALENDAR_MONTH "\xEE\xAF\x8C"
#define LVGL_SYMBOL_CABLE "\xEE\xBF\xA6"
#define LVGL_SYMBOL_CIRCLE "\xEE\xBD\x8A"
#define LVGL_SYMBOL_CLOSE "\xEE\x97\x8D"
#define LVGL_SYMBOL_CLOUD "\xEF\x85\x9C"
#define LVGL_SYMBOL_CHECK "\xEE\x97\x8A"
#define LVGL_SYMBOL_DELETE "\xEE\xA4\xAE"
#define LVGL_SYMBOL_DEVICES "\xEE\x8C\xA6"
#define LVGL_SYMBOL_DISPLAY_SETTINGS "\xEE\xAE\x97"
#define LVGL_SYMBOL_EDIT_NOTE "\xEE\x9D\x85"
#define LVGL_SYMBOL_ELECTRIC_BOLT "\xEE\xB0\x9C"
#define LVGL_SYMBOL_FOLDER "\xEE\x8B\x87"
#define LVGL_SYMBOL_DEPLOYED_CODE "\xEF\x9C\xA0"
#define LVGL_SYMBOL_DOWNLOAD "\xEF\x82\x90"
#define LVGL_SYMBOL_FORUM "\xEE\xA2\xAF"
#define LVGL_SYMBOL_GAMEPAD "\xEE\x8C\x8F"
#define LVGL_SYMBOL_HELP "\xEE\xA3\xBD"
#define LVGL_SYMBOL_HUB "\xEE\xA7\xB4"
#define LVGL_SYMBOL_IMAGE "\xEE\x8F\xB4"
#define LVGL_SYMBOL_KEYBOARD_ARROW_UP "\xEE\x8C\x96"
#define LVGL_SYMBOL_LIGHTBULB "\xEE\xA4\x8F"
#define LVGL_SYMBOL_LANGUAGE "\xEE\xA2\x94"
#define LVGL_SYMBOL_LISTS "\xEE\xA6\xB9"
#define LVGL_SYMBOL_MAIL "\xEE\x85\x99"
#define LVGL_SYMBOL_MENU "\xEE\x97\x92"
#define LVGL_SYMBOL_MOP "\xEE\x8A\x8D"
#define LVGL_SYMBOL_MORE_VERT "\xEE\x97\x94"
#define LVGL_SYMBOL_MUSIC_NOTE "\xEE\x90\x85"
#define LVGL_SYMBOL_NOTE_ADD "\xEE\xA2\x9C"
#define LVGL_SYMBOL_POWER_SETTINGS_NEW "\xEF\xA3\x87"
#define LVGL_SYMBOL_REFRESH "\xEE\x97\x95"
#define LVGL_SYMBOL_SEARCH "\xEE\xA2\xB6"
#define LVGL_SYMBOL_SETTINGS "\xEE\xA2\xB8"
#define LVGL_SYMBOL_TOOLBAR "\xEE\xA7\xB7"
#define LVGL_SYMBOL_NAVIGATION "\xEE\x95\x9D"
#define LVGL_SYMBOL_KEYBOARD_ALT "\xEF\x80\xA8"
#define LVGL_SYMBOL_USB "\xEE\x87\xA0"
#define LVGL_SYMBOL_WIFI "\xEE\x98\xBE"
@@ -0,0 +1,22 @@
#pragma once
#define LVGL_SYMBOL_LOCATION_ON "\xEF\x87\x9B"
#define LVGL_SYMBOL_CLOUD "\xEF\x85\x9C"
#define LVGL_SYMBOL_MEMORY "\xEE\x8C\xA2"
#define LVGL_SYMBOL_SD_CARD "\xEE\x98\xA3"
#define LVGL_SYMBOL_SD_CARD_ALERT "\xEF\x81\x97"
#define LVGL_SYMBOL_SIGNAL_WIFI_0_BAR "\xEF\x82\xB0"
#define LVGL_SYMBOL_NETWORK_WIFI_1_BAR "\xEE\xAF\xA4"
#define LVGL_SYMBOL_NETWORK_WIFI_2_BAR "\xEE\xAF\x96"
#define LVGL_SYMBOL_NETWORK_WIFI_3_BAR "\xEE\xAF\xA1"
#define LVGL_SYMBOL_SIGNAL_WIFI_4_BAR "\xEF\x81\xA5"
#define LVGL_SYMBOL_SIGNAL_WIFI_OFF "\xEE\x87\x9A"
#define LVGL_SYMBOL_SIGNAL_WIFI_BAD "\xEF\x81\xA4"
#define LVGL_SYMBOL_BATTERY_ANDROID_FRAME_1 "\xEF\x89\x97"
#define LVGL_SYMBOL_BATTERY_ANDROID_FRAME_2 "\xEF\x89\x96"
#define LVGL_SYMBOL_BATTERY_ANDROID_FRAME_3 "\xEF\x89\x95"
#define LVGL_SYMBOL_BATTERY_ANDROID_FRAME_4 "\xEF\x89\x94"
#define LVGL_SYMBOL_BATTERY_ANDROID_FRAME_5 "\xEF\x89\x93"
#define LVGL_SYMBOL_BATTERY_ANDROID_FRAME_6 "\xEF\x89\x92"
#define LVGL_SYMBOL_BATTERY_ANDROID_FRAME_FULL "\xEF\x89\x8F"
#define LVGL_SYMBOL_BATTERY_ANDROID_FRAME_BOLT "\xEF\x89\x90"