Decommission SquareLine: delete include/ui, theme set in display_init
Firmware / build (push) Successful in 4m1s

include/ui (SquareLine export: ui_init, placeholder screen, helpers, theme
manager, project metadata) is no longer used - every screen is hand-coded.
The one live line, the dark default LVGL theme, moves to display_init.cpp.
Build filter and include path drop include/ui. Comments, CLAUDE.md and the
stale README sections (features, layout, partitions) updated.

Verified on the board (USB, dev): Wi-Fi on/forget/scan/join, dark keyboard
and dialogs, update check + install of v0.1.5 from the screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-27 08:17:01 +02:00
parent 5d495f8ad1
commit 34b3fc7ec0
21 changed files with 42 additions and 918 deletions
-7
View File
@@ -1,7 +0,0 @@
SET(SOURCES ui_theme_manager.c
ui_themes.c
ui.c
components/ui_comp_hook.c
ui_helpers.c)
add_library(ui ${SOURCES})
-5
View File
@@ -1,5 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD
-5
View File
@@ -1,5 +0,0 @@
ui_theme_manager.c
ui_themes.c
ui.c
components/ui_comp_hook.c
ui_helpers.c
-9
View File
@@ -1,9 +0,0 @@
{
"project_name": "SquareLine_Project.spj",
"datetime": "2025-11-09T17:09:26.2274380+01:00",
"editor_version": "1.5.4",
"project_version": 60,
"user": "Goxhe Altin",
"export_datetime": "2025-11-09T17:09:28.3122290+01:00",
"export_user": "Goxhe Altin"
}
-44
View File
@@ -1,44 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#include "ui.h"
#include "ui_helpers.h"
///////////////////// VARIABLES ////////////////////
// EVENTS
lv_obj_t * ui____initial_actions0;
// IMAGES AND IMAGE SETS
///////////////////// TEST LVGL SETTINGS ////////////////////
#if LV_COLOR_DEPTH != 16
#error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings"
#endif
#if LV_COLOR_16_SWAP !=0
#error "LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings"
#endif
///////////////////// ANIMATIONS ////////////////////
///////////////////// FUNCTIONS ////////////////////
///////////////////// SCREENS ////////////////////
void ui_init(void)
{
lv_disp_t * dispp = lv_disp_get_default();
lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
true, LV_FONT_DEFAULT);
lv_disp_set_theme(dispp, theme);
// Home (2026-09-21) and Settings (2026-09-27) screens removed: every screen
// is hand-coded in src/modules; display_init.cpp shows the Driveline screen.
ui____initial_actions0 = lv_obj_create(NULL);
lv_disp_load_scr(ui____initial_actions0);
}
void ui_destroy(void)
{
}
-49
View File
@@ -1,49 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#ifndef _ESP32_S3_TOUCH_LCD_5B_UI_H
#define _ESP32_S3_TOUCH_LCD_5B_UI_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined __has_include
#if __has_include("lvgl.h")
#include "lvgl.h"
#elif __has_include("lvgl/lvgl.h")
#include "lvgl/lvgl.h"
#else
#include "lvgl.h"
#endif
#else
#include "lvgl.h"
#endif
#include "ui_helpers.h"
#include "ui_events.h"
#include "ui_theme_manager.h"
#include "ui_themes.h"
///////////////////// SCREENS ////////////////////
// None: every screen is hand-coded in src/modules (Driveline, Settings, Gauge
// Tuning). The SquareLine Settings screen was removed on 2026-09-27.
///////////////////// VARIABLES ////////////////////
// EVENTS
extern lv_obj_t * ui____initial_actions0;
// IMAGES AND IMAGE SETS
// UI INIT
void ui_init(void);
void ui_destroy(void);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
-18
View File
@@ -1,18 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#ifndef _UI_EVENTS_H
#define _UI_EVENTS_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
-262
View File
@@ -1,262 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#include "ui_helpers.h"
void _ui_bar_set_property(lv_obj_t * target, int id, int val)
{
if(id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON);
if(id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF);
}
void _ui_basic_set_property(lv_obj_t * target, int id, int val)
{
if(id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val);
if(id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val);
if(id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val);
if(id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val);
}
void _ui_dropdown_set_property(lv_obj_t * target, int id, int val)
{
if(id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val);
}
void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val)
{
if(id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val);
}
void _ui_label_set_property(lv_obj_t * target, int id, const char * val)
{
if(id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val);
}
void _ui_roller_set_property(lv_obj_t * target, int id, int val)
{
if(id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON);
if(id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF);
}
void _ui_slider_set_property(lv_obj_t * target, int id, int val)
{
if(id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON);
if(id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF);
}
void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void))
{
if(*target == NULL)
target_init();
lv_scr_load_anim(*target, fademode, spd, delay, false);
}
void _ui_arc_increment(lv_obj_t * target, int val)
{
int old = lv_arc_get_value(target);
lv_arc_set_value(target, old + val);
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0);
}
void _ui_bar_increment(lv_obj_t * target, int val, int anm)
{
int old = lv_bar_get_value(target);
lv_bar_set_value(target, old + val, anm);
}
void _ui_slider_increment(lv_obj_t * target, int val, int anm)
{
int old = lv_slider_get_value(target);
lv_slider_set_value(target, old + val, anm);
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0);
}
void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea)
{
lv_keyboard_set_textarea(keyboard, textarea);
}
void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value)
{
if(value == _UI_MODIFY_FLAG_TOGGLE) {
if(lv_obj_has_flag(target, flag)) lv_obj_clear_flag(target, flag);
else lv_obj_add_flag(target, flag);
}
else if(value == _UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target, flag);
else lv_obj_clear_flag(target, flag);
}
void _ui_state_modify(lv_obj_t * target, int32_t state, int value)
{
if(value == _UI_MODIFY_STATE_TOGGLE) {
if(lv_obj_has_state(target, state)) lv_obj_clear_state(target, state);
else lv_obj_add_state(target, state);
}
else if(value == _UI_MODIFY_STATE_ADD) lv_obj_add_state(target, state);
else lv_obj_clear_state(target, state);
}
void _ui_textarea_move_cursor(lv_obj_t * target, int val)
{
if(val == UI_MOVE_CURSOR_UP) lv_textarea_cursor_up(target);
if(val == UI_MOVE_CURSOR_RIGHT) lv_textarea_cursor_right(target);
if(val == UI_MOVE_CURSOR_DOWN) lv_textarea_cursor_down(target);
if(val == UI_MOVE_CURSOR_LEFT) lv_textarea_cursor_left(target);
lv_obj_add_state(target, LV_STATE_FOCUSED);
}
typedef void (*screen_destroy_cb_t)(void);
void scr_unloaded_delete_cb(lv_event_t * e)
{
// Get the destroy callback from user_data
screen_destroy_cb_t destroy_cb = lv_event_get_user_data(e);
if(destroy_cb) {
destroy_cb(); // call the specific screen destroy function
}
}
void _ui_opacity_set(lv_obj_t * target, int val)
{
lv_obj_set_style_opa(target, val, 0);
}
void _ui_anim_callback_free_user_data(lv_anim_t * a)
{
lv_mem_free(a->user_data);
a->user_data = NULL;
}
void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_obj_set_x(usr->target, v);
}
void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_obj_set_y(usr->target, v);
}
void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_obj_set_width(usr->target, v);
}
void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_obj_set_height(usr->target, v);
}
void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_obj_set_style_opa(usr->target, v, 0);
}
void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_img_set_zoom(usr->target, v);
}
void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_img_set_angle(usr->target, v);
}
void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
usr->val = v;
if(v < 0) v = 0;
if(v >= usr->imgset_size) v = usr->imgset_size - 1;
lv_img_set_src(usr->target, usr->imgset[v]);
}
int32_t _ui_anim_callback_get_x(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_obj_get_x_aligned(usr->target);
}
int32_t _ui_anim_callback_get_y(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_obj_get_y_aligned(usr->target);
}
int32_t _ui_anim_callback_get_width(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_obj_get_width(usr->target);
}
int32_t _ui_anim_callback_get_height(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_obj_get_height(usr->target);
}
int32_t _ui_anim_callback_get_opacity(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_obj_get_style_opa(usr->target, 0);
}
int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_img_get_zoom(usr->target);
}
int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_img_get_angle(usr->target);
}
int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return usr->val;
}
void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix)
{
char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE];
lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix);
lv_label_set_text(trg, buf);
}
void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix)
{
char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE];
lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix);
lv_label_set_text(trg, buf);
}
void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off)
{
if(lv_obj_has_state(src, LV_STATE_CHECKED)) lv_label_set_text(trg, txt_on);
else lv_label_set_text(trg, txt_off);
}
void _ui_spinbox_step(lv_obj_t * target, int val)
{
if(val > 0) lv_spinbox_increment(target);
else lv_spinbox_decrement(target);
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0);
}
void _ui_switch_theme(int val)
{
#ifdef UI_THEME_ACTIVE
ui_theme_set(val);
#endif
}
-131
View File
@@ -1,131 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#ifndef _ESP32_S3_TOUCH_LCD_5B_UI_HELPERS_H
#define _ESP32_S3_TOUCH_LCD_5B_UI_HELPERS_H
#ifdef __cplusplus
extern "C" {
#endif
#include "ui.h"
#define _UI_TEMPORARY_STRING_BUFFER_SIZE 32
#define _UI_BAR_PROPERTY_VALUE 0
#define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1
void _ui_bar_set_property(lv_obj_t * target, int id, int val);
#define _UI_BASIC_PROPERTY_POSITION_X 0
#define _UI_BASIC_PROPERTY_POSITION_Y 1
#define _UI_BASIC_PROPERTY_WIDTH 2
#define _UI_BASIC_PROPERTY_HEIGHT 3
void _ui_basic_set_property(lv_obj_t * target, int id, int val);
#define _UI_DROPDOWN_PROPERTY_SELECTED 0
void _ui_dropdown_set_property(lv_obj_t * target, int id, int val);
#define _UI_IMAGE_PROPERTY_IMAGE 0
void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val);
#define _UI_LABEL_PROPERTY_TEXT 0
void _ui_label_set_property(lv_obj_t * target, int id, const char * val);
#define _UI_ROLLER_PROPERTY_SELECTED 0
#define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1
void _ui_roller_set_property(lv_obj_t * target, int id, int val);
#define _UI_SLIDER_PROPERTY_VALUE 0
#define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1
void _ui_slider_set_property(lv_obj_t * target, int id, int val);
void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void));
void _ui_arc_increment(lv_obj_t * target, int val);
void _ui_bar_increment(lv_obj_t * target, int val, int anm);
void _ui_slider_increment(lv_obj_t * target, int val, int anm);
void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea);
#define _UI_MODIFY_FLAG_ADD 0
#define _UI_MODIFY_FLAG_REMOVE 1
#define _UI_MODIFY_FLAG_TOGGLE 2
void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value);
#define _UI_MODIFY_STATE_ADD 0
#define _UI_MODIFY_STATE_REMOVE 1
#define _UI_MODIFY_STATE_TOGGLE 2
void _ui_state_modify(lv_obj_t * target, int32_t state, int value);
#define UI_MOVE_CURSOR_UP 0
#define UI_MOVE_CURSOR_RIGHT 1
#define UI_MOVE_CURSOR_DOWN 2
#define UI_MOVE_CURSOR_LEFT 3
void _ui_textarea_move_cursor(lv_obj_t * target, int val)
;
void scr_unloaded_delete_cb(lv_event_t * e);
void _ui_opacity_set(lv_obj_t * target, int val);
/** Describes an animation*/
typedef struct _ui_anim_user_data_t {
lv_obj_t * target;
lv_img_dsc_t ** imgset;
int32_t imgset_size;
int32_t val;
} ui_anim_user_data_t;
void _ui_anim_callback_free_user_data(lv_anim_t * a);
void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v);
int32_t _ui_anim_callback_get_x(lv_anim_t * a);
int32_t _ui_anim_callback_get_y(lv_anim_t * a);
int32_t _ui_anim_callback_get_width(lv_anim_t * a);
int32_t _ui_anim_callback_get_height(lv_anim_t * a);
int32_t _ui_anim_callback_get_opacity(lv_anim_t * a);
int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a);
int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a);
int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a);
void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix);
void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix);
void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off);
void _ui_spinbox_step(lv_obj_t * target, int val)
;
void _ui_switch_theme(int val)
;
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
-209
View File
@@ -1,209 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.4.3+
// LVGL version: 8.3.11
// Project name: design
#include "ui.h"
_ui_local_style_t* _ui_local_styles;
uint32_t _ui_local_style_count = 0;
inline void ui_object_set_local_style_property
(lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, ui_style_variable_t value ) {
if ( object_p!=NULL /*&& lv_obj_is_valid(object_p)*/ ) {
lv_obj_set_local_style_prop( object_p, property, _ui_style_value_convert( property, value ), selector );
}
}
//Atomic function to set (and register) an LVGL local style-property for a given part+state (selector) of an object (widget) - can be used in many ways due to being atomic
void ui_object_set_themeable_style_property
(lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, const ui_theme_variable_t* theme_variable_p) {
static _ui_local_style_t* local_style_p;
static _ui_local_style_property_setting_t* property_setting_p;
if (object_p==NULL /*|| !lv_obj_is_valid(object_p)*/ || theme_variable_p==NULL) return;
local_style_p = _ui_local_style_create( theme_variable_p, true );
if (local_style_p == NULL) return;
property_setting_p = _ui_local_style_property_setting_create( local_style_p, object_p, selector, property );
if (property_setting_p == NULL) return;
lv_obj_set_local_style_prop( object_p, property, _ui_style_value_convert( property, ui_get_theme_value(theme_variable_p) ), selector ); //ui_object_set_local_style_property( object_p, selector, property, ui_get_theme_value(theme_variable_p) );
}
//This function goes through all registered style-property settings and if theme is changed, sets all of them to the theme. (If called periodically, it can follow change of values automatically.)
void _ui_theme_set_variable_styles (uint8_t mode) {
static uint8_t ui_theme_idx_previous = -1;
static uint32_t i, j;
static _ui_local_style_property_setting_t* property_setting_p;
static ui_style_variable_t style_value;
static ui_style_variable_t* style_variable_p;
uint8_t ui_Theme_Changed = (ui_theme_idx != ui_theme_idx_previous); ui_theme_idx_previous = ui_theme_idx;
for (i = 0; i < _ui_local_style_count; ++i) {
style_variable_p = _ui_local_styles[i].style_variable_p;
if (_ui_local_styles[i].is_themeable) style_value = ui_get_theme_value( style_variable_p );
else style_value = *style_variable_p;
if (style_variable_p != _ui_local_styles[i].previous_pointer || style_value != _ui_local_styles[i].previous_value
|| mode == UI_VARIABLE_STYLES_MODE_INIT || ui_Theme_Changed) {
_ui_local_styles[i].previous_pointer = style_variable_p; _ui_local_styles[i].previous_value = style_value;
property_setting_p = _ui_local_styles[i].style_property_settings; //first item of linked list
for (j = 0; j < _ui_local_styles[i].style_property_setting_count; ++j) {
if (property_setting_p->object_p != NULL) {
ui_object_set_local_style_property (
property_setting_p->object_p, property_setting_p->selector, property_setting_p->property, style_value
);
}
if (property_setting_p->next_p != NULL) property_setting_p = (_ui_local_style_property_setting_t*) property_setting_p->next_p; //get next item in linked-list for next round
else break; //this shouldn't happen, but if it does, it's assumed end of the list
}
}
}
}
ui_style_variable_t ui_get_theme_value(const ui_theme_variable_t* var) {
return var[ui_theme_idx];
}
lv_style_value_t _ui_style_value_convert (lv_style_prop_t property, ui_style_variable_t value) {
static lv_style_value_t Style_Value; //LVGL would produce artefacts if both .num and .color were set for the local style to add:
//static lv_style_const_prop_t ValueConvert_Table [_LV_STYLE_NUM_BUILT_IN_PROPS] = { [LV_STYLE_BG_COLOR] = LV_STYLE_CONST_BG_COLOR(1), [LV_STYLE_BG_OPA] = LV_STYLE_CONST_BG_OPA(1) };
if (property==LV_STYLE_BG_COLOR || property==LV_STYLE_BG_GRAD_COLOR || property==LV_STYLE_BG_IMG_RECOLOR || property==LV_STYLE_BORDER_COLOR
|| property==LV_STYLE_OUTLINE_COLOR || property==LV_STYLE_SHADOW_COLOR || property==LV_STYLE_IMG_RECOLOR || property==LV_STYLE_LINE_COLOR
|| property==LV_STYLE_ARC_COLOR || property==LV_STYLE_TEXT_COLOR) {
Style_Value.color = lv_color_hex(value);
}
else if (property==LV_STYLE_BG_GRAD || property==LV_STYLE_BG_IMG_SRC || property==LV_STYLE_ARC_IMG_SRC || property==LV_STYLE_TEXT_FONT
|| property==LV_STYLE_COLOR_FILTER_DSC || property==LV_STYLE_ANIM || property==LV_STYLE_TRANSITION) {
Style_Value.ptr = (void*)(uintptr_t) value;
}
else Style_Value.num = value;
return Style_Value;
}
//auto-update dynamic local style array with existing/new style-variable (1st dimension)
_ui_local_style_t* _ui_local_style_create (const ui_style_variable_t* style_variable_p, bool is_themeable) {
static uint32_t i;
static _ui_local_style_t* local_style_p;
for (i = 0; i < _ui_local_style_count; ++i) { //Find existing local style
if (_ui_local_styles[i].style_variable_p == style_variable_p) return &_ui_local_styles[i];
}
//If not found, create new local style
_ui_local_styles = (_ui_local_style_t*) lv_mem_realloc( _ui_local_styles, (_ui_local_style_count + 1) * sizeof(_ui_local_style_t) );
LV_ASSERT_MALLOC( _ui_local_styles );
if (_ui_local_styles == NULL) return NULL;
//Reset new local style
local_style_p = &_ui_local_styles[ _ui_local_style_count ];
local_style_p->style_variable_p = (ui_style_variable_t*) style_variable_p;
local_style_p->is_themeable = is_themeable;
local_style_p->previous_pointer = NULL;
local_style_p->previous_value = -1;
local_style_p->style_property_setting_count = 0;
local_style_p->style_property_settings = NULL;
/*#ifdef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD
local_style_p->garbage_collector_couter = 0;
#endif*/
++_ui_local_style_count;
return local_style_p;
}
void _ui_local_style_property_setting_delete (lv_event_t* event) { * (lv_obj_t**) lv_event_get_user_data( event ) = NULL; }
//auto-update dynamic local style-array's 2nd dimension (object part+state style-property settings for a given style-variable)
_ui_local_style_property_setting_t* _ui_local_style_property_setting_create
(_ui_local_style_t* local_style_p, lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property) {
static uint32_t i; //auto-update
static _ui_local_style_property_setting_t *style_property_setting_p, *empty_style_property_setting_p;
/*#ifdef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD
style_property_setting_p = local_style_p->style_property_settings; //first item of linked list
if (style_property_setting_p != NULL) { //checking might be unnecessary if count is properly initialized to 0
if (local_style_p->garbage_collector_couter > 0) --local_style_p->garbage_collector_couter; //avoid calling garbage collector every time
else if (LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD > 0) {
local_style_p->garbage_collector_couter = LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD - 1;
for (i = 0; i < local_style_p->style_property_setting_count; ++i) {
if (style_property_setting_p->object_p != NULL) { //check only valid object entry (skip already emptied positions{
#if ( defined(LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE) && LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE ) //Not recommended inside explicit garbage collector.
if ( style_property_setting_p->validcheck_counter > 0 ) --style_property_setting_p->validcheck_counter; //avoids calling complex lv_obj_is_valid() many times
else { //check objects with expired positive vaidity check
if ( lv_obj_is_valid( style_property_setting_p->object_p ) ) style_property_setting_p->validcheck_counter = LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE;
else style_property_setting_p->object_p = NULL; //free up an entry of a deleted widget
}
#else //this is the recommended variant inside explicit garbage collector:
if ( !lv_obj_is_valid( style_property_setting_p->object_p ) ) style_property_setting_p->object_p = NULL; //free up an entry of a deleted widget
#endif
}
if (style_property_setting_p->next_p != NULL) style_property_setting_p = (_ui_local_style_property_setting_t*) style_property_setting_p->next_p; //get next item in linked-list for next round
else break; //this shouldn't happen
}
}
}
#endif*/
style_property_setting_p = local_style_p->style_property_settings; //first item of linked list
empty_style_property_setting_p = NULL;
if (style_property_setting_p != NULL) { //checking might be unnecessary if count is properly initialized to 0
for (i = 0; i < local_style_p->style_property_setting_count; ++i) {
if (empty_style_property_setting_p == NULL) { //search and register one empty position that might be needed for a newly created entry
if (style_property_setting_p->object_p == NULL) empty_style_property_setting_p = style_property_setting_p; //if found empty position, register it
/*#ifdef LV_SQUARELINE_THEME__IMPLICIT_GARBAGE_COLLECTOR
else { //if not, check for possible empty positions of deleted objects (garbage-collection)
#if ( defined(LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE) && LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE ) //for slow hardware, adding this and setting to 5..10 in lv_conf.h might make it faster
if ( style_property_setting_p->validcheck_counter > 0 ) --style_property_setting_p->validcheck_counter; //avoids calling complex lv_obj_is_valid() many times
else { //check objects with expired positive vaidity check
if ( lv_obj_is_valid( style_property_setting_p->object_p ) ) style_property_setting_p->validcheck_counter = LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE;
else { //free up an entry of a deleted widget
style_property_setting_p->object_p = NULL;
empty_style_property_setting_p = style_property_setting_p;
}
}
#else
if ( !lv_obj_is_valid( style_property_setting_p->object_p ) ) { //free up an entry of a deleted widget
style_property_setting_p->object_p = NULL;
empty_style_property_setting_p = style_property_setting_p;
}
#endif
}
#endif*/
}
if (style_property_setting_p->object_p == object_p && style_property_setting_p->selector == selector
&& style_property_setting_p->property == property) { //setting found in the list (created already), so returning it
return style_property_setting_p;
}
if (style_property_setting_p->next_p != NULL) style_property_setting_p = (_ui_local_style_property_setting_t*) style_property_setting_p->next_p; //get next item in linked-list for next round
else break; //this shouldn't happen, but if it does, create a new element
}
}
//If not found, create new local style-property (can be inside the array at freed-up places of deleted objects too)
if (empty_style_property_setting_p == NULL) { //allocate new
empty_style_property_setting_p = (_ui_local_style_property_setting_t*) lv_mem_alloc( sizeof(_ui_local_style_property_setting_t) );
LV_ASSERT_MALLOC( empty_style_property_setting_p );
if (empty_style_property_setting_p == NULL) return NULL;
if (style_property_setting_p != NULL) style_property_setting_p->next_p = (void*) empty_style_property_setting_p; //create link from last item to the new
else local_style_p->style_property_settings = empty_style_property_setting_p; //(except if creating first item)
style_property_setting_p = empty_style_property_setting_p; //take the new item pointer for initialization
style_property_setting_p->next_p = NULL; //signify the end of the linked list, just in case
++local_style_p->style_property_setting_count;
}
else { //reuse empty
style_property_setting_p = empty_style_property_setting_p;
}
style_property_setting_p->object_p = object_p; lv_obj_add_event_cb( object_p, _ui_local_style_property_setting_delete, LV_EVENT_DELETE, &style_property_setting_p->object_p );
style_property_setting_p->selector = selector;
style_property_setting_p->property = property;
/*#ifdef LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE
style_property_setting_p->validcheck_counter = LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE; //0
#endif*/
return style_property_setting_p;
}
-75
View File
@@ -1,75 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.4.3+
#ifndef _UI_THEME_MANAGER_H
#define _UI_THEME_MANAGER_H
#ifdef __cplusplus
extern "C" {
#endif
#define UI_THEME_ACTIVE 1
/*#ifndef LV_SQUARELINE_THEME__IMPLICIT_GARBAGE_COLLECTOR
#ifndef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD //for slow hardware, tells how frequently the style-properties inside this style should be garbage-collected (recommended value: 10..100, 0:never)
#define LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD 100 //a sensible default value that already gives good results on slow hardware, can be overridden from outside
#endif
#endif*/
enum { UI_VARIABLE_STYLES_MODE_INIT = 1, UI_VARIABLE_STYLES_MODE_FOLLOW = 0 };
typedef int64_t ui_style_variable_t;
typedef ui_style_variable_t ui_theme_variable_t; //A 'theme' variable array is an array of 'style' variables for corresponding themes.
typedef struct {
lv_obj_t * object_p;
lv_style_selector_t selector;
lv_style_prop_t property;
/*#ifdef LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE //for slow hardware, adding this and setting to 5..10 in lv_conf.h might make it faster (less lv_obj_is_valid calls)
uint16_t validcheck_counter; //used for garbage collection (finding empty slots) not to call lv_obj_is_valid() every time
#endif*/
void * next_p;
} _ui_local_style_property_setting_t;
typedef struct {
bool is_themeable; //scalar or vector?
ui_style_variable_t * style_variable_p;
ui_style_variable_t * previous_pointer;
ui_style_variable_t previous_value;
uint32_t style_property_setting_count;
_ui_local_style_property_setting_t * style_property_settings;
/*#ifdef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD
uint16_t garbage_collector_couter;
#endif*/
} _ui_local_style_t;
extern _ui_local_style_t * _ui_local_styles;
extern uint32_t _ui_local_style_count;
void ui_object_set_local_style_property
(lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, ui_style_variable_t value );
void ui_object_set_themeable_style_property
(lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, const ui_theme_variable_t* theme_variable_p);
void _ui_theme_set_variable_styles (uint8_t mode);
lv_style_value_t _ui_style_value_convert (lv_style_prop_t property, ui_style_variable_t value);
ui_style_variable_t ui_get_theme_value (const ui_theme_variable_t *var);
_ui_local_style_t * _ui_local_style_create (const ui_style_variable_t * style_variable_p, bool is_themeable);
_ui_local_style_property_setting_t * _ui_local_style_property_setting_create
(_ui_local_style_t * local_style, lv_obj_t * object_p, lv_style_selector_t selector, lv_style_prop_t property);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
-17
View File
@@ -1,17 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#include "ui.h"
const ui_theme_variable_t _ui_theme_color_panel_backgroung[1] = {0x7F7A9C};
const ui_theme_variable_t _ui_theme_alpha_panel_backgroung[1] = {255};
uint8_t ui_theme_idx = UI_THEME_DEFAULT;
void ui_theme_set(uint8_t theme_idx)
{
ui_theme_idx = theme_idx;
_ui_theme_set_variable_styles(UI_VARIABLE_STYLES_MODE_FOLLOW);
}
-30
View File
@@ -1,30 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#ifndef _UI_THEMES_H
#define _UI_THEMES_H
#ifdef __cplusplus
extern "C" {
#endif
#define UI_THEME_COLOR_PANEL_BACKGROUNG 0
#define UI_THEME_DEFAULT 0
extern const ui_theme_variable_t _ui_theme_color_panel_backgroung[1];
extern const ui_theme_variable_t _ui_theme_alpha_panel_backgroung[1];
extern const uint32_t * ui_theme_colors[1];
extern const uint8_t * ui_theme_alphas[1];
extern uint8_t ui_theme_idx;
void ui_theme_set(uint8_t theme_idx);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif