From 5e3174ff47e31766a7c6714f97e49e687e1cc9dd Mon Sep 17 00:00:00 2001 From: KlausMu Date: Sat, 28 Sep 2024 17:49:27 +0200 Subject: [PATCH] changes needed by lvgl 9.2 --- .../windows_linux/lvgl_hal_windows_linux.cpp | 1 + Platformio/platformio.ini | 4 +++- .../gui/guiStatusUpdate.cpp | 1 + .../src/applicationInternal/memoryUsage.cpp | 1 + .../device_yamahaAmp/gui_yamahaAmp.cpp | 2 +- .../gui_airconditioner.cpp | 20 +++++++++---------- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Platformio/hardware/windows_linux/lvgl_hal_windows_linux.cpp b/Platformio/hardware/windows_linux/lvgl_hal_windows_linux.cpp index 7080f74e..49dee3cd 100644 --- a/Platformio/hardware/windows_linux/lvgl_hal_windows_linux.cpp +++ b/Platformio/hardware/windows_linux/lvgl_hal_windows_linux.cpp @@ -1,4 +1,5 @@ #include +#include void init_lvgl_HAL() { // Workaround for sdl2 `-m32` crash diff --git a/Platformio/platformio.ini b/Platformio/platformio.ini index 0b8745fc..f23fc416 100644 --- a/Platformio/platformio.ini +++ b/Platformio/platformio.ini @@ -16,7 +16,7 @@ default_envs = esp32 custom_screen_width = 240 custom_screen_height = 320 lib_deps = - lvgl/lvgl@^9.1.0 + lvgl/lvgl@^9.2.0 build_flags = ;-- OMOTE ----------------------------------------------------------------- -D ENABLE_WIFI_AND_MQTT=1 @@ -77,6 +77,8 @@ build_flags = ;-D LV_USE_PERF_MONITOR=1 ;-D LV_USE_MEM_MONITOR=1 ;-D LV_USE_REFR_DEBUG=1 + ; --- needed since lvgl 9.2, https://github.com/lvgl/lvgl/issues/6631 + -D LV_USE_PRIVATE_API=1 [env:esp32] platform = espressif32 diff --git a/Platformio/src/applicationInternal/gui/guiStatusUpdate.cpp b/Platformio/src/applicationInternal/gui/guiStatusUpdate.cpp index e7c7408c..c12fcc0a 100644 --- a/Platformio/src/applicationInternal/gui/guiStatusUpdate.cpp +++ b/Platformio/src/applicationInternal/gui/guiStatusUpdate.cpp @@ -1,4 +1,5 @@ #include +#include #include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/memoryUsage.h" #include "guis/gui_settings.h" diff --git a/Platformio/src/applicationInternal/memoryUsage.cpp b/Platformio/src/applicationInternal/memoryUsage.cpp index 402e753c..f36d35b4 100644 --- a/Platformio/src/applicationInternal/memoryUsage.cpp +++ b/Platformio/src/applicationInternal/memoryUsage.cpp @@ -1,4 +1,5 @@ #include +#include #include "applicationInternal/gui/guiBase.h" #include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/omote_log.h" diff --git a/Platformio/src/devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.cpp b/Platformio/src/devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.cpp index 0d357626..3a865755 100644 --- a/Platformio/src/devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.cpp +++ b/Platformio/src/devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.cpp @@ -23,7 +23,7 @@ void create_tab_content_yamahaAmp(lv_obj_t* tab) { lv_obj_set_scrollbar_mode(tab, LV_SCROLLBAR_MODE_ACTIVE); // -- create a button for "standard" ---------------------------------------- - lv_obj_t* button = lv_btn_create(tab); + lv_obj_t* button = lv_button_create(tab); lv_obj_set_size(button, 80, 40); lv_obj_set_style_radius(button, 10, LV_PART_MAIN); lv_obj_set_style_bg_color(button, color_primary, LV_PART_MAIN); diff --git a/Platformio/src/devices_pool/misc/device_airconditioner/gui_airconditioner.cpp b/Platformio/src/devices_pool/misc/device_airconditioner/gui_airconditioner.cpp index 347cab45..8f396996 100644 --- a/Platformio/src/devices_pool/misc/device_airconditioner/gui_airconditioner.cpp +++ b/Platformio/src/devices_pool/misc/device_airconditioner/gui_airconditioner.cpp @@ -31,15 +31,15 @@ void update_timer_label(); void update_CF_label(); static void airConditioner_event_cb(lv_event_t* e) { - lv_obj_t* target = lv_event_get_target(e); - lv_obj_t* cont = lv_event_get_current_target(e); + lv_obj_t* target = (lv_obj_t*)lv_event_get_target(e); + lv_obj_t* cont = (lv_obj_t*)lv_event_get_current_target(e); if (target == cont) return; // stop if container was clicked int user_data = (intptr_t)(target->user_data); switch (user_data) { case 0: { - if (lv_obj_has_state(lv_event_get_target(e), LV_STATE_CHECKED)) { + if (lv_obj_has_state((lv_obj_t*)lv_event_get_target(e), LV_STATE_CHECKED)) { omote_log_i("Air conditioner: on\r\n"); airConditionerPAC_N81.set_onoff(true); } else { @@ -79,7 +79,7 @@ static void airConditioner_event_cb(lv_event_t* e) { break; } case 5: { - if (lv_obj_has_state(lv_event_get_target(e), LV_STATE_CHECKED)) { + if (lv_obj_has_state((lv_obj_t*)lv_event_get_target(e), LV_STATE_CHECKED)) { omote_log_i("Air conditioner: timer on\r\n"); airConditionerPAC_N81.set_timer(true); } else { @@ -108,7 +108,7 @@ static void airConditioner_event_cb(lv_event_t* e) { } static void airConditioner_dropdown_cb(lv_event_t* e) { - lv_obj_t* target = lv_event_get_target(e); + lv_obj_t* target = (lv_obj_t*)lv_event_get_target(e); uint16_t selected_index = lv_dropdown_get_selected(target); omote_log_i("Air conditioner: timer dropdown selected %d\r\n", selected_index); @@ -135,17 +135,17 @@ void update_CF_label() { lv_label_set_text(CFLabel, airConditionerPAC_N81.get_CF_str().c_str()); } -void create_label(lv_obj_t** label, lv_obj_t* tab, lv_coord_t x_ofs, lv_coord_t y_ofs) { +void create_label(lv_obj_t** label, lv_obj_t* tab, int32_t x_ofs, int32_t y_ofs) { *label = lv_label_create(tab); lv_obj_set_style_text_font(*label, &lv_font_montserrat_12, LV_PART_MAIN); lv_obj_align(*label, LV_ALIGN_TOP_LEFT, x_ofs, y_ofs); } -void create_button(lv_obj_t* tab, lv_coord_t width, lv_coord_t height, lv_coord_t x_ofs, lv_coord_t y_ofs, std::string text, uint8_t user_data) { +void create_button(lv_obj_t* tab, int32_t width, int32_t height, int32_t x_ofs, int32_t y_ofs, std::string text, uint8_t user_data) { lv_obj_t* obj; lv_obj_t* buttonLabel; - obj = lv_btn_create(tab); + obj = lv_button_create(tab); lv_obj_align(obj, LV_ALIGN_TOP_LEFT, x_ofs, y_ofs); lv_obj_set_size(obj, width, height); lv_obj_set_style_bg_color(obj, color_primary, LV_PART_MAIN); @@ -159,7 +159,7 @@ void create_button(lv_obj_t* tab, lv_coord_t width, lv_coord_t height, lv_coord_ lv_obj_center(buttonLabel); } -void create_switch(lv_obj_t* tab, lv_coord_t width, lv_coord_t height, lv_coord_t x_ofs, lv_coord_t y_ofs, uint8_t user_data) { +void create_switch(lv_obj_t* tab, int32_t width, int32_t height, int32_t x_ofs, int32_t y_ofs, uint8_t user_data) { lv_obj_t* obj = lv_switch_create(tab); lv_obj_align(obj, LV_ALIGN_TOP_LEFT, x_ofs, y_ofs); lv_obj_set_size(obj, width, height); @@ -168,7 +168,7 @@ void create_switch(lv_obj_t* tab, lv_coord_t width, lv_coord_t height, lv_coord_ lv_obj_set_user_data(obj,(void *)(intptr_t)user_data); // Add user data so we can identify which button caused the container event } -void create_dropdownTimer(lv_obj_t* tab, lv_coord_t width, lv_coord_t height, lv_coord_t x_ofs, lv_coord_t y_ofs, uint8_t user_data) { +void create_dropdownTimer(lv_obj_t* tab, int32_t width, int32_t height, int32_t x_ofs, int32_t y_ofs, uint8_t user_data) { lv_obj_t * dropdownTimer = lv_dropdown_create(tab); lv_dropdown_set_options(dropdownTimer, "0 h\n" "1 h\n" "2 h\n" "3 h\n" "4 h\n" "5 h\n" "6 h\n" "7 h\n" "8 h\n" "9 h\n" "10 h\n" "11 h\n" "12 h"); lv_obj_align(dropdownTimer, LV_ALIGN_TOP_LEFT, x_ofs, y_ofs);