Parcourir la source

Fix UI compile issues (#20092)

Victor Oliveira il y a 3 ans
Parent
révision
f8ee6f8b31
Aucun compte lié à l'adresse e-mail de l'auteur

+ 1
- 1
Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp Voir le fichier

@@ -55,7 +55,7 @@
55 55
 
56 56
 #include "../../inc/MarlinConfigPre.h"
57 57
 
58
-#if HAS_MARLINUI_U8GLIB
58
+#if HAS_MARLINUI_U8GLIB && DISABLED(TFT_CLASSIC_UI)
59 59
 
60 60
 #include "HAL_LCD_com_defines.h"
61 61
 

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp Voir le fichier

@@ -181,7 +181,7 @@ static void disp_language(uint8_t language, uint8_t state) {
181 181
 
182 182
   strcat_P(public_buf_l, PSTR(".bin"));
183 183
 
184
-  lv_obj_set_event_cb_mks(obj, event_handler, id, nullptr, 0);
184
+  lv_obj_set_event_cb_mks(obj, event_handler, id, "", 0);
185 185
   lv_imgbtn_set_src_both(obj, public_buf_l);
186 186
 
187 187
   if (state == UNSELECTED) lv_obj_refresh_ext_draw_pad(obj);

+ 5
- 5
Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp Voir le fichier

@@ -279,7 +279,7 @@ void disp_gcode_icon(uint8_t file_num) {
279 279
       cutFileName((char *)list_file.long_name[i], 16, 8, (char *)public_buf_m);
280 280
 
281 281
       if (list_file.IsFolder[i]) {
282
-        lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), nullptr, 0);
282
+        lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "", 0);
283 283
         lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_dir.bin");
284 284
         if (i < 3)
285 285
           lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight);
@@ -298,7 +298,7 @@ void disp_gcode_icon(uint8_t file_num) {
298 298
           strcat(test_public_buf_l, list_file.file_name[i]);
299 299
           char *temp = strstr(test_public_buf_l, ".GCO");
300 300
           if (temp) strcpy(temp, ".bin");
301
-          lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), nullptr, 0);
301
+          lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "", 0);
302 302
           lv_imgbtn_set_src_both(buttonGcode[i], test_public_buf_l);
303 303
           if (i < 3) {
304 304
             lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET);
@@ -308,7 +308,7 @@ void disp_gcode_icon(uint8_t file_num) {
308 308
             lv_btn_use_label_style(buttonText[i]);
309 309
             lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
310 310
             lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
311
-            //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),nullptr, 0);
311
+            //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),"", 0);
312 312
             lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET + 100);
313 313
             lv_obj_set_size(buttonText[i], 100, 40);
314 314
           }
@@ -320,7 +320,7 @@ void disp_gcode_icon(uint8_t file_num) {
320 320
             lv_btn_use_label_style(buttonText[i]);
321 321
             lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
322 322
             lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
323
-            //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),nullptr, 0);
323
+            //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),"", 0);
324 324
             lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1) + FILE_PRE_PIC_X_OFFSET, BTN_Y_PIXEL + INTERVAL_H + titleHeight + FILE_PRE_PIC_Y_OFFSET + 100);
325 325
             lv_obj_set_size(buttonText[i], 100, 40);
326 326
           }
@@ -328,7 +328,7 @@ void disp_gcode_icon(uint8_t file_num) {
328 328
           lv_obj_align(labelPageUp[i], buttonText[i], LV_ALIGN_IN_BOTTOM_MID, 0, 0);
329 329
         }
330 330
         else {
331
-          lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), nullptr, 0);
331
+          lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "", 0);
332 332
           lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_file.bin");
333 333
           if (i < 3)
334 334
             lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight);

+ 3
- 3
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp Voir le fichier

