Browse Source

Fix some LVGL bugs (#19904)

vanilla_fb_2.0.x
Victor Oliveira 4 years ago
committed by GitHub
parent
commit
75b0e3246a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.h
  2. 15
      Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp
  3. 2
      Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp
  4. 7
      Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp
  5. 7
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp
  6. 2
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h
  7. 2
      Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp
  8. 2
      Marlin/src/lcd/extui/lib/mks_ui/wifi_module.h

2
Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.h

@ -21,7 +21,7 @@
*/
#pragma once
#include "../../inc/MarlinConfigPre.h"
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI

15
Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp

@ -50,20 +50,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_about(void) {
scr = lv_screen_create(ABOUT_UI);
// Create an Image button
lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif
// Create a label on the image button
lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
if (gCfgItems.multiple_language) {
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN);
//fw_version = lv_label_create(scr, SHORT_BUILD_VERSION);
//lv_obj_align(fw_version, nullptr, LV_ALIGN_CENTER, 0, -60);

2
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp

@ -214,7 +214,7 @@ void lv_draw_dialog(uint8_t type) {
uiCfg.dialogType = type;
scr = lv_screen_create(DIALOG_UI);
lv_obj_t *labelDialog = lv_label_create_empty(scr);
lv_obj_t *labelDialog = lv_label_create(scr, "");
if (DIALOG_IS(TYPE_FINISH_PRINT, PAUSE_MESSAGE_RESUME)) {
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);

7
Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp

@ -208,11 +208,6 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_print_file(void) {
//uint8_t i;
uint8_t file_count;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PRINT_FILE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINT_FILE_UI;
}
disp_state = PRINT_FILE_UI;
curDirLever = 0;
dir_offset[curDirLever].curPage = 0;
@ -252,7 +247,7 @@ static char test_public_buf_l[40];
void disp_gcode_icon(uint8_t file_num) {
uint8_t i;
scr = lv_screen_create(MAIN_UI, "");
scr = lv_screen_create(PRINT_FILE_UI, "");
// Create image buttons
buttonPageUp = lv_imgbtn_create(scr, "F:/bmp_pageUp.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_P_UP);

7
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp

@ -1640,7 +1640,6 @@ lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char* title) {
disp_state_stack._disp_state[disp_state_stack._disp_index] = newScreenType;
}
disp_state = newScreenType;
lv_refr_now(lv_refr_get_disp_refreshing());
// title
lv_obj_t *titleLabel = nullptr;
@ -1651,18 +1650,22 @@ lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char* title) {
if (titleLabel)
lv_obj_set_style(titleLabel, &tft_style_label_rel);
lv_refr_now(lv_refr_get_disp_refreshing());
return scr;
}
// Create an empty label
lv_obj_t* lv_label_create_empty(lv_obj_t *par) {
return lv_label_create(par, (lv_obj_t*)nullptr);
lv_obj_t *label = lv_label_create(par, (lv_obj_t*)nullptr);
return label;
}
// Create a label with style and text
lv_obj_t* lv_label_create(lv_obj_t *par, const char *text) {
lv_obj_t *label = lv_label_create_empty(par);
if (text) lv_label_set_text(label, text);
lv_obj_set_style(label, &tft_style_label_rel);
return label;
}

2
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h

@ -86,7 +86,7 @@
#include "draw_wifi_tips.h"
#endif
#include "../../inc/MarlinConfigPre.h"
#include "../../../../inc/MarlinConfigPre.h"
#define FILE_SYS_USB 0
#define FILE_SYS_SD 1

2
Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp

@ -43,7 +43,7 @@
#include "../../../../MarlinCore.h"
#include "../../../../inc/MarlinConfig.h"
#include HAL_PATH(../../HAL, tft/xpt2046.h)
#include HAL_PATH(../../../../HAL, tft/xpt2046.h)
#include "../../../marlinui.h"
XPT2046 touch;

2
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.h

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */
#endif
#include "../../inc/MarlinConfigPre.h"
#include "../../../../inc/MarlinConfigPre.h"
#include <math.h>
#include <stdio.h>

Loading…
Cancel
Save