Fix UI compile issues (#20092)

This commit is contained in:
Victor Oliveira 2020-11-10 22:39:34 -03:00 committed by GitHub
parent f15fef90a9
commit f8ee6f8b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 75 additions and 73 deletions

View File

@ -55,7 +55,7 @@
#include "../../inc/MarlinConfigPre.h" #include "../../inc/MarlinConfigPre.h"
#if HAS_MARLINUI_U8GLIB #if HAS_MARLINUI_U8GLIB && DISABLED(TFT_CLASSIC_UI)
#include "HAL_LCD_com_defines.h" #include "HAL_LCD_com_defines.h"

View File

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

View File

@ -279,7 +279,7 @@ void disp_gcode_icon(uint8_t file_num) {
cutFileName((char *)list_file.long_name[i], 16, 8, (char *)public_buf_m); cutFileName((char *)list_file.long_name[i], 16, 8, (char *)public_buf_m);
if (list_file.IsFolder[i]) { if (list_file.IsFolder[i]) {
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), nullptr, 0); lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "", 0);
lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_dir.bin"); lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_dir.bin");
if (i < 3) if (i < 3)
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight); 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) {
strcat(test_public_buf_l, list_file.file_name[i]); strcat(test_public_buf_l, list_file.file_name[i]);
char *temp = strstr(test_public_buf_l, ".GCO"); char *temp = strstr(test_public_buf_l, ".GCO");
if (temp) strcpy(temp, ".bin"); if (temp) strcpy(temp, ".bin");
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), nullptr, 0); lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "", 0);
lv_imgbtn_set_src_both(buttonGcode[i], test_public_buf_l); lv_imgbtn_set_src_both(buttonGcode[i], test_public_buf_l);
if (i < 3) { if (i < 3) {
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); 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) {
lv_btn_use_label_style(buttonText[i]); lv_btn_use_label_style(buttonText[i]);
lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF); lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
//lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),nullptr, 0); //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),"", 0);
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); 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);
lv_obj_set_size(buttonText[i], 100, 40); lv_obj_set_size(buttonText[i], 100, 40);
} }
@ -320,7 +320,7 @@ void disp_gcode_icon(uint8_t file_num) {
lv_btn_use_label_style(buttonText[i]); lv_btn_use_label_style(buttonText[i]);
lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF); lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
//lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),nullptr, 0); //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),"", 0);
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); 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);
lv_obj_set_size(buttonText[i], 100, 40); lv_obj_set_size(buttonText[i], 100, 40);
} }
@ -328,7 +328,7 @@ void disp_gcode_icon(uint8_t file_num) {
lv_obj_align(labelPageUp[i], buttonText[i], LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_align(labelPageUp[i], buttonText[i], LV_ALIGN_IN_BOTTOM_MID, 0, 0);
} }
else { else {
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), nullptr, 0); lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "", 0);
lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_file.bin"); lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_file.bin");
if (i < 3) if (i < 3)
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight); lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight);

View File

@ -1680,7 +1680,7 @@ lv_obj_t* lv_label_create(lv_obj_t *par, lv_coord_t x, lv_coord_t y, const char
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*/) { 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*/) {
lv_obj_t *btn = lv_btn_create(par, nullptr); lv_obj_t *btn = lv_btn_create(par, nullptr);
if (id) if (id)
lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0); lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
else else
lv_obj_set_event_cb(btn, cb); lv_obj_set_event_cb(btn, cb);
lv_btn_set_style_both(btn, style); 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
lv_obj_t *btn = lv_imgbtn_create(par, nullptr); lv_obj_t *btn = lv_imgbtn_create(par, nullptr);
if (img) lv_imgbtn_set_src_both(btn, img); if (img) lv_imgbtn_set_src_both(btn, img);
if (id) if (id)
lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0); lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
else else
lv_obj_set_event_cb(btn, cb); lv_obj_set_event_cb(btn, cb);
lv_imgbtn_use_label_style(btn); 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_
lv_obj_t *btn = lv_btn_create(par, nullptr); /*Add a button the current screen*/ lv_obj_t *btn = lv_btn_create(par, nullptr); /*Add a button the current screen*/
lv_obj_set_pos(btn, x, y); /*Set its position*/ lv_obj_set_pos(btn, x, y); /*Set its position*/
lv_obj_set_size(btn, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ lv_obj_set_size(btn, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
if (id > -1) lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0); if (id > -1) lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
lv_btn_use_label_style(btn); lv_btn_use_label_style(btn);
lv_btn_set_layout(btn, LV_LAYOUT_OFF); lv_btn_set_layout(btn, LV_LAYOUT_OFF);
lv_obj_t *label = lv_label_create_empty(btn); /*Add a label to the button*/ lv_obj_t *label = lv_label_create_empty(btn); /*Add a label to the button*/

View File

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

View File

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

View File

@ -26,7 +26,7 @@
#include "../inc/MarlinConfigPre.h" #include "../inc/MarlinConfigPre.h"
#if HAS_WIRED_LCD #if HAS_WIRED_LCD && !HAS_GRAPHICAL_TFT
#include "lcdprint.h" #include "lcdprint.h"

View File

@ -262,6 +262,8 @@ millis_t MarlinUI::next_button_update_ms; // = 0
#endif #endif
#if !HAS_GRAPHICAL_TFT
void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, bool wordwrap/*=false*/) { void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, bool wordwrap/*=false*/) {
SETCURSOR(col, row); SETCURSOR(col, row);
if (!string) return; if (!string) return;
@ -324,6 +326,8 @@ millis_t MarlinUI::next_button_update_ms; // = 0
if (suff) wrap_string_P(col, row, suff); if (suff) wrap_string_P(col, row, suff);
} }
#endif // !HAS_GRAPHICAL_TFT
#endif // HAS_LCD_MENU #endif // HAS_LCD_MENU
void MarlinUI::init() { void MarlinUI::init() {

View File

@ -80,12 +80,10 @@
#include "lcdprint.h" #include "lcdprint.h"
#if !HAS_GRAPHICAL_TFT
void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, const bool wordwrap=false); void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, const bool wordwrap=false);
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); } 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); }
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); } 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); }
#if ENABLED(SDSUPPORT)
#include "../sd/cardreader.h"
#endif #endif
typedef void (*screenFunc_t)(); typedef void (*screenFunc_t)();