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:
committed by
GitHub
parent
72c9b2b113
commit
9a11e6f47b
@@ -1,17 +1,17 @@
|
||||
idf_component_register(
|
||||
INCLUDE_DIRS
|
||||
"Libraries/TactilityC/Include"
|
||||
"Libraries/TactilityKernel/Include"
|
||||
"Libraries/TactilityFreeRtos/Include"
|
||||
"Libraries/lvgl/Include"
|
||||
"Libraries/lvgl-module/Include"
|
||||
"Libraries/TactilityC/include"
|
||||
"Libraries/TactilityKernel/include"
|
||||
"Libraries/TactilityFreeRtos/include"
|
||||
"Libraries/lvgl/include"
|
||||
"Libraries/lvgl-module/include"
|
||||
REQUIRES esp_timer
|
||||
)
|
||||
|
||||
add_prebuilt_library(TactilityC Libraries/TactilityC/Binary/libTactilityC.a)
|
||||
add_prebuilt_library(TactilityKernel Libraries/TactilityKernel/Binary/libTactilityKernel.a)
|
||||
add_prebuilt_library(lvgl Libraries/lvgl/Binary/liblvgl.a)
|
||||
add_prebuilt_library(lvgl-module Libraries/lvgl-module/Binary/liblvgl-module.a)
|
||||
add_prebuilt_library(TactilityC Libraries/TactilityC/binary/libTactilityC.a)
|
||||
add_prebuilt_library(TactilityKernel Libraries/TactilityKernel/binary/libTactilityKernel.a)
|
||||
add_prebuilt_library(lvgl Libraries/lvgl/binary/liblvgl.a)
|
||||
add_prebuilt_library(lvgl-module Libraries/lvgl-module/binary/liblvgl-module.a)
|
||||
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityC)
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityKernel)
|
||||
|
||||
@@ -7,23 +7,13 @@ else ()
|
||||
set(Cyan "")
|
||||
endif ()
|
||||
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/properties.cmake")
|
||||
|
||||
function(INIT_TACTILITY_GLOBALS SDKCONFIG_FILE)
|
||||
get_filename_component(SDKCONFIG_FILE_ABS ${SDKCONFIG_FILE} ABSOLUTE)
|
||||
# Find the device identifier in the sdkconfig file
|
||||
if (NOT EXISTS ${SDKCONFIG_FILE_ABS})
|
||||
message(FATAL_ERROR "sdkconfig file not found:\nMake sure you select a device by running \"python device.py [device-id]\"\n")
|
||||
endif ()
|
||||
file(READ ${SDKCONFIG_FILE_ABS} sdkconfig_text)
|
||||
string(REGEX MATCH "(CONFIG_TT_DEVICE_ID\=\"[^\"]*\")" sdkconfig_device_id "${sdkconfig_text}")
|
||||
if (sdkconfig_device_id STREQUAL "CONFIG_TT_DEVICE_ID=\"\"" OR sdkconfig_device_id STREQUAL "")
|
||||
message(FATAL_ERROR "CONFIG_TT_DEVICE_ID not found in sdkconfig:\nMake sure you select a device with 'python device.py device-id'")
|
||||
endif ()
|
||||
string(LENGTH ${sdkconfig_device_id} sdkconfig_device_id_length)
|
||||
set(id_length 0)
|
||||
# Total length minus chars of 'CONFIG_TT_DEVICE_ID=""'
|
||||
math(EXPR id_length "${sdkconfig_device_id_length} - 22")
|
||||
# Skip 'CONFIG_TT_DEVICE_ID="' then read the relevant (remaining) chars
|
||||
string(SUBSTRING ${sdkconfig_device_id} 21 ${id_length} device_id)
|
||||
GET_PROPERTY_FILE_CONTENT(${SDKCONFIG_FILE} sdkconfig_text)
|
||||
# Get device id
|
||||
GET_PROPERTY_VALUE(sdkconfig_text "CONFIG_TT_DEVICE_ID" device_id)
|
||||
# Validate device id
|
||||
if (NOT device_id MATCHES "^[a-z0-9\-]*$")
|
||||
message(FATAL_ERROR "Device identifier ${device_id} contains invalid characters. Valid characters: a-z 0-9 \"-\"")
|
||||
@@ -31,7 +21,8 @@ function(INIT_TACTILITY_GLOBALS SDKCONFIG_FILE)
|
||||
# Output results
|
||||
message("Device identifier: ${Cyan}${device_id}${ColorReset}")
|
||||
set(TACTILITY_DEVICE_PROJECT ${device_id})
|
||||
message("Device project path: ${Cyan}Devices/${TACTILITY_DEVICE_PROJECT}${ColorReset}\n")
|
||||
message("Device project path: ${Cyan}Devices/${TACTILITY_DEVICE_PROJECT}${ColorReset} ")
|
||||
message("")
|
||||
set_property(GLOBAL PROPERTY TACTILITY_DEVICE_PROJECT ${TACTILITY_DEVICE_PROJECT})
|
||||
set_property(GLOBAL PROPERTY TACTILITY_DEVICE_ID ${device_id})
|
||||
endfunction()
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
function(GET_PROPERTY_VALUE PROPERTIES_CONTENT_VAR KEY_NAME RESULT_VAR)
|
||||
# Search for the key and its value in the properties content
|
||||
# Supports KEY=VALUE, KEY="VALUE", and optional spaces around =
|
||||
# Use parentheses to capture the value
|
||||
# We use ^ and $ with multiline if available, but string(REGEX) doesn't support them easily for lines.
|
||||
# So we look for the key at the beginning of the string or after a newline.
|
||||
if ("${${PROPERTIES_CONTENT_VAR}}" MATCHES "(^|\n)${KEY_NAME}[ \t]*=[ \t]*\"?([^\n\"]*)\"?")
|
||||
set(${RESULT_VAR} "${CMAKE_MATCH_2}" PARENT_SCOPE)
|
||||
else ()
|
||||
message(FATAL_ERROR "Property '${KEY_NAME}' not found in the properties content.")
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
function(GET_PROPERTY_FILE_CONTENT PROPERTY_FILE RESULT_VAR)
|
||||
get_filename_component(PROPERTY_FILE_ABS ${PROPERTY_FILE} ABSOLUTE)
|
||||
# Find the device identifier in the sdkconfig file
|
||||
if (NOT EXISTS ${PROPERTY_FILE_ABS})
|
||||
message(FATAL_ERROR "Property file not found: ${PROPERTY_FILE}\nMake sure you select a device by running \"python device.py [device-id]\"\n")
|
||||
endif ()
|
||||
file(READ ${PROPERTY_FILE_ABS} file_content)
|
||||
set(${RESULT_VAR} "${file_content}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
+12
-12
@@ -73,31 +73,31 @@ def main():
|
||||
mappings = [
|
||||
{'src': 'version.txt', 'dst': ''},
|
||||
# TactilityC
|
||||
{'src': 'build/esp-idf/TactilityC/libTactilityC.a', 'dst': 'Libraries/TactilityC/Binary/'},
|
||||
{'src': 'TactilityC/Include/*', 'dst': 'Libraries/TactilityC/Include/'},
|
||||
{'src': 'build/esp-idf/TactilityC/libTactilityC.a', 'dst': 'Libraries/TactilityC/binary/'},
|
||||
{'src': 'TactilityC/Include/*', 'dst': 'Libraries/TactilityC/include/'},
|
||||
{'src': 'TactilityC/CMakeLists.txt', 'dst': 'Libraries/TactilityC/'},
|
||||
{'src': 'TactilityC/LICENSE*.*', 'dst': 'Libraries/TactilityC/'},
|
||||
# TactilityFreeRtos
|
||||
{'src': 'TactilityFreeRtos/Include/**', 'dst': 'Libraries/TactilityFreeRtos/Include/'},
|
||||
{'src': 'TactilityFreeRtos/Include/**', 'dst': 'Libraries/TactilityFreeRtos/include/'},
|
||||
{'src': 'TactilityFreeRtos/CMakeLists.txt', 'dst': 'Libraries/TactilityFreeRtos/'},
|
||||
{'src': 'TactilityFreeRtos/LICENSE*.*', 'dst': 'Libraries/TactilityFreeRtos/'},
|
||||
# TactilityKernel
|
||||
{'src': 'build/esp-idf/TactilityKernel/libTactilityKernel.a', 'dst': 'Libraries/TactilityKernel/Binary/'},
|
||||
{'src': 'TactilityKernel/Include/**', 'dst': 'Libraries/TactilityKernel/Include/'},
|
||||
{'src': 'build/esp-idf/TactilityKernel/libTactilityKernel.a', 'dst': 'Libraries/TactilityKernel/binary/'},
|
||||
{'src': 'TactilityKernel/include/**', 'dst': 'Libraries/TactilityKernel/include/'},
|
||||
{'src': 'TactilityKernel/CMakeLists.txt', 'dst': 'Libraries/TactilityKernel/'},
|
||||
{'src': 'TactilityKernel/LICENSE*.*', 'dst': 'Libraries/TactilityKernel/'},
|
||||
# lvgl-module
|
||||
{'src': 'build/esp-idf/lvgl-module/liblvgl-module.a', 'dst': 'Libraries/lvgl-module/Binary/'},
|
||||
{'src': 'Modules/lvgl-module/Include/**', 'dst': 'Libraries/lvgl-module/Include/'},
|
||||
{'src': 'build/esp-idf/lvgl-module/liblvgl-module.a', 'dst': 'Libraries/lvgl-module/binary/'},
|
||||
{'src': 'Modules/lvgl-module/include/**', 'dst': 'Libraries/lvgl-module/include/'},
|
||||
{'src': 'Modules/lvgl-module/CMakeLists.txt', 'dst': 'Libraries/lvgl-module/'},
|
||||
{'src': 'Modules/lvgl-module/LICENSE*.*', 'dst': 'Libraries/lvgl-module/'},
|
||||
# lvgl (basics)
|
||||
{'src': 'build/esp-idf/lvgl__lvgl/liblvgl__lvgl.a', 'dst': 'Libraries/lvgl/Binary/liblvgl.a'},
|
||||
{'src': 'Libraries/lvgl/lvgl.h', 'dst': 'Libraries/lvgl/Include/'},
|
||||
{'src': 'Libraries/lvgl/lv_version.h', 'dst': 'Libraries/lvgl/Include/'},
|
||||
{'src': 'build/esp-idf/lvgl__lvgl/liblvgl__lvgl.a', 'dst': 'Libraries/lvgl/binary/liblvgl.a'},
|
||||
{'src': 'Libraries/lvgl/lvgl.h', 'dst': 'Libraries/lvgl/include/'},
|
||||
{'src': 'Libraries/lvgl/lv_version.h', 'dst': 'Libraries/lvgl/include/'},
|
||||
{'src': 'Libraries/lvgl/LICENCE*.*', 'dst': 'Libraries/lvgl/'},
|
||||
{'src': 'Libraries/lvgl/src/lv_conf_kconfig.h', 'dst': 'Libraries/lvgl/Include/lv_conf.h'},
|
||||
{'src': 'Libraries/lvgl/src/**/*.h', 'dst': 'Libraries/lvgl/Include/src/'},
|
||||
{'src': 'Libraries/lvgl/src/lv_conf_kconfig.h', 'dst': 'Libraries/lvgl/include/lv_conf.h'},
|
||||
{'src': 'Libraries/lvgl/src/**/*.h', 'dst': 'Libraries/lvgl/include/src/'},
|
||||
# elf_loader
|
||||
{'src': 'Libraries/elf_loader/elf_loader.cmake', 'dst': 'Libraries/elf_loader/'},
|
||||
{'src': 'Libraries/elf_loader/license.txt', 'dst': 'Libraries/elf_loader/'},
|
||||
|
||||
@@ -11,8 +11,6 @@ CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
|
||||
# EmbedTLS
|
||||
CONFIG_MBEDTLS_SSL_PROTO_TLS1_3=y
|
||||
# LVGL
|
||||
CONFIG_LV_FONT_MONTSERRAT_14=y
|
||||
CONFIG_LV_FONT_MONTSERRAT_18=y
|
||||
CONFIG_LV_USE_USER_DATA=y
|
||||
CONFIG_LV_USE_FS_STDIO=y
|
||||
CONFIG_LV_FS_STDIO_LETTER=65
|
||||
|
||||
Reference in New Issue
Block a user