From f1b32b808fb7349c32d0a3ea84acdd9275985669 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 19 Nov 2020 15:51:53 -0600 Subject: [PATCH] MKS WiFi preliminary changes --- Marlin/src/HAL/STM32F1/MarlinSerial.cpp | 4 +- Marlin/src/MarlinCore.cpp | 2 +- Marlin/src/gcode/feature/L6470/M916-918.cpp | 4 +- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 2 +- .../ftdi_eve_lib/extended/dl_cache.h | 13 ++--- .../ftdi_eve_lib/extended/tiny_timer.cpp | 6 +-- .../screens/bed_mesh_screen.cpp | 9 ++-- .../ftdi_eve_touch_ui/screens/boot_screen.cpp | 3 +- .../screens/files_screen.cpp | 14 ++--- .../ftdi_eve_touch_ui/screens/lock_screen.cpp | 31 +++++------ .../screens/save_settings_dialog_box.cpp | 5 +- .../lib/mks_ui/draw_advance_settings.cpp | 4 +- .../src/lcd/extui/lib/mks_ui/draw_dialog.cpp | 6 +-- .../lcd/extui/lib/mks_ui/draw_keyboard.cpp | 4 +- .../lcd/extui/lib/mks_ui/draw_operation.cpp | 12 ++--- .../lcd/extui/lib/mks_ui/draw_ready_print.cpp | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp | 6 +-- Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp | 35 ++++++------ Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h | 8 ++- Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp | 4 +- .../lcd/extui/lib/mks_ui/draw_wifi_list.cpp | 5 +- .../extui/lib/mks_ui/draw_wifi_settings.cpp | 12 ++--- .../lcd/extui/lib/mks_ui/draw_wifi_tips.cpp | 4 +- .../src/lcd/extui/lib/mks_ui/irq_overrid.cpp | 4 +- .../src/lcd/extui/lib/mks_ui/pic_manager.cpp | 2 +- .../extui/lib/mks_ui/printer_operation.cpp | 2 +- .../lcd/extui/lib/mks_ui/tft_Language_en.h | 54 +++++++++---------- .../lib/mks_ui/tft_lvgl_configuration.cpp | 3 +- .../extui/lib/mks_ui/tft_lvgl_configuration.h | 2 +- .../extui/lib/mks_ui/tft_multi_language.cpp | 4 +- .../src/lcd/extui/lib/mks_ui/wifiSerial.cpp | 4 +- Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h | 8 +-- .../src/lcd/extui/lib/mks_ui/wifi_module.cpp | 10 ++-- 33 files changed, 132 insertions(+), 156 deletions(-) diff --git a/Marlin/src/HAL/STM32F1/MarlinSerial.cpp b/Marlin/src/HAL/STM32F1/MarlinSerial.cpp index ebf11cb429..7c9625d64c 100644 --- a/Marlin/src/HAL/STM32F1/MarlinSerial.cpp +++ b/Marlin/src/HAL/STM32F1/MarlinSerial.cpp @@ -111,7 +111,9 @@ constexpr bool serial_handles_emergency(int port) { // Instantiate all UARTs even if they are not needed // This avoids a bunch of logic to figure out every serial // port which may be in use on the system. -DEFINE_HWSERIAL_MARLIN(MSerial1, 1); +#if DISABLED(MKS_WIFI_MODULE) + DEFINE_HWSERIAL_MARLIN(MSerial1, 1); +#endif DEFINE_HWSERIAL_MARLIN(MSerial2, 2); DEFINE_HWSERIAL_MARLIN(MSerial3, 3); #if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 60765c9833..5769da05d0 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -979,7 +979,7 @@ void setup() { #endif SERIAL_ECHO_MSG("start"); - #if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION) + #if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) mks_esp_wifi_init(); WIFISERIAL.begin(WIFI_BAUDRATE); serial_connect_timeout = millis() + 1000UL; diff --git a/Marlin/src/gcode/feature/L6470/M916-918.cpp b/Marlin/src/gcode/feature/L6470/M916-918.cpp index 8165b71e44..2672f91239 100644 --- a/Marlin/src/gcode/feature/L6470/M916-918.cpp +++ b/Marlin/src/gcode/feature/L6470/M916-918.cpp @@ -308,8 +308,8 @@ void GcodeSuite::M917() { L64xxManager.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold); } DEBUG_ECHOLNPGM("."); - gcode.reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered - watchdog_refresh();; // beat the dog + gcode.reset_stepper_timeout(); // keep steppers powered + watchdog_refresh(); safe_delay(5000); status_composite_temp = 0; for (j = 0; j < driver_count; j++) { diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index 9c36cca253..74be828c72 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -204,7 +204,7 @@ void TFTGLCD::print_line() { #endif } -void TFTGLCD::print_screen(){ +void TFTGLCD::print_screen() { if (!PanelDetected) return; framebuffer[FBSIZE - 2] = picBits & PIC_MASK; framebuffer[FBSIZE - 1] = ledBits; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.h index 44934f909a..73b4b0bbc8 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.h @@ -29,15 +29,12 @@ * * The DLCache can be used like so: * - * void some_function() { - * DLCache dlcache(UNIQUE_ID); + * DLCache dlcache(UNIQUE_ID); * - * if (dlcache.hasData()) { - * dlcache.append(); - * } else { - * // Add stuff to the DL - * dlcache.store(); - * } + * if (dlcache.hasData()) + * dlcache.append(); + * else + * dlcache.store(); // Add stuff to the DL */ class DLCache { private: diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/tiny_timer.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/tiny_timer.cpp index 84233c5ce3..2147dd7c8f 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/tiny_timer.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/tiny_timer.cpp @@ -32,11 +32,7 @@ bool tiny_timer_t::elapsed(tiny_time_t duration) { #endif ); uint8_t elapsed = now - _start; - if (elapsed >= duration._duration) { - return true; - } else { - return false; - } + return elapsed >= duration._duration; } void tiny_timer_t::start() { diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp index eb8f742313..c54a7e04b5 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp @@ -78,9 +78,9 @@ void BedMeshScreen::drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI:: } } } - if (val_cnt) { + if (val_cnt) val_mean /= val_cnt; - } else { + else { val_mean = 0; val_min = 0; val_max = 0; @@ -327,11 +327,10 @@ void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::pr screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE; break; case ExtUI::MESH_FINISH: - if (screen_data.BedMeshScreen.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray())) { + if (screen_data.BedMeshScreen.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray())) screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_COMPLETE; - } else { + else screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE; - } screen_data.BedMeshScreen.count = GRID_MAX_POINTS; break; case ExtUI::PROBE_START: diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp index e79f25fcb5..40e49672d4 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp @@ -72,7 +72,8 @@ void BootScreen::onIdle() { GOTO_SCREEN(TouchCalibrationScreen); current_screen.forget(); PUSH_SCREEN(StatusScreen); - } else { + } + else { if (!UIFlashStorage::is_valid()) { StatusScreen::loadBitmaps(); SpinnerDialogBox::show(GET_TEXT_F(MSG_PLEASE_WAIT)); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp index 90e3040079..aed81045f4 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp @@ -152,11 +152,11 @@ void FilesScreen::drawFooter() { #undef MARGIN_T #undef MARGIN_B #ifdef TOUCH_UI_PORTRAIT - #define MARGIN_T 15 - #define MARGIN_B 5 + #define MARGIN_T 15 + #define MARGIN_B 5 #else - #define MARGIN_T 5 - #define MARGIN_B 5 + #define MARGIN_T 5 + #define MARGIN_B 5 #endif const bool has_selection = screen_data.FilesScreen.selected_tag != 0xFF; const uint8_t back_tag = screen_data.FilesScreen.flags.is_root ? 240 : 245; @@ -170,11 +170,11 @@ void FilesScreen::drawFooter() { .tag(back_tag).button( BTN_POS(4,y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BACK)) .enabled(has_selection) .colors(has_selection ? action_btn : normal_btn); - if (screen_data.FilesScreen.flags.is_dir) { + + if (screen_data.FilesScreen.flags.is_dir) cmd.tag(244).button( BTN_POS(1, y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_OPEN)); - } else { + else cmd.tag(243).button( BTN_POS(1, y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_PRINT)); - } } void FilesScreen::onRedraw(draw_mode_t what) { diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp index 35bbd7ad90..193bb681ec 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp @@ -122,28 +122,25 @@ char &LockScreen::message_style() { } void LockScreen::onPasscodeEntered() { - if (passcode == 0) { - // We are defining a passcode + if (passcode == 0) { // We are defining a passcode message_style() = 0; onRefresh(); sound.play(twinkle, PLAY_SYNCHRONOUS); passcode = compute_checksum(); GOTO_PREVIOUS(); - } else { - // We are verifying a passcode - if (passcode == compute_checksum()) { - message_style() = 'g'; - onRefresh(); - sound.play(twinkle, PLAY_SYNCHRONOUS); - GOTO_PREVIOUS(); - } - else { - message_style() = 'w'; - onRefresh(); - sound.play(sad_trombone, PLAY_SYNCHRONOUS); - current_screen.forget(); // Discard the screen the user was trying to go to. - GOTO_PREVIOUS(); - } + } + else if (passcode == compute_checksum()) { // We are verifying a passcode + message_style() = 'g'; + onRefresh(); + sound.play(twinkle, PLAY_SYNCHRONOUS); + GOTO_PREVIOUS(); + } + else { + message_style() = 'w'; + onRefresh(); + sound.play(sad_trombone, PLAY_SYNCHRONOUS); + current_screen.forget(); // Discard the screen the user was trying to go to. + GOTO_PREVIOUS(); } } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.cpp index 350e2de7eb..eff0431a94 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.cpp @@ -56,10 +56,9 @@ void SaveSettingsDialogBox::promptToSaveSettings() { // so SaveSettingsDialogBox doesn't return here. GOTO_SCREEN(SaveSettingsDialogBox); current_screen.forget(); - } else { - // No save needed. - GOTO_PREVIOUS(); } + else + GOTO_PREVIOUS(); // No save needed. } #endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp index dd6e484921..534fd6072c 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp @@ -54,7 +54,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_clear_advance_settings(); lv_draw_filament_settings(); break; - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) case ID_WIFI_PARA: lv_clear_advance_settings(); lv_draw_wifi_settings(); @@ -75,7 +75,7 @@ void lv_draw_advance_settings(void) { int index = 0; lv_screen_menu_item(scr, machine_menu.PausePosition, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PAUSE_POS, index++); lv_screen_menu_item(scr, machine_menu.FilamentConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_FILAMENT_SETTINGS, index++); - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) lv_screen_menu_item(scr, machine_menu.WifiSettings, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_WIFI_PARA, index++); #endif #if HAS_ROTARY_ENCODER diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp index 0a36b09ce7..1fcb1bd2e2 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp @@ -239,7 +239,7 @@ void lv_draw_dialog(uint8_t type) { lv_obj_t *labelCancel = lv_label_create_empty(btnCancel); lv_label_set_text(labelCancel, print_file_dialog_menu.cancle); } - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) else if (DIALOG_IS(TYPE_UPLOAD_FILE)) { if (upload_result == 2) { btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb); @@ -377,7 +377,7 @@ void lv_draw_dialog(uint8_t type) { lv_label_set_text(labelDialog, DIALOG_UPDATE_NO_DEVICE_EN); lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20); } - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) else if (DIALOG_IS(TYPE_UPLOAD_FILE)) { if (upload_result == 1) { lv_label_set_text(labelDialog, DIALOG_UPLOAD_ING_EN); @@ -418,7 +418,7 @@ void lv_draw_dialog(uint8_t type) { lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20); } } - #endif // USE_WIFI_FUNCTION + #endif // MKS_WIFI_MODULE else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT)) { lv_label_set_text(labelDialog, filament_menu.filament_dialog_load_heat); lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_keyboard.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_keyboard.cpp index acf1d15325..9f7c936fb3 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_keyboard.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_keyboard.cpp @@ -122,7 +122,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) { //if (res != LV_RES_OK) return; const char * ret_ta_txt = lv_ta_get_text(ext->ta); switch (keyboard_value) { - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) case wifiName: memcpy(uiCfg.wifi_name,ret_ta_txt,sizeof(uiCfg.wifi_name)); lv_clear_keyboard(); @@ -158,7 +158,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) { wifi_tips_type = TIPS_TYPE_JOINING; lv_draw_wifi_tips(); break; - #endif // USE_WIFI_FUNCTION + #endif // MKS_WIFI_MODULE case gcodeCommand: uint8_t buf[100]; strncpy((char *)buf,ret_ta_txt,sizeof(buf)); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp index 07df598d8f..518ddbd251 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp @@ -180,10 +180,7 @@ void lv_draw_operation(void) { label_PowerOff = lv_label_create_empty(buttonPowerOff); if (uiCfg.print_state != WORKING) { - /* - label_Filament = lv_label_create_empty(buttonFilament); - } else { - */ + //label_Filament = lv_label_create_empty(buttonFilament); labelExtrusion = lv_label_create_empty(buttonExtrusion); label_Move = lv_label_create_empty(buttonMove); } @@ -210,11 +207,8 @@ void lv_draw_operation(void) { lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); if (uiCfg.print_state != WORKING) { - /* - lv_label_set_text(label_Filament, operation_menu.filament); - lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET); - } else { - */ + //lv_label_set_text(label_Filament, operation_menu.filament); + //lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET); lv_label_set_text(labelExtrusion, operation_menu.extr); lv_obj_align(labelExtrusion, buttonExtrusion, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp index cee02cc47a..51d8cea15e 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp @@ -219,7 +219,7 @@ void lv_draw_ready_print(void) { void lv_clear_ready_print() { #if HAS_ROTARY_ENCODER - if (gCfgItems.encoder_enable == true) lv_group_remove_all_objs(g); + if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g); #endif lv_obj_del(scr); } diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp index b2211e5631..939d91b7f1 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp @@ -54,7 +54,7 @@ enum { static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) char buf[6] = { 0 }; #endif switch (obj->mks_obj_id) { @@ -87,7 +87,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_draw_ready_print(); break; - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) case ID_S_WIFI: if (gCfgItems.wifi_mode_sel == STA_MODEL) { if (wifi_link_state == WIFI_CONNECTED) { @@ -135,7 +135,7 @@ void lv_draw_set(void) { #if HAS_LANG_SELECT_SCREEN lv_big_button_create(scr, "F:/bmp_language.bin", set_menu.language, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_S_LANGUAGE); #endif - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) lv_big_button_create(scr, "F:/bmp_wifi.bin", set_menu.wifi, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_S_WIFI); #endif 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_S_RETURN); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp index a6c96d6799..102234b090 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp @@ -138,7 +138,7 @@ void gCfgItems_init() { gCfgItems.levelingPos[4][0] = X_BED_SIZE / 2; gCfgItems.levelingPos[4][1] = Y_BED_SIZE / 2; gCfgItems.cloud_enable = true; - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) gCfgItems.wifi_mode_sel = STA_MODEL; gCfgItems.fileSysType = FILE_SYS_SD; gCfgItems.wifi_type = ESP_WIFI; @@ -203,7 +203,7 @@ void ui_cfg_init() { uiCfg.filament_unloading_time_flg = 0; uiCfg.filament_unloading_time_cnt = 0; - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) memset(&wifiPara, 0, sizeof(wifiPara)); memset(&ipPara, 0, sizeof(ipPara)); strcpy(wifiPara.ap_name, WIFI_AP_NAME); @@ -542,7 +542,7 @@ char *getDispText(int index) { strcpy(public_buf_l, tool_menu.title); break; case WIFI_LIST_UI: - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) strcpy(public_buf_l, list_menu.title); break; #endif @@ -1040,7 +1040,7 @@ void GUI_RefreshPage() { */ break; - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) case WIFI_UI: if (temps_update_flag) { disp_wifi_state(); @@ -1061,7 +1061,7 @@ void GUI_RefreshPage() { break; case DIALOG_UI: filament_dialog_handle(); - TERN_(USE_WIFI_FUNCTION, wifi_scan_handle()); + TERN_(MKS_WIFI_MODULE, wifi_scan_handle()); break; case MESHLEVELING_UI: /*disp_zpos();*/ @@ -1069,7 +1069,7 @@ void GUI_RefreshPage() { case HARDWARE_TEST_UI: break; case WIFI_LIST_UI: - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) if (printing_rate_update_flag) { disp_wifi_list(); printing_rate_update_flag = false; @@ -1080,7 +1080,7 @@ void GUI_RefreshPage() { /*update_password_disp(); update_join_state_disp();*/ break; - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) case WIFI_TIPS_UI: switch (wifi_tips_type) { case TIPS_TYPE_JOINING: @@ -1216,11 +1216,11 @@ void clear_cur_ui() { case TMC_CURRENT_UI: lv_clear_tmc_current_settings(); break; #endif case EEPROM_SETTINGS_UI: lv_clear_eeprom_settings(); break; - #if HAS_STEALTHCHOP - case TMC_MODE_UI: lv_clear_tmc_step_mode_settings(); break; - #endif + #if HAS_STEALTHCHOP + case TMC_MODE_UI: lv_clear_tmc_step_mode_settings(); break; + #endif #if ENABLED(USE_WIFI_FUNCTION) - case WIFI_SETTINGS_UI: lv_clear_wifi_settings(); break; + case WIFI_SETTINGS_UI: lv_clear_wifi_settings(); break; #endif #if USE_SENSORLESS case HOMING_SENSITIVITY_UI: lv_clear_homing_sensitivity_settings(); break; @@ -1516,10 +1516,8 @@ lv_obj_t* lv_big_button_create(lv_obj_t *par, const char *img, const char *text, else lv_obj_align(label, btn, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); } - #if HAS_ROTARY_ENCODER - if (gCfgItems.encoder_enable == true) - lv_group_add_obj(g, btn); - #endif + if (TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable)) + lv_group_add_obj(g, btn); return btn; } @@ -1535,11 +1533,8 @@ lv_obj_t* lv_screen_menu_item(lv_obj_t *par, const char *text, lv_coord_t x, lv_ lv_label_set_text(label, text); lv_obj_align(label, btn, LV_ALIGN_IN_LEFT_MID, 0, 0); } - #if HAS_ROTARY_ENCODER - if (gCfgItems.encoder_enable == true) { - lv_group_add_obj(g, btn); - } - #endif + if (TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable)) + lv_group_add_obj(g, btn); if (drawArrow) (void)lv_imgbtn_create(par, "F:/bmp_arrow.bin", x + PARA_UI_SIZE_X, y + PARA_UI_ARROW_V, cb, id); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h index 6d162676e8..a888217b9a 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h @@ -76,7 +76,7 @@ #include "draw_keyboard.h" #include "draw_encoder_settings.h" -#if ENABLED(USE_WIFI_FUNCTION) +#if ENABLED(MKS_WIFI_MODULE) #include "wifiSerial.h" #include "wifi_module.h" #include "wifi_upload.h" @@ -378,14 +378,12 @@ typedef enum { level_pos_x4, level_pos_y4, level_pos_x5, - level_pos_y5 + level_pos_y5, #if HAS_BED_PROBE - , x_offset, y_offset, - z_offset + z_offset, #endif - , load_length, load_speed, unload_length, diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp index 6f14c20d29..47a5dff048 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp @@ -26,7 +26,7 @@ #include #include "tft_lvgl_configuration.h" -#if ENABLED(USE_WIFI_FUNCTION) +#if ENABLED(MKS_WIFI_MODULE) #include "draw_ui.h" @@ -159,5 +159,5 @@ void lv_clear_wifi() { lv_obj_del(scr); } -#endif // USE_WIFI_FUNCTION +#endif // MKS_WIFI_MODULE #endif // HAS_TFT_LVGL_UI diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.cpp index c826e36d42..f902edce7c 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.cpp @@ -26,7 +26,7 @@ #include #include "tft_lvgl_configuration.h" -#if ENABLED(USE_WIFI_FUNCTION) +#if ENABLED(MKS_WIFI_MODULE) #include "draw_ui.h" @@ -170,6 +170,5 @@ void lv_clear_wifi_list() { lv_obj_del(scr); } -#endif // USE_WIFI_FUNCTION - +#endif // MKS_WIFI_MODULE #endif // HAS_TFT_LVGL_UI diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_settings.cpp index 441720df82..9c8c094e4c 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_settings.cpp @@ -26,7 +26,7 @@ #include #include "tft_lvgl_configuration.h" -#if ENABLED(USE_WIFI_FUNCTION) +#if ENABLED(MKS_WIFI_MODULE) #include "draw_ui.h" @@ -96,7 +96,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { void lv_draw_wifi_settings(void) { scr = lv_screen_create(WIFI_SETTINGS_UI, machine_menu.WifiConfTitle); - lv_obj_t *labelModelText = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.wifiMode); + lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.wifiMode); lv_obj_t *buttonModelValue = lv_imgbtn_create(scr, "F:/bmp_blank_sel.bin", PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, event_handler, ID_WIFI_MODEL); lv_btn_set_style_both(buttonModelValue, &style_para_value_pre); @@ -119,7 +119,7 @@ void lv_draw_wifi_settings(void) { lv_obj_t *line3 = lv_line_create(scr, nullptr); lv_ex_line(line3, line_points[2]); - lv_obj_t *labelCloudText = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.wifiCloud); + lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.wifiCloud); lv_obj_t *buttonCloudValue = lv_imgbtn_create(scr, gCfgItems.cloud_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_STATE_V, event_handler, ID_WIFI_CLOUD); labelCloudValue = lv_label_create_empty(buttonCloudValue); @@ -141,14 +141,14 @@ void lv_draw_wifi_settings(void) { lv_label_set_text(labelModelValue, WIFI_STA_TEXT); lv_obj_align(labelModelValue, buttonModelValue, LV_ALIGN_CENTER, 0, 0); } - strcat(public_buf_m, machine_menu.wifiName); + strcpy(public_buf_m, machine_menu.wifiName); strcat(public_buf_m, (const char *)uiCfg.wifi_name); lv_label_set_text(labelNameText, public_buf_m); lv_label_set_text(labelNameValue, machine_menu.wifiEdit); lv_obj_align(labelNameValue, buttonNameValue, LV_ALIGN_CENTER, 0, 0); - strcat(public_buf_m, machine_menu.wifiPassWord); + strcpy(public_buf_m, machine_menu.wifiPassWord); strcat(public_buf_m, (const char *)uiCfg.wifi_key); lv_label_set_text(labelPassWordText, public_buf_m); @@ -184,5 +184,5 @@ void lv_clear_wifi_settings() { lv_obj_del(scr); } -#endif // USE_WIFI_FUNCTION +#endif // MKS_WIFI_MODULE #endif // HAS_TFT_LVGL_UI diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.cpp index a9e5624996..7428d36488 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.cpp @@ -26,7 +26,7 @@ #include #include "tft_lvgl_configuration.h" -#if ENABLED(USE_WIFI_FUNCTION) +#if ENABLED(MKS_WIFI_MODULE) #include "draw_ui.h" @@ -64,5 +64,5 @@ void lv_draw_wifi_tips(void) { void lv_clear_wifi_tips() { lv_obj_del(scr); } -#endif // USE_WIFI_FUNCTION +#endif // MKS_WIFI_MODULE #endif // HAS_TFT_LVGL_UI diff --git a/Marlin/src/lcd/extui/lib/mks_ui/irq_overrid.cpp b/Marlin/src/lcd/extui/lib/mks_ui/irq_overrid.cpp index b9c7ccd9e6..128bf0b2d4 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/irq_overrid.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/irq_overrid.cpp @@ -25,7 +25,7 @@ #include "tft_lvgl_configuration.h" -#if ENABLED(USE_WIFI_FUNCTION) +#if ENABLED(MKS_WIFI_MODULE) #include "draw_ui.h" #include "wifiSerial.h" @@ -66,5 +66,5 @@ void __irq_usart1(void) { } /* C-declarations for C++ */ #endif -#endif // USE_WIFI_FUNCTION +#endif // MKS_WIFI_MODULE #endif // HAS_TFT_LVGL_UI diff --git a/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp b/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp index 5ba7722f55..4dd84d0212 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp @@ -205,7 +205,7 @@ static const char assets[][LONG_FILENAME_LENGTH] = { "bmp_enable.bin", "bmp_return.bin", - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) // wifi screen "bmp_wifi.bin", #endif diff --git a/Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp b/Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp index 4f700a16dc..58f9f4fce6 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp @@ -148,7 +148,7 @@ void printer_state_polling() { if (uiCfg.print_state == WORKING) filament_check(); - TERN_(USE_WIFI_FUNCTION, wifi_looping()); + TERN_(MKS_WIFI_MODULE, wifi_looping()); } void filament_pin_setup() { diff --git a/Marlin/src/lcd/extui/lib/mks_ui/tft_Language_en.h b/Marlin/src/lcd/extui/lib/mks_ui/tft_Language_en.h index fa8d5a52a4..bb537527be 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/tft_Language_en.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/tft_Language_en.h @@ -48,7 +48,7 @@ #define MACHINE_TYPE_CNOFIG_EN "Machine settings" #define MOTOR_CONFIG_EN "Motor settings" #define MACHINE_LEVELING_CONFIG_EN "Leveling settings" -#define ADVANCE_CONFIG_EN "Adavance settings" +#define ADVANCE_CONFIG_EN "Advanced settings" #define MACHINE_CONFIG_TITLE_EN "Machine Settings" #define MACHINE_TYPE_EN "Machine type" @@ -82,9 +82,9 @@ #define MIN_ENDSTOP_X_EN "X-axis minimum Endstop" #define MIN_ENDSTOP_Y_EN "Y-axis minimum Endstop" #define MIN_ENDSTOP_Z_EN "Z-axis minimum Endstop" -#define MAX_ENDSTOP_X_EN "X axis maximum Endstop" -#define MAX_ENDSTOP_Y_EN "Y axis maximum Endstop" -#define MAX_ENDSTOP_Z_EN "Z axis maximum Endstop" +#define MAX_ENDSTOP_X_EN "X-axis maximum Endstop" +#define MAX_ENDSTOP_Y_EN "Y-axis maximum Endstop" +#define MAX_ENDSTOP_Z_EN "Z-axis maximum Endstop" #define ENDSTOP_FIL_EN "Filament sensor" #define ENDSTOP_LEVEL_EN "Leveling sensor" #define ENDSTOP_OPENED_EN "Open" @@ -107,11 +107,11 @@ #define AUTO_LEVELING_ENABLE_EN "Enable auto leveling" #define BLTOUCH_LEVELING_ENABLE_EN "Enable BLtouch" #define PROBE_PORT_EN "Probe connector" -#define PROBE_X_OFFSET_EN "Probe x axis offset" -#define PROBE_Y_OFFSET_EN "Probe y axis offset" -#define PROBE_Z_OFFSET_EN "Probe z axis offset" -#define PROBE_XY_SPEED_EN "Probe xy axis speed" -#define PROBE_Z_SPEED_EN "Probe z axis speed" +#define PROBE_X_OFFSET_EN "Probe X-axis offset" +#define PROBE_Y_OFFSET_EN "Probe Y-axis offset" +#define PROBE_Z_OFFSET_EN "Probe Z-axis offset" +#define PROBE_XY_SPEED_EN "Probe XY-axis speed" +#define PROBE_Z_SPEED_EN "Probe Z-axis speed" #define ENABLE_EN "YES" #define DISABLE_EN "NO" #define Z_MIN_EN "ZMin" @@ -162,11 +162,11 @@ #define HOMEFEEDRATECONF_EN "Home speed setting" #define MAXFEEDRATE_CONF_TITLE_EN "Machine Settings>Maximum speed" -#define X_MAXFEEDRATE_EN "X axis maximum speed" -#define Y_MAXFEEDRATE_EN "Y axis maximum speed" -#define Z_MAXFEEDRATE_EN "Z axis maximum speed" -#define E0_MAXFEEDRATE_EN "E0 axis maximum speed" -#define E1_MAXFEEDRATE_EN "E1 axis maximum speed" +#define X_MAXFEEDRATE_EN "X-axis maximum speed" +#define Y_MAXFEEDRATE_EN "Y-axis maximum speed" +#define Z_MAXFEEDRATE_EN "Z-axis maximum speed" +#define E0_MAXFEEDRATE_EN "E0-axis maximum speed" +#define E1_MAXFEEDRATE_EN "E1-axis maximum speed" #define ACCELERATION_CONF_TITLE_EN "Machine Settings>Acceleration" #define PRINT_ACCELERATION_EN "Print acceleration" @@ -192,18 +192,18 @@ #define E1_STEPS_EN "E1-axis steps" #define TMC_CURRENT_CONF_TITLE_EN "Machine Settings>TMC current settings" -#define X_TMC_CURRENT_EN "X axis current (mA)" -#define Y_TMC_CURRENT_EN "Y axis current (mA)" -#define Z_TMC_CURRENT_EN "Z axis current (mA)" -#define E0_TMC_CURRENT_EN "E0 axis current (mA)" -#define E1_TMC_CURRENT_EN "E1 axis current (mA)" +#define X_TMC_CURRENT_EN "X-axis current (mA)" +#define Y_TMC_CURRENT_EN "Y-axis current (mA)" +#define Z_TMC_CURRENT_EN "Z-axis current (mA)" +#define E0_TMC_CURRENT_EN "E0-axis current (mA)" +#define E1_TMC_CURRENT_EN "E1-axis current (mA)" #define TMC_MODE_CONF_TITLE_EN "Machine Settings>TMC step mode settings" -#define X_TMC_MODE_EN "Whether X axis enable stealthChop modes" -#define Y_TMC_MODE_EN "Whether Y axis enable stealthChop modes" -#define Z_TMC_MODE_EN "Whether Z axis enable stealthChop modes" -#define E0_TMC_MODE_EN "Whether E0 axis enable stealthChop modes" -#define E1_TMC_MODE_EN "Whether E1 axis enable stealthChop modes" +#define X_TMC_MODE_EN "Whether X-axis enable stealthChop modes" +#define Y_TMC_MODE_EN "Whether Y-axis enable stealthChop modes" +#define Z_TMC_MODE_EN "Whether Z-axis enable stealthChop modes" +#define E0_TMC_MODE_EN "Whether E0-axis enable stealthChop modes" +#define E1_TMC_MODE_EN "Whether E1-axis enable stealthChop modes" #define MOTORDIR_CONF_TITLE_EN "Machine Settings>Motor direction" #define X_MOTORDIR_EN "X-axis motor direction invert" @@ -241,9 +241,9 @@ #define E_ENABLE_PINS_INVERT_EN "E_ENABLE_PIN_INVERT" #define PAUSE_POSITION_EN "Printing pause position settings" -#define PAUSE_POSITION_X_EN "X axis position (Absolute position,-1 invalid)" -#define PAUSE_POSITION_Y_EN "Y axis position (Absolute position,-1 invalid)" -#define PAUSE_POSITION_Z_EN "Z axis position (Relative position,-1 invalid)" +#define PAUSE_POSITION_X_EN "X-axis position (Absolute position,-1 invalid)" +#define PAUSE_POSITION_Y_EN "Y-axis position (Absolute position,-1 invalid)" +#define PAUSE_POSITION_Z_EN "Z-axis position (Relative position,-1 invalid)" #define WIFI_SETTINGS_TITLE_EN "Machine Settings>Wi-Fi Parameter" #define WIFI_SETTINGS_MODE_EN "Wi-Fi Mode" diff --git a/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp index 9b8e3e1589..9e383a6abd 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp @@ -84,7 +84,7 @@ uint8_t bmp_public_buf[17 * 1024]; void SysTick_Callback() { lv_tick_inc(1); print_time_count(); - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) if (tips_disp.timer == TIPS_TIMER_START) tips_disp.timer_count++; #endif @@ -523,7 +523,6 @@ void lv_encoder_pin_init() { const uint8_t enc_c = (buttons & EN_C) ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL; if (enc_c != last_button_state) { state = enc_c ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL; - last_button_state = enc_c; } diff --git a/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.h b/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.h index 727ab33aea..df28893f41 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.h @@ -33,7 +33,7 @@ #include //#define TFT_ROTATION TFT_ROTATE_180 -#define USE_WIFI_FUNCTION 0 +#define MKS_WIFI_MODULE 0 extern void tft_lvgl_init(); extern void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp b/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp index e230195eab..c3c0f37365 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp @@ -853,7 +853,7 @@ void disp_language_init() { machine_menu.key_point = KEYBOARD_KEY_POINT_EN; machine_menu.negative = KEYBOARD_KEY_NEGATIVE_EN; // wifi-list - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) list_menu.title = TEXT_WIFI_MENU_TITLE_EN; list_menu.file_pages = FILE_PAGES_EN; @@ -861,7 +861,7 @@ void disp_language_init() { tips_menu.joining = TEXT_WIFI_JOINING_EN; tips_menu.failedJoin = TEXT_WIFI_FAILED_JOIN_EN; tips_menu.wifiConected = TEXT_WIFI_WIFI_CONECTED_EN; - #endif //USE_WIFI_FUNCTION + #endif //MKS_WIFI_MODULE machine_setting_disp(); operation_menu.babystep = TEXT_BABY_STEP_EN; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp b/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp index 16b65c7ea3..93fce6af30 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp @@ -25,7 +25,7 @@ #include "tft_lvgl_configuration.h" -#if ENABLED(USE_WIFI_FUNCTION) +#if ENABLED(MKS_WIFI_MODULE) #include "draw_ui.h" #include "wifiSerial.h" @@ -118,5 +118,5 @@ int WifiSerial::wifi_rb_is_full(void) { return rb_is_full(this->usart_device->rb); } -#endif // USE_WIFI_FUNCTION +#endif // MKS_WIFI_MODULE #endif // HAS_TFT_LVGL_UI diff --git a/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h b/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h index 9d3946fee7..3206666bef 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h @@ -23,10 +23,10 @@ #include "tft_lvgl_configuration.h" -#if ENABLED(USE_WIFI_FUNCTION) +#if ENABLED(MKS_WIFI_MODULE) -#if SERIAL_PORT_2 != -1 - #error "SERIAL_PORT_2 must be set to -1 with HAS_TFT_LVGL_UI and USE_WIFI_FUNCTION." +#ifdef SERIAL_PORT_2 + #error "SERIAL_PORT_2 must be disabled with HAS_TFT_LVGL_UI and MKS_WIFI_MODULE." #endif #define WIFI_BAUDRATE 115200 @@ -99,4 +99,4 @@ extern WifiSerial WifiSerial1; #define WIFISERIAL WifiSerial1 -#endif // USE_WIFI_FUNCTION +#endif // MKS_WIFI_MODULE diff --git a/Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp index bfc23f238c..eeeff4fa31 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp @@ -27,7 +27,7 @@ #include "wifi_module.h" #include "wifi_upload.h" -#if ENABLED(USE_WIFI_FUNCTION) +#if ENABLED(MKS_WIFI_MODULE) #include "../../../../MarlinCore.h" #include "../../../../module/temperature.h" @@ -283,7 +283,7 @@ void esp_port_begin(uint8_t interrupt) { } #endif if (interrupt) { - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) WIFISERIAL.end(); for (uint16_t i = 0; i < 65535; i++); WIFISERIAL.begin(WIFI_BAUDRATE); @@ -293,7 +293,7 @@ void esp_port_begin(uint8_t interrupt) { #endif } else { - #if ENABLED(USE_WIFI_FUNCTION) + #if ENABLED(MKS_WIFI_MODULE) WIFISERIAL.end(); for (uint16_t i = 0; i < 65535; i++); WIFISERIAL.begin(WIFI_UPLOAD_BAUDRATE); @@ -305,7 +305,7 @@ void esp_port_begin(uint8_t interrupt) { } } -#if ENABLED(USE_WIFI_FUNCTION) +#if ENABLED(MKS_WIFI_MODULE) int raw_send_to_wifi(char *buf, int len) { if (buf == 0 || len <= 0) return 0; @@ -1811,5 +1811,5 @@ int readWifiBuf(int8_t *buf, int32_t len) { return i; } -#endif // USE_WIFI_FUNCTION +#endif // MKS_WIFI_MODULE #endif // HAS_TFT_LVGL_UI