Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion custom/integration/settings_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,10 @@ namespace custom::integration

void SettingsController::Impl::apply_current_theme()
{
settings_ui_apply(&config_, &ui_runtime_);
{
LvglLockGuard lock;
settings_ui_apply(&config_, &ui_runtime_);
}
ui_page_settings_apply_theme_state(config_.ui.theme == APP_CFG_UI_THEME_DARK,
current_variant_id().c_str());
}
Expand Down
6 changes: 3 additions & 3 deletions lv_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
*-----------*/

/*Enable the log module*/
#define LV_USE_LOG 0
#define LV_USE_LOG 1
#if LV_USE_LOG

/*How important log should be added:
Expand All @@ -271,11 +271,11 @@
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
*LV_LOG_LEVEL_USER Only logs added by the user
*LV_LOG_LEVEL_NONE Do not log anything*/
#define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
#define LV_LOG_LEVEL LV_LOG_LEVEL_INFO

/*1: Print the log with 'printf';
*0: User need to register a callback with `lv_log_register_print_cb()`*/
#define LV_LOG_PRINTF 0
#define LV_LOG_PRINTF 1

/*Set callback to print the logs.
*E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)`
Expand Down
4 changes: 2 additions & 2 deletions platforms/tab5/components/m5stack_tab5/m5stack_tab5.c
Original file line number Diff line number Diff line change
Expand Up @@ -1644,8 +1644,8 @@ static void lvgl_read_cb(lv_indev_t* indev, lv_indev_data_t* data)
{
ESP_LOGI(TAG,
"Touch rotation check: right edge press mapped to (%d,%d)",
transformed_x,
transformed_y);
(int)transformed_x,
(int)transformed_y);
logged_right_edge_ok = true;
}
}
Expand Down
56 changes: 43 additions & 13 deletions platforms/tab5/main/hal/hal_esp32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,26 +172,58 @@ void HalEsp32::init()
.buff_spiram = true,
.sw_rotate = true,
}};
lvDisp = bsp_display_start_with_config(&cfg);
lv_display_set_rotation(lvDisp, LV_DISPLAY_ROTATION_90);
lvDisp = bsp_display_start_with_config(&cfg);
bool display_locked = false;
if (lvDisp == nullptr)
{
mclog::tagError(_tag, "Failed to start LVGL display");
}
else
{
display_locked = bsp_display_lock(0);
if (!display_locked)
{
mclog::tagError(_tag, "Failed to lock LVGL port during display init");
}
else
{
lv_display_set_rotation(lvDisp, LV_DISPLAY_ROTATION_90);
mclog::tagInfo(_tag, "Display rotation set to 90 degrees");
}
}

bsp_display_backlight_on();

lvTouchpad = bsp_display_get_input_dev();
if (lvTouchpad == nullptr)
if (display_locked)
{
mclog::tagWarn(_tag, "LVGL touch input not provided by BSP; creating fallback driver");

lvTouchpad = lv_indev_create();
if (lvTouchpad == nullptr)
if (lvTouchpad != nullptr)
{
mclog::tagError(_tag, "Failed to allocate LVGL touch input device");
lv_indev_set_display(lvTouchpad, lvDisp);
}
else
{
lv_indev_set_type(lvTouchpad, LV_INDEV_TYPE_POINTER);
lv_indev_set_read_cb(lvTouchpad, lvgl_read_cb);
lv_indev_set_display(lvTouchpad, lvDisp);
mclog::tagWarn(_tag, "LVGL touch input not provided by BSP; creating fallback driver");

lvTouchpad = lv_indev_create();
if (lvTouchpad == nullptr)
{
mclog::tagError(_tag, "Failed to allocate LVGL touch input device");
}
else
{
lv_indev_set_type(lvTouchpad, LV_INDEV_TYPE_POINTER);
lv_indev_set_read_cb(lvTouchpad, lvgl_read_cb);
lv_indev_set_display(lvTouchpad, lvDisp);
}
}

bsp_display_unlock();
display_locked = false;
}
else if (lvTouchpad == nullptr)
{
mclog::tagError(_tag, "Touch input unavailable and LVGL lock not taken");
}

mclog::tagInfo(_tag, "usb host init");
Expand All @@ -205,8 +237,6 @@ void HalEsp32::init()

mclog::tagInfo(_tag, "set gpio output capability");
set_gpio_output_capability();

bsp_display_unlock();
}

void HalEsp32::set_gpio_output_capability()
Expand Down
Loading