Browse Source

Fix some LVGL bugs (#19904)

Victor Oliveira 3 years ago
parent
commit
75b0e3246a
No account linked to committer's email address

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.h View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
-#include "../../inc/MarlinConfigPre.h"
24
+#include "../../../../inc/MarlinConfigPre.h"
25 25
 
26 26
 #if HAS_TFT_LVGL_UI
27 27
 

+ 1
- 14
Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp View File

@@ -50,20 +50,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
50 50
 
51 51
 void lv_draw_about(void) {
52 52
   scr = lv_screen_create(ABOUT_UI);
53
-
54
-  // Create an Image button
55
-  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);
56
-  #if HAS_ROTARY_ENCODER
57
-    if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
58
-  #endif
59
-
60
-  // Create a label on the image button
61
-  lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
62
-
63
-  if (gCfgItems.multiple_language) {
64
-    lv_label_set_text(label_Back, common_menu.text_back);
65
-    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
66
-  }
53
+  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);
67 54
 
68 55
   //fw_version = lv_label_create(scr, SHORT_BUILD_VERSION);
69 56
   //lv_obj_align(fw_version, nullptr, LV_ALIGN_CENTER, 0, -60);

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp View File

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

+ 1
- 6
Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp View File

@@ -208,11 +208,6 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
208 208
 void lv_draw_print_file(void) {
209 209
   //uint8_t i;
210 210
   uint8_t file_count;
211
-  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PRINT_FILE_UI) {
212
-    disp_state_stack._disp_index++;
213
-    disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINT_FILE_UI;
214
-  }
215
-  disp_state = PRINT_FILE_UI;
216 211
 
217 212
   curDirLever = 0;
218 213
   dir_offset[curDirLever].curPage = 0;
@@ -252,7 +247,7 @@ static char test_public_buf_l[40];
252 247
 void disp_gcode_icon(uint8_t file_num) {
253 248
   uint8_t i;
254 249
 
255
-  scr = lv_screen_create(MAIN_UI, "");
250
+  scr = lv_screen_create(PRINT_FILE_UI, "");
256 251
 
257 252
   // Create image buttons
258 253
   buttonPageUp   = lv_imgbtn_create(scr, "F:/bmp_pageUp.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_P_UP);

+ 5
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp View File

@@ -1640,7 +1640,6 @@ lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char* title) {
1640 1640
     disp_state_stack._disp_state[disp_state_stack._disp_index] = newScreenType;
1641 1641
   }
1642 1642
   disp_state = newScreenType;
1643
-  lv_refr_now(lv_refr_get_disp_refreshing());
1644 1643
 
1645 1644
   // title
1646 1645
   lv_obj_t *titleLabel = nullptr;
@@ -1651,18 +1650,22 @@ lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char* title) {
1651 1650
   if (titleLabel)
1652 1651
     lv_obj_set_style(titleLabel, &tft_style_label_rel);
1653 1652
 
1653
+  lv_refr_now(lv_refr_get_disp_refreshing());
1654
+
1654 1655
   return scr;
1655 1656
 }
1656 1657
 
1657 1658
 // Create an empty label
1658 1659
 lv_obj_t* lv_label_create_empty(lv_obj_t *par) {
1659
-  return lv_label_create(par, (lv_obj_t*)nullptr);
1660
+  lv_obj_t *label = lv_label_create(par, (lv_obj_t*)nullptr);
1661
+  return label;
1660 1662
 }
1661 1663
 
1662 1664
 // Create a label with style and text
1663 1665
 lv_obj_t* lv_label_create(lv_obj_t *par, const char *text) {
1664 1666
   lv_obj_t *label = lv_label_create_empty(par);
1665 1667
   if (text) lv_label_set_text(label, text);
1668
+  lv_obj_set_style(label, &tft_style_label_rel);
1666 1669
   return label;
1667 1670
 }
1668 1671
 

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h View File

@@ -86,7 +86,7 @@
86 86
   #include "draw_wifi_tips.h"
87 87
 #endif
88 88
 
89
-#include "../../inc/MarlinConfigPre.h"
89
+#include "../../../../inc/MarlinConfigPre.h"
90 90
 #define FILE_SYS_USB  0
91 91
 #define FILE_SYS_SD 1
92 92
 

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp View File

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

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.h View File

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

Loading…
Cancel
Save