@@ -1680,7 +1680,7 @@ lv_obj_t* lv_label_create(lv_obj_t *par, lv_coord_t x, lv_coord_t y, const char
1680 1680
 lv_obj_t* lv_btn_create(lv_obj_t *par, lv_event_cb_t cb, const int id/*=0*/, lv_style_t *style/*=&style_para_value*/) {
1681 1681
   lv_obj_t *btn = lv_btn_create(par, nullptr);
1682 1682
   if (id)
1683
-    lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0);
1683
+    lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
1684 1684
   else
1685 1685
     lv_obj_set_event_cb(btn, cb);
1686 1686
   lv_btn_set_style_both(btn, style);
@@ -1748,7 +1748,7 @@ lv_obj_t* lv_imgbtn_create(lv_obj_t *par, const char *img, lv_event_cb_t cb, con
1748 1748
   lv_obj_t *btn = lv_imgbtn_create(par, nullptr);
1749 1749
   if (img) lv_imgbtn_set_src_both(btn, img);
1750 1750
   if (id)
1751
-    lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0);
1751
+    lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
1752 1752
   else
1753 1753
     lv_obj_set_event_cb(btn, cb);
1754 1754
   lv_imgbtn_use_label_style(btn);
@@ -1785,7 +1785,7 @@ lv_obj_t* lv_screen_menu_item(lv_obj_t *par, const char *text, lv_coord_t x, lv_
1785 1785
   lv_obj_t *btn = lv_btn_create(par, nullptr);   /*Add a button the current screen*/
1786 1786
   lv_obj_set_pos(btn, x, y);                         /*Set its position*/
1787 1787
   lv_obj_set_size(btn, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);                       /*Set its size*/
1788
-  if (id > -1) lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0);
1788
+  if (id > -1) lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
1789 1789
   lv_btn_use_label_style(btn);
1790 1790
   lv_btn_set_layout(btn, LV_LAYOUT_OFF);
1791 1791
   lv_obj_t *label = lv_label_create_empty(btn);        /*Add a label to the button*/

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp Voir le fichier

@@ -73,7 +73,7 @@ void lv_draw_wifi(void) {
73 73
 
74 74
     buttonReconnect = lv_imgbtn_create(scr, nullptr);
75 75
 
76
-    lv_obj_set_event_cb_mks(buttonReconnect, event_handler, ID_W_RECONNECT, nullptr, 0);
76
+    lv_obj_set_event_cb_mks(buttonReconnect, event_handler, ID_W_RECONNECT, "", 0);
77 77
     lv_imgbtn_set_src_both(buttonReconnect, "F:/bmp_wifi.bin");
78 78
     lv_imgbtn_use_label_style(buttonReconnect);
79 79
 

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.cpp Voir le fichier

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if HAS_TFT_LVGL_UI
24
+#if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
25 25
 
26 26
 #include "draw_ui.h"
27 27
 #include "wifi_module.h"
@@ -822,4 +822,4 @@ int32_t wifi_upload(int type) {
822 822
   return esp_upload.uploadResult == success ? 0 : -1;
823 823
 }
824 824
 
825
-#endif  // HAS_TFT_LVGL_UI
825
+#endif // HAS_TFT_LVGL_UI && USE_WIFI_FUNCTION

+ 1
- 1
Marlin/src/lcd/lcdprint.cpp Voir le fichier

@@ -26,7 +26,7 @@
26 26
 
27 27
 #include "../inc/MarlinConfigPre.h"
28 28
 
29
-#if HAS_WIRED_LCD
29
+#if HAS_WIRED_LCD && !HAS_GRAPHICAL_TFT
30 30
 
31 31
 #include "lcdprint.h"
32 32
 

+ 58
- 54
Marlin/src/lcd/marlinui.cpp Voir le fichier

@@ -262,67 +262,71 @@ millis_t MarlinUI::next_button_update_ms; // = 0
262 262
 
263 263
   #endif
264 264
 
265
-  void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, bool wordwrap/*=false*/) {
266
-    SETCURSOR(col, row);
267
-    if (!string) return;
268
-
269
-    auto _newline = [&col, &row]{
270
-      col = 0; row++;                 // Move col to string len (plus space)
271
-      SETCURSOR(0, row);              // Simulate carriage return
272
-    };
273
-
274
-    uint8_t *p = (uint8_t*)string;
275
-    wchar_t ch;
276
-    if (wordwrap) {
277
-      uint8_t *wrd = nullptr, c = 0;
278
-      // find the end of the part
279
-      for (;;) {
280
-        if (!wrd) wrd = p;            // Get word start /before/ advancing
281
-        p = get_utf8_value_cb(p, cb_read_byte, &ch);
282
-        const bool eol = !ch;         // zero ends the string
283
-        // End or a break between phrases?
284
-        if (eol || ch == ' ' || ch == '-' || ch == '+' || ch == '.') {
285
-          if (!c && ch == ' ') { if (wrd) wrd++; continue; } // collapse extra spaces
286
-          // Past the right and the word is not too long?
287
-          if (col + c > LCD_WIDTH && col >= (LCD_WIDTH) / 4) _newline(); // should it wrap?
288
-          c += !eol;                  // +1 so the space will be printed
289
-          col += c;                   // advance col to new position
290
-          while (c) {                 // character countdown
291
-            --c;                      // count down to zero
292
-            wrd = get_utf8_value_cb(wrd, cb_read_byte, &ch); // get characters again
293
-            lcd_put_wchar(ch);        // character to the LCD
265
+  #if !HAS_GRAPHICAL_TFT
266
+
267
+    void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, bool wordwrap/*=false*/) {
268
+      SETCURSOR(col, row);
269
+      if (!string) return;
270
+
271
+      auto _newline = [&col, &row]{
272
+        col = 0; row++;                 // Move col to string len (plus space)
273
+        SETCURSOR(0, row);              // Simulate carriage return
274
+      };
275
+
276
+      uint8_t *p = (uint8_t*)string;
277
+      wchar_t ch;
278
+      if (wordwrap) {
279
+        uint8_t *wrd = nullptr, c = 0;
280
+        // find the end of the part
281
+        for (;;) {
282
+          if (!wrd) wrd = p;            // Get word start /before/ advancing
283
+          p = get_utf8_value_cb(p, cb_read_byte, &ch);
284
+          const bool eol = !ch;         // zero ends the string
285
+          // End or a break between phrases?
286
+          if (eol || ch == ' ' || ch == '-' || ch == '+' || ch == '.') {
287
+            if (!c && ch == ' ') { if (wrd) wrd++; continue; } // collapse extra spaces
288
+            // Past the right and the word is not too long?
289
+            if (col + c > LCD_WIDTH && col >= (LCD_WIDTH) / 4) _newline(); // should it wrap?
290
+            c += !eol;                  // +1 so the space will be printed
291
+            col += c;                   // advance col to new position
292
+            while (c) {                 // character countdown
293
+              --c;                      // count down to zero
294
+              wrd = get_utf8_value_cb(wrd, cb_read_byte, &ch); // get characters again
295
+              lcd_put_wchar(ch);        // character to the LCD
296
+            }
297
+            if (eol) break;             // all done!
298
+            wrd = nullptr;              // set up for next word
294 299
           }
295
-          if (eol) break;             // all done!
296
-          wrd = nullptr;              // set up for next word
300
+          else c++;                     // count word characters
297 301
         }
298
-        else c++;                     // count word characters
299 302
       }
300
-    }
301
-    else {
302
-      for (;;) {
303
-        p = get_utf8_value_cb(p, cb_read_byte, &ch);
304
-        if (!ch) break;
305
-        lcd_put_wchar(ch);
306
-        col++;
307
-        if (col >= LCD_WIDTH) _newline();
303
+      else {
304
+        for (;;) {
305
+          p = get_utf8_value_cb(p, cb_read_byte, &ch);
306
+          if (!ch) break;
307
+          lcd_put_wchar(ch);
308
+          col++;
309
+          if (col >= LCD_WIDTH) _newline();
310
+        }
308 311
       }
309 312
     }
310
-  }
311 313
 
312
-  void MarlinUI::draw_select_screen_prompt(PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) {
313
-    const uint8_t plen = utf8_strlen_P(pref), slen = suff ? utf8_strlen_P(suff) : 0;
314
-    uint8_t col = 0, row = 0;
315
-    if (!string && plen + slen <= LCD_WIDTH) {
316
-      col = (LCD_WIDTH - plen - slen) / 2;
317
-      row = LCD_HEIGHT > 3 ? 1 : 0;
318
-    }
319
-    wrap_string_P(col, row, pref, true);
320
-    if (string) {
321
-      if (col) { col = 0; row++; } // Move to the start of the next line
322
-      wrap_string(col, row, string);
314
+    void MarlinUI::draw_select_screen_prompt(PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) {
315
+      const uint8_t plen = utf8_strlen_P(pref), slen = suff ? utf8_strlen_P(suff) : 0;
316
+      uint8_t col = 0, row = 0;
317
+      if (!string && plen + slen <= LCD_WIDTH) {
318
+        col = (LCD_WIDTH - plen - slen) / 2;
319
+        row = LCD_HEIGHT > 3 ? 1 : 0;
320
+      }
321
+      wrap_string_P(col, row, pref, true);
322
+      if (string) {
323
+        if (col) { col = 0; row++; } // Move to the start of the next line
324
+        wrap_string(col, row, string);
325
+      }
326
+      if (suff) wrap_string_P(col, row, suff);
323 327
     }
324
-    if (suff) wrap_string_P(col, row, suff);
325
-  }
328
+
329
+  #endif // !HAS_GRAPHICAL_TFT
326 330
 
327 331
 #endif // HAS_LCD_MENU
328 332
 

+ 4
- 6
Marlin/src/lcd/marlinui.h Voir le fichier

@@ -80,12 +80,10 @@
80 80
 
81 81
     #include "lcdprint.h"
82 82
 
83
-    void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, const bool wordwrap=false);
84
-    inline void wrap_string_P(uint8_t &col, uint8_t &row, PGM_P const pstr, const bool wordwrap=false) { _wrap_string(col, row, pstr, read_byte_rom, wordwrap); }
85
-    inline void wrap_string(uint8_t &col, uint8_t &row, const char * const string, const bool wordwrap=false) { _wrap_string(col, row, string, read_byte_ram, wordwrap); }
86
-
87
-    #if ENABLED(SDSUPPORT)
88
-      #include "../sd/cardreader.h"
83
+    #if !HAS_GRAPHICAL_TFT
84
+      void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, const bool wordwrap=false);
85
+      inline void wrap_string_P(uint8_t &col, uint8_t &row, PGM_P const pstr, const bool wordwrap=false) { _wrap_string(col, row, pstr, read_byte_rom, wordwrap); }
86
+      inline void wrap_string(uint8_t &col, uint8_t &row, const char * const string, const bool wordwrap=false) { _wrap_string(col, row, string, read_byte_ram, wordwrap); }
89 87
     #endif
90 88
 
91 89
     typedef void (*screenFunc_t)();

Chargement…
Annuler
Enregistrer