Skip to content

Commit

Permalink
changes needed by lvgl 9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausMu committed Sep 28, 2024
1 parent 73a28f4 commit 5e3174f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <lvgl.h>
#include <stdlib.h>

void init_lvgl_HAL() {
// Workaround for sdl2 `-m32` crash
Expand Down
4 changes: 3 additions & 1 deletion Platformio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Platformio/src/applicationInternal/gui/guiStatusUpdate.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <lvgl.h>
#include <string.h>
#include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/memoryUsage.h"
#include "guis/gui_settings.h"
Expand Down
1 change: 1 addition & 0 deletions Platformio/src/applicationInternal/memoryUsage.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <lvgl.h>
#include <string.h>
#include "applicationInternal/gui/guiBase.h"
#include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/omote_log.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 5e3174f

Please sign in to comment.