diff --git a/src/gfx/lgfx.h b/include/boards/lgfx.h similarity index 100% rename from src/gfx/lgfx.h rename to include/boards/lgfx.h diff --git a/src/gfx/lv_setup.h b/include/boards/lv_setup.h similarity index 100% rename from src/gfx/lv_setup.h rename to include/boards/lv_setup.h diff --git a/platformio.ini b/platformio.ini index f5a39ba..9ddeb51 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,12 +20,13 @@ framework = arduino [env:wt32-sc01_plus] board = wt32-sc01_plus board_build.partitions = partitions.csv +build_src_filter = + +<*> ; include all sources + - ; except xyz specific implementations build_flags = -D CORE_DEBUG_LEVEL=4 - -D SCREEN_WIDTH=480 -D SCREEN_HEIGHT=320 -D ESP32S3 - -D WT32SC01PLUS -D BOARD_HAS_PSRAM -D ARDUINO_USB_CDC_ON_BOOT -D LV_CONF_INCLUDE_SIMPLE diff --git a/src/assets/os_railway_icon_lvgl.c b/src/assets/os_railway_icon.c similarity index 99% rename from src/assets/os_railway_icon_lvgl.c rename to src/assets/os_railway_icon.c index 63e52d0..8fdf555 100644 --- a/src/assets/os_railway_icon_lvgl.c +++ b/src/assets/os_railway_icon.c @@ -17,11 +17,11 @@ #define LV_ATTRIBUTE_MEM_ALIGN #endif -#ifndef LV_ATTRIBUTE_IMG_OS_RAILWAY_ICON_LVGL -#define LV_ATTRIBUTE_IMG_OS_RAILWAY_ICON_LVGL +#ifndef LV_ATTRIBUTE_IMG_OS_RAILWAY_ICON +#define LV_ATTRIBUTE_IMG_OS_RAILWAY_ICON #endif -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_OS_RAILWAY_ICON_LVGL uint8_t os_railway_icon_lvgl_map[] = { +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_OS_RAILWAY_ICON uint8_t os_railway_icon_map[] = { #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8 /*Pixel format: Alpha 8 bit, Red: 3 bit, Green: 3 bit, Blue: 2 bit*/ 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, 0x97, 0xff, @@ -995,12 +995,12 @@ const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_OS_RAILWA #endif }; -const lv_img_dsc_t os_railway_icon_lvgl = { +const lv_img_dsc_t os_railway_icon = { .header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA, .header.always_zero = 0, .header.reserved = 0, .header.w = 240, .header.h = 240, .data_size = 57600 * LV_IMG_PX_SIZE_ALPHA_BYTE, - .data = os_railway_icon_lvgl_map, + .data = os_railway_icon_map, }; diff --git a/src/gfx/lgfx.cpp b/src/boards/wt32-sc01_plus/lgfx.cpp similarity index 93% rename from src/gfx/lgfx.cpp rename to src/boards/wt32-sc01_plus/lgfx.cpp index 9b1c5b6..5e9322c 100644 --- a/src/gfx/lgfx.cpp +++ b/src/boards/wt32-sc01_plus/lgfx.cpp @@ -16,7 +16,7 @@ // along with this program. If not, see . // //---------------------------------------------------------------------------- -#include "gfx/lgfx.h" +#include "boards/lgfx.h" LGFX::LGFX() { @@ -47,8 +47,8 @@ LGFX::LGFX() cfg.pin_cs = -1; cfg.pin_rst = 4; cfg.pin_busy = -1; - cfg.panel_width = SCREEN_HEIGHT; - cfg.panel_height = SCREEN_WIDTH; + cfg.panel_width = 480; + cfg.panel_height = 320; cfg.offset_x = 0; cfg.offset_y = 0; cfg.offset_rotation = 0; @@ -59,8 +59,8 @@ LGFX::LGFX() cfg.rgb_order = false; cfg.dlen_16bit = false; cfg.bus_shared = true; - cfg.memory_width = SCREEN_HEIGHT; - cfg.memory_height = SCREEN_WIDTH; + cfg.memory_width = 480; + cfg.memory_height = 320; _panel_instance.config(cfg); } diff --git a/src/gfx/lv_setup.cpp b/src/boards/wt32-sc01_plus/lv_setup.cpp similarity index 94% rename from src/gfx/lv_setup.cpp rename to src/boards/wt32-sc01_plus/lv_setup.cpp index 2bbfed6..00956b8 100644 --- a/src/gfx/lv_setup.cpp +++ b/src/boards/wt32-sc01_plus/lv_setup.cpp @@ -16,14 +16,14 @@ // along with this program. If not, see . // //---------------------------------------------------------------------------- -#include "gfx/lv_setup.h" +#include "boards/lv_setup.h" #include -#include +#include "boards/lgfx.h" #include "lv_conf.h" -#define LV_BUF_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT) +#define LV_BUF_SIZE (480 * 320) LGFX tft; @@ -94,8 +94,8 @@ void lv_begin() static lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); - disp_drv.hor_res = SCREEN_WIDTH; - disp_drv.ver_res = SCREEN_HEIGHT; + disp_drv.hor_res = 480; + disp_drv.ver_res = 320; disp_drv.flush_cb = flush_cb; disp_drv.draw_buf = &draw_buf; lv_disp_drv_register(&disp_drv); diff --git a/src/main.cpp b/src/main.cpp index 74c9ee9..b380be7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,7 +20,7 @@ #include -#include "gfx/lv_setup.h" +#include "boards/lv_setup.h" #include "lv_i18n/lv_i18n.h" #include "ui/screens/launch_screen.h" diff --git a/src/ui/screens/launch_screen.cpp b/src/ui/screens/launch_screen.cpp index 29adcfe..1224a88 100644 --- a/src/ui/screens/launch_screen.cpp +++ b/src/ui/screens/launch_screen.cpp @@ -22,7 +22,7 @@ #include "lv_i18n/lv_i18n.h" #include "search_screen.h" -LV_IMG_DECLARE(os_railway_icon_lvgl); +LV_IMG_DECLARE(os_railway_icon); namespace LaunchScreen { @@ -46,7 +46,7 @@ namespace LaunchScreen lv_obj_set_style_bg_color(screen, backgroundColor, 0); auto *logo = lv_img_create(screen); - lv_img_set_src(logo, &os_railway_icon_lvgl); + lv_img_set_src(logo, &os_railway_icon); lv_obj_align(logo, LV_ALIGN_CENTER, 0, 0); auto *label = lv_label_create(screen); diff --git a/src/ui/screens/search_screen.cpp b/src/ui/screens/search_screen.cpp index a0bc595..c32e116 100644 --- a/src/ui/screens/search_screen.cpp +++ b/src/ui/screens/search_screen.cpp @@ -85,9 +85,9 @@ namespace SearchScreen lv_obj_clear_flag(search_screen, LV_OBJ_FLAG_SCROLLABLE); search_data_table = lv_table_create(search_screen); - lv_obj_set_size(search_data_table, SCREEN_WIDTH, SCREEN_HEIGHT); + lv_obj_set_size(search_data_table, lv_pct(100), lv_pct(100)); - lv_table_set_col_width(search_data_table, 0, SCREEN_WIDTH - 3); + lv_table_set_col_width(search_data_table, 0, lv_pct(100) - 3); lv_table_set_row_cnt(search_data_table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/ lv_table_set_col_cnt(search_data_table, 1);