Browse Source

Fix some LVGL bugs (#19904)

Victor Oliveira 4 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
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
-#include "../../inc/MarlinConfigPre.h"
24
+#include "../../../../inc/MarlinConfigPre.h"
25
 
25
 
26
 #if HAS_TFT_LVGL_UI
26
 #if HAS_TFT_LVGL_UI
27
 
27
 

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

50
 
50
 
51
 void lv_draw_about(void) {
51
 void lv_draw_about(void) {
52
   scr = lv_screen_create(ABOUT_UI);
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
   //fw_version = lv_label_create(scr, SHORT_BUILD_VERSION);
55
   //fw_version = lv_label_create(scr, SHORT_BUILD_VERSION);
69
   //lv_obj_align(fw_version, nullptr, LV_ALIGN_CENTER, 0, -60);
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
   uiCfg.dialogType = type;
214
   uiCfg.dialogType = type;
215
   scr = lv_screen_create(DIALOG_UI);
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
   if (DIALOG_IS(TYPE_FINISH_PRINT, PAUSE_MESSAGE_RESUME)) {
219
   if (DIALOG_IS(TYPE_FINISH_PRINT, PAUSE_MESSAGE_RESUME)) {
220
       btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
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
 void lv_draw_print_file(void) {
208
 void lv_draw_print_file(void) {
209
   //uint8_t i;
209
   //uint8_t i;
210
   uint8_t file_count;
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
   curDirLever = 0;
212
   curDirLever = 0;
218
   dir_offset[curDirLever].curPage = 0;
213
   dir_offset[curDirLever].curPage = 0;
252
 void disp_gcode_icon(uint8_t file_num) {
247
 void disp_gcode_icon(uint8_t file_num) {
253
   uint8_t i;
248
   uint8_t i;
254
 
249
 
255
-  scr = lv_screen_create(MAIN_UI, "");
250
+  scr = lv_screen_create(PRINT_FILE_UI, "");
256
 
251
 
257
   // Create image buttons
252
   // Create image buttons
258
   buttonPageUp   = lv_imgbtn_create(scr, "F:/bmp_pageUp.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_P_UP);
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
     disp_state_stack._disp_state[disp_state_stack._disp_index] = newScreenType;
1640
     disp_state_stack._disp_state[disp_state_stack._disp_index] = newScreenType;
1641
   }
1641
   }
1642
   disp_state = newScreenType;
1642
   disp_state = newScreenType;
1643
-  lv_refr_now(lv_refr_get_disp_refreshing());
1644
 
1643
 
1645
   // title
1644
   // title
1646
   lv_obj_t *titleLabel = nullptr;
1645
   lv_obj_t *titleLabel = nullptr;
1651
   if (titleLabel)
1650
   if (titleLabel)
1652
     lv_obj_set_style(titleLabel, &tft_style_label_rel);
1651
     lv_obj_set_style(titleLabel, &tft_style_label_rel);
1653
 
1652
 
1653
+  lv_refr_now(lv_refr_get_disp_refreshing());
1654
+
1654
   return scr;
1655
   return scr;
1655
 }
1656
 }
1656
 
1657
 
1657
 // Create an empty label
1658
 // Create an empty label
1658
 lv_obj_t* lv_label_create_empty(lv_obj_t *par) {
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
 // Create a label with style and text
1664
 // Create a label with style and text
1663
 lv_obj_t* lv_label_create(lv_obj_t *par, const char *text) {
1665
 lv_obj_t* lv_label_create(lv_obj_t *par, const char *text) {
1664
   lv_obj_t *label = lv_label_create_empty(par);
1666
   lv_obj_t *label = lv_label_create_empty(par);
1665
   if (text) lv_label_set_text(label, text);
1667
   if (text) lv_label_set_text(label, text);
1668
+  lv_obj_set_style(label, &tft_style_label_rel);
1666
   return label;
1669
   return label;
1667
 }
1670
 }
1668
 
1671
 

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

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

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

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

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

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

Loading…
Cancel
Save