From 86bf374fc4e57cad7104f9a4369090ec8b8a42b6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 14 Jan 2021 00:23:56 -0600 Subject: [PATCH] More MKS UI prelim. cleanup --- Marlin/src/HAL/STM32/tft/tft_fsmc.h | 1 - .../src/lcd/extui/lib/mks_ui/draw_about.cpp | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_about.h | 2 +- .../lib/mks_ui/draw_acceleration_settings.cpp | 2 +- .../lib/mks_ui/draw_acceleration_settings.h | 2 +- .../lib/mks_ui/draw_advance_settings.cpp | 2 +- .../extui/lib/mks_ui/draw_advance_settings.h | 2 +- .../draw_auto_level_offset_settings.cpp | 2 +- .../mks_ui/draw_auto_level_offset_settings.h | 2 +- .../extui/lib/mks_ui/draw_baby_stepping.cpp | 2 +- .../lcd/extui/lib/mks_ui/draw_baby_stepping.h | 2 +- .../extui/lib/mks_ui/draw_change_speed.cpp | 2 +- .../lcd/extui/lib/mks_ui/draw_change_speed.h | 2 +- .../lcd/extui/lib/mks_ui/draw_cloud_bind.cpp | 2 +- .../lcd/extui/lib/mks_ui/draw_cloud_bind.h | 2 +- .../extui/lib/mks_ui/draw_eeprom_settings.cpp | 2 +- .../extui/lib/mks_ui/draw_eeprom_settings.h | 2 +- .../lib/mks_ui/draw_encoder_settings.cpp | 2 +- .../extui/lib/mks_ui/draw_encoder_settings.h | 2 +- .../lcd/extui/lib/mks_ui/draw_extrusion.cpp | 2 +- .../src/lcd/extui/lib/mks_ui/draw_extrusion.h | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_fan.cpp | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_fan.h | 2 +- .../extui/lib/mks_ui/draw_filament_change.cpp | 2 +- .../extui/lib/mks_ui/draw_filament_change.h | 2 +- .../lib/mks_ui/draw_filament_settings.cpp | 2 +- .../extui/lib/mks_ui/draw_filament_settings.h | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_home.h | 2 +- .../draw_homing_sensitivity_settings.cpp | 2 +- .../mks_ui/draw_homing_sensitivity_settings.h | 2 +- .../extui/lib/mks_ui/draw_jerk_settings.cpp | 2 +- .../lcd/extui/lib/mks_ui/draw_jerk_settings.h | 2 +- .../lcd/extui/lib/mks_ui/draw_language.cpp | 2 +- .../src/lcd/extui/lib/mks_ui/draw_language.h | 2 +- .../extui/lib/mks_ui/draw_level_settings.cpp | 2 +- .../extui/lib/mks_ui/draw_level_settings.h | 2 +- .../extui/lib/mks_ui/draw_machine_para.cpp | 2 +- .../lcd/extui/lib/mks_ui/draw_machine_para.h | 2 +- .../lib/mks_ui/draw_machine_settings.cpp | 2 +- .../extui/lib/mks_ui/draw_machine_settings.h | 2 +- .../lcd/extui/lib/mks_ui/draw_manuaLevel.cpp | 2 +- .../lcd/extui/lib/mks_ui/draw_manuaLevel.h | 2 +- .../mks_ui/draw_manual_level_pos_settings.cpp | 2 +- .../mks_ui/draw_manual_level_pos_settings.h | 2 +- .../lib/mks_ui/draw_max_feedrate_settings.cpp | 2 +- .../lib/mks_ui/draw_max_feedrate_settings.h | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_more.cpp | 91 +++++------------- Marlin/src/lcd/extui/lib/mks_ui/draw_more.h | 2 +- .../extui/lib/mks_ui/draw_motor_settings.cpp | 2 +- .../extui/lib/mks_ui/draw_motor_settings.h | 2 +- .../lcd/extui/lib/mks_ui/draw_move_motor.cpp | 4 +- .../lcd/extui/lib/mks_ui/draw_move_motor.h | 2 +- .../lcd/extui/lib/mks_ui/draw_number_key.cpp | 2 +- .../lcd/extui/lib/mks_ui/draw_number_key.h | 2 +- .../lcd/extui/lib/mks_ui/draw_operation.cpp | 2 +- .../src/lcd/extui/lib/mks_ui/draw_operation.h | 2 +- .../extui/lib/mks_ui/draw_pause_position.cpp | 2 +- .../extui/lib/mks_ui/draw_pause_position.h | 2 +- .../src/lcd/extui/lib/mks_ui/draw_preHeat.cpp | 2 +- .../src/lcd/extui/lib/mks_ui/draw_preHeat.h | 2 +- .../lcd/extui/lib/mks_ui/draw_print_file.cpp | 5 +- .../lcd/extui/lib/mks_ui/draw_print_file.h | 2 +- .../lcd/extui/lib/mks_ui/draw_printing.cpp | 2 +- .../src/lcd/extui/lib/mks_ui/draw_printing.h | 2 +- .../lcd/extui/lib/mks_ui/draw_ready_print.cpp | 2 +- .../lcd/extui/lib/mks_ui/draw_ready_print.h | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_set.h | 2 +- .../extui/lib/mks_ui/draw_step_settings.cpp | 2 +- .../lcd/extui/lib/mks_ui/draw_step_settings.h | 2 +- .../lib/mks_ui/draw_tmc_current_settings.cpp | 2 +- .../lib/mks_ui/draw_tmc_current_settings.h | 2 +- .../mks_ui/draw_tmc_step_mode_settings.cpp | 2 +- .../lib/mks_ui/draw_tmc_step_mode_settings.h | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp | 26 ++--- Marlin/src/lcd/extui/lib/mks_ui/draw_tool.h | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp | 3 - Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.h | 2 +- .../lcd/extui/lib/mks_ui/draw_wifi_list.cpp | 4 +- .../src/lcd/extui/lib/mks_ui/draw_wifi_list.h | 2 +- .../extui/lib/mks_ui/draw_wifi_settings.cpp | 2 +- .../lcd/extui/lib/mks_ui/draw_wifi_settings.h | 2 +- .../lcd/extui/lib/mks_ui/draw_wifi_tips.cpp | 2 +- .../src/lcd/extui/lib/mks_ui/draw_wifi_tips.h | 2 +- .../src/lcd/extui/lib/mks_ui/irq_overrid.cpp | 2 +- .../lcd/extui/lib/mks_ui/tft_Language_en.h | 1 - .../extui/lib/mks_ui/tft_lvgl_configuration.h | 5 +- .../extui/lib/mks_ui/tft_multi_language.cpp | 64 ++++--------- .../src/lcd/extui/lib/mks_ui/wifiSerial.cpp | 12 +-- Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h | 7 +- .../src/lcd/extui/lib/mks_ui/wifi_module.cpp | 95 +++++++++---------- .../src/lcd/extui/lib/mks_ui/wifi_upload.cpp | 15 ++- Marlin/src/lcd/tft/tft_queue.cpp | 1 - Marlin/src/libs/W25Qxx.cpp | 7 +- 97 files changed, 203 insertions(+), 300 deletions(-) diff --git a/Marlin/src/HAL/STM32/tft/tft_fsmc.h b/Marlin/src/HAL/STM32/tft/tft_fsmc.h index 7c40151e2b..2200abaa10 100644 --- a/Marlin/src/HAL/STM32/tft/tft_fsmc.h +++ b/Marlin/src/HAL/STM32/tft/tft_fsmc.h @@ -84,7 +84,6 @@ class TFT_FSMC { } }; - #ifdef STM32F1xx #define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, AFIO_NONE) #elif defined(STM32F4xx) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp index 1f09153143..a57dfc504b 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp @@ -44,7 +44,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_about(void) { +void lv_draw_about() { scr = lv_screen_create(ABOUT_UI); 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); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_about.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_about.h index 9eae2b06ca..77d66aef11 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_about.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_about.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_about(void); +extern void lv_draw_about(); extern void lv_clear_about(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp index ffb6f01579..560f5460f5 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp @@ -107,7 +107,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_acceleration_settings(void) { +void lv_draw_acceleration_settings() { scr = lv_screen_create(ACCELERATION_UI, machine_menu.AccelerationConfTitle); if (uiCfg.para_ui_page != 1) { diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.h index 6ab49713c9..dc72739106 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_acceleration_settings(void); +extern void lv_draw_acceleration_settings(); extern void lv_clear_acceleration_settings(); #ifdef __cplusplus 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 534fd6072c..feefc4107c 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 @@ -69,7 +69,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_advance_settings(void) { +void lv_draw_advance_settings() { scr = lv_screen_create(ADVANCED_UI, machine_menu.AdvancedConfTitle); int index = 0; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.h index 84e4a4d4cf..8885fc6a4e 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_advance_settings(void); +extern void lv_draw_advance_settings(); extern void lv_clear_advance_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.cpp index 3b39debe57..e41ad44c7a 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.cpp @@ -64,7 +64,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_auto_level_offset_settings(void) { +void lv_draw_auto_level_offset_settings() { scr = lv_screen_create(NOZZLE_PROBE_OFFSET_UI, machine_menu.OffsetConfTitle); sprintf_P(public_buf_l, PSTR("%.1f"), TERN(HAS_PROBE_XY_OFFSET, probe.offset.x, 0)); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.h index 688cd205d0..ec61862a24 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_auto_level_offset_settings(void); +extern void lv_draw_auto_level_offset_settings(); extern void lv_clear_auto_level_offset_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.cpp index dce83bad2b..255f6e8f8a 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.cpp @@ -111,7 +111,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_baby_stepping(void) { +void lv_draw_baby_stepping() { scr = lv_screen_create(BABY_STEP_UI); lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_BABY_STEP_X_P); lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_X_N); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.h index 5886a20583..8793ad772f 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_baby_stepping(void); +extern void lv_draw_baby_stepping(); extern void lv_clear_baby_stepping(); extern void disp_baby_step_dist(); extern void disp_z_offset_value(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.cpp index afb0245e2f..635625950b 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.cpp @@ -115,7 +115,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_change_speed(void) { +void lv_draw_change_speed() { scr = lv_screen_create(CHANGE_SPEED_UI); // Create an Image button lv_big_button_create(scr, "F:/bmp_Add.bin", speed_menu.add, INTERVAL_V, titleHeight, event_handler, ID_C_ADD); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.h index 8fa4c803af..75e4fe3099 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.h @@ -28,7 +28,7 @@ #define MIN_EXT_SPEED_PERCENT 10 #define MAX_EXT_SPEED_PERCENT 999 -extern void lv_draw_change_speed(void); +extern void lv_draw_change_speed(); extern void lv_clear_change_speed(); extern void disp_speed_step(); extern void disp_print_speed(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.cpp index 9eaf4d29df..ae8fe3a321 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.cpp @@ -60,7 +60,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) { } } -void lv_draw_cloud_bind(void) { +void lv_draw_cloud_bind() { lv_obj_t *buttonBack = NULL, *label_Back = NULL; scr = lv_screen_create(BIND_UI); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.h index f0f354a065..1626680051 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_cloud_bind(void); +extern void lv_draw_cloud_bind(); extern void lv_clear_cloud_bind(); extern void disp_bind_state(); extern void refresh_bind_ui(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.cpp index 924c69536a..15e319f4a6 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.cpp @@ -65,7 +65,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_eeprom_settings(void) { +void lv_draw_eeprom_settings() { scr = lv_screen_create(EEPROM_SETTINGS_UI); lv_screen_menu_item(scr, eeprom_menu.revert, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_EEPROM_REVERT, 0); lv_screen_menu_item(scr, eeprom_menu.store, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_EEPROM_STORE, 1); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.h index 6d5ecf0870..3d9f7cae00 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_eeprom_settings(void); +extern void lv_draw_eeprom_settings(); extern void lv_clear_eeprom_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_encoder_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_encoder_settings.cpp index c9c2d4f28d..e090c6a3b5 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_encoder_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_encoder_settings.cpp @@ -54,7 +54,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_encoder_settings(void) { +void lv_draw_encoder_settings() { scr = lv_screen_create(ENCODER_SETTINGS_UI, machine_menu.EncoderConfTitle); buttonEncoderState = lv_screen_menu_item_onoff(scr, machine_menu.EncoderConfText, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ENCODER_STATE, 0, gCfgItems.encoder_enable); lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_ENCODER_RETURN, true); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_encoder_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_encoder_settings.h index 62892a6ec1..392dc67db7 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_encoder_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_encoder_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_encoder_settings(void); +extern void lv_draw_encoder_settings(); extern void lv_clear_encoder_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp index 394c702132..2fdd2c3f2c 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp @@ -117,7 +117,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_extrusion(void) { +void lv_draw_extrusion() { scr = lv_screen_create(EXTRUSION_UI); // Create image buttons lv_obj_t *buttonAdd = lv_big_button_create(scr, "F:/bmp_in.bin", extrude_menu.in, INTERVAL_V, titleHeight, event_handler, ID_E_ADD); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.h index 6178a8e19f..75db2fbab5 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_extrusion(void); +extern void lv_draw_extrusion(); extern void lv_clear_extrusion(); extern void disp_ext_type(); extern void disp_ext_step(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_fan.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_fan.cpp index cd74a55e65..af8b441f24 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_fan.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_fan.cpp @@ -74,7 +74,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { gcode.process_subcommands_now(public_buf_l); } -void lv_draw_fan(void) { +void lv_draw_fan() { lv_obj_t *buttonAdd; #if HAS_FAN diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_fan.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_fan.h index 5a3323e2f2..d9b23fbbe4 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_fan.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_fan.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_fan(void); +extern void lv_draw_fan(); extern void lv_clear_fan(); extern void disp_fan_value(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp index 39d32fa745..017b7120f0 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp @@ -105,7 +105,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_filament_change(void) { +void lv_draw_filament_change() { scr = lv_screen_create(FILAMENTCHANGE_UI); // Create an Image button lv_obj_t *buttonIn = lv_big_button_create(scr, "F:/bmp_in.bin", filament_menu.in, INTERVAL_V, titleHeight, event_handler, ID_FILAMNT_IN); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.h index 18efe5839e..9c1c9a8767 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_filament_change(void); +extern void lv_draw_filament_change(); extern void lv_clear_filament_change(); extern void disp_filament_type(); extern void disp_filament_temp(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp index 2c9c3882f0..4dcd9b8b19 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp @@ -88,7 +88,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_filament_settings(void) { +void lv_draw_filament_settings() { scr = lv_screen_create(FILAMENT_SETTINGS_UI, machine_menu.FilamentConfTitle); if (uiCfg.para_ui_page != 1) { diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.h index a5ae542895..f9967df31f 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_filament_settings(void); +extern void lv_draw_filament_settings(); extern void lv_clear_filament_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp index 5e5b5f36a0..a737197fce 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp @@ -72,7 +72,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_home(void) { +void lv_draw_home() { scr = lv_screen_create(ZERO_UI); lv_big_button_create(scr, "F:/bmp_zeroAll.bin", home_menu.home_all, INTERVAL_V, titleHeight, event_handler, ID_H_ALL); lv_big_button_create(scr, "F:/bmp_zeroX.bin", home_menu.home_x, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_H_X); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_home.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_home.h index a8f11d9237..779cbb0130 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_home.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_home.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_home(void); +extern void lv_draw_home(); extern void lv_clear_home(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_homing_sensitivity_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_homing_sensitivity_settings.cpp index cbd028b60a..9a1c9dec2a 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_homing_sensitivity_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_homing_sensitivity_settings.cpp @@ -74,7 +74,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_homing_sensitivity_settings(void) { +void lv_draw_homing_sensitivity_settings() { scr = lv_screen_create(HOMING_SENSITIVITY_UI, machine_menu.HomingSensitivityConfTitle); sprintf_P(public_buf_l, PSTR("%d"), TERN(X_SENSORLESS, stepperX.homing_threshold(), 0)); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_homing_sensitivity_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_homing_sensitivity_settings.h index 0c554702b1..c6f0e11457 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_homing_sensitivity_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_homing_sensitivity_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_homing_sensitivity_settings(void); +extern void lv_draw_homing_sensitivity_settings(); extern void lv_clear_homing_sensitivity_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.cpp index f07c2761b6..1c4ac9da61 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.cpp @@ -70,7 +70,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_jerk_settings(void) { +void lv_draw_jerk_settings() { scr = lv_screen_create(JERK_UI, machine_menu.JerkConfTitle); sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[X_AXIS]); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.h index 0531dae9da..69fd344609 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_jerk_settings(void); +extern void lv_draw_jerk_settings(); extern void lv_clear_jerk_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp index 7edb73b71f..5953d04184 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp @@ -183,7 +183,7 @@ static void disp_language(uint8_t language, uint8_t state) { if (state == UNSELECTED) lv_obj_refresh_ext_draw_pad(obj); } -void lv_draw_language(void) { +void lv_draw_language() { scr = lv_screen_create(LANGUAGE_UI); // Create image buttons buttonCN = lv_big_button_create(scr, "F:/bmp_simplified_cn.bin", language_menu.chinese_s, INTERVAL_V, titleHeight, event_handler, ID_CN); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_language.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_language.h index d4ee14f30a..9e769e3692 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_language.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_language.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_language(void); +extern void lv_draw_language(); extern void lv_clear_language(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_level_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_level_settings.cpp index 6d495494bf..58c6337204 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_level_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_level_settings.cpp @@ -60,7 +60,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_level_settings(void) { +void lv_draw_level_settings() { scr = lv_screen_create(LEVELING_PARA_UI, machine_menu.LevelingParaConfTitle); lv_screen_menu_item(scr, machine_menu.LevelingManuPosConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_LEVEL_POSITION, 0); lv_screen_menu_item(scr, machine_menu.LevelingAutoCommandConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_LEVEL_COMMAND, 1); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_level_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_level_settings.h index ce290172b6..95a4e2e2e5 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_level_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_level_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_level_settings(void); +extern void lv_draw_level_settings(); extern void lv_clear_level_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp index 5f81d7b369..971ea8a69e 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp @@ -65,7 +65,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_machine_para(void) { +void lv_draw_machine_para() { scr = lv_screen_create(MACHINE_PARA_UI); lv_screen_menu_item(scr, MachinePara_menu.MachineSetting, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PARA_MACHINE, 0); lv_screen_menu_item(scr, MachinePara_menu.MotorSetting, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_PARA_MOTOR, 1); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.h index e830f75db7..652a7e1eb7 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_machine_para(void); +extern void lv_draw_machine_para(); extern void lv_clear_machine_para(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp index deeb51ab0f..b79605d74f 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp @@ -62,7 +62,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_machine_settings(void) { +void lv_draw_machine_settings() { scr = lv_screen_create(MACHINE_SETTINGS_UI, machine_menu.MachineConfigTitle); lv_screen_menu_item(scr, machine_menu.AccelerationConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MACHINE_ACCELERATION, 0); lv_screen_menu_item(scr, machine_menu.MaxFeedRateConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_MACHINE_FEEDRATE, 1); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.h index 38d02e7189..dd988ede72 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_machine_settings(void); +extern void lv_draw_machine_settings(); extern void lv_clear_machine_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp index 338cb1fecc..51761da8f3 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp @@ -113,7 +113,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_manualLevel(void) { +void lv_draw_manualLevel() { scr = lv_screen_create(LEVELING_UI); // Create an Image button lv_obj_t *buttonPoint1 = lv_big_button_create(scr, "F:/bmp_leveling1.bin", leveling_menu.position1, INTERVAL_V, titleHeight, event_handler, ID_M_POINT1); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.h index 60de0b4fe0..4e9b8275ba 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_manualLevel(void); +extern void lv_draw_manualLevel(); extern void lv_clear_manualLevel(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.cpp index 135838a08b..554c32be94 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.cpp @@ -101,7 +101,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_draw_number_key(); } -void lv_draw_manual_level_pos_settings(void) { +void lv_draw_manual_level_pos_settings() { char buf2[50]; scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.h index 8e89ecf559..83fd225bd3 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_manual_level_pos_settings(void); +extern void lv_draw_manual_level_pos_settings(); extern void lv_clear_manual_level_pos_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp index dc66bea9c3..393d4736ea 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp @@ -79,7 +79,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_draw_number_key(); } -void lv_draw_max_feedrate_settings(void) { +void lv_draw_max_feedrate_settings() { scr = lv_screen_create(MAXFEEDRATE_UI, machine_menu.MaxFeedRateConfTitle); if (uiCfg.para_ui_page != 1) { diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.h index 78caca5ade..f82ffd0eaa 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_max_feedrate_settings(void); +extern void lv_draw_max_feedrate_settings(); extern void lv_clear_max_feedrate_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_more.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_more.cpp index f718e62589..76bb34988a 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_more.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_more.cpp @@ -33,53 +33,28 @@ extern lv_group_t * g; static lv_obj_t * scr; -#define ID_CUSTOM_1 1 -#define ID_CUSTOM_2 2 -#define ID_CUSTOM_3 3 -#define ID_CUSTOM_4 4 -#define ID_CUSTOM_5 5 -#define ID_CUSTOM_6 6 -#define ID_CUSTOM_7 7 -#define ID_M_RETURN 8 +enum { + ID_GCODE = 1, + ID_CUSTOM_1, + ID_CUSTOM_2, + ID_CUSTOM_3, + ID_CUSTOM_4, + ID_CUSTOM_5, + ID_CUSTOM_6, + ID_CUSTOM_7, + ID_M_RETURN, +}; static void event_handler(lv_obj_t * obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { - #if ENABLED(USER_CMD_1_ENABLE) - case ID_CUSTOM_1: - queue.inject_P(PSTR(USER_GCODE_1)); - break; - #endif - #if ENABLED(USER_CMD_2_ENABLE) - case ID_CUSTOM_2: - queue.inject_P(PSTR(USER_GCODE_2)); - break; - #endif - #if ENABLED(USER_CMD_3_ENABLE) - case ID_CUSTOM_3: - queue.inject_P(PSTR(USER_GCODE_3)); - break; - #endif - #if ENABLED(USER_CMD_4_ENABLE) - case ID_CUSTOM_4: - queue.inject_P(PSTR(USER_GCODE_4)); - break; - #endif - #if ENABLED(USER_CMD_5_ENABLE) - case ID_CUSTOM_5: - queue.inject_P(PSTR(USER_GCODE_5)); - break; - #endif - #if ENABLED(USER_CMD_6_ENABLE) - case ID_CUSTOM_6: - queue.inject_P(PSTR(USER_GCODE_6)); - break; - #endif - #if ENABLED(USER_CMD_7_ENABLE) - case ID_CUSTOM_7: - queue.inject_P(PSTR(USER_GCODE_7)); - break; - #endif + case ID_CUSTOM_1: TERN_(USER_CMD_1_ENABLE, queue.inject_P(PSTR(USER_GCODE_1))); break; + case ID_CUSTOM_2: TERN_(USER_CMD_2_ENABLE, queue.inject_P(PSTR(USER_GCODE_2))); break; + case ID_CUSTOM_3: TERN_(USER_CMD_3_ENABLE, queue.inject_P(PSTR(USER_GCODE_3))); break; + case ID_CUSTOM_4: TERN_(USER_CMD_4_ENABLE, queue.inject_P(PSTR(USER_GCODE_4))); break; + case ID_CUSTOM_5: TERN_(USER_CMD_5_ENABLE, queue.inject_P(PSTR(USER_GCODE_5))); break; + case ID_CUSTOM_6: TERN_(USER_CMD_6_ENABLE, queue.inject_P(PSTR(USER_GCODE_6))); break; + case ID_CUSTOM_7: TERN_(USER_CMD_7_ENABLE, queue.inject_P(PSTR(USER_GCODE_7))); break; case ID_M_RETURN: lv_clear_more(); lv_draw_tool(); @@ -87,7 +62,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) { } } -void lv_draw_more(void) { +void lv_draw_more() { scr = lv_screen_create(MORE_UI); const bool enc_ena = TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable); @@ -173,27 +148,13 @@ void lv_draw_more(void) { #if BUTTONS_EXIST(EN1, EN2, ENC) if (enc_ena) { - #if ENABLED(USER_CMD_1_ENABLE) - lv_group_add_obj(g, buttonCustom1); - #endif - #if ENABLED(USER_CMD_2_ENABLE) - lv_group_add_obj(g, buttonCustom2); - #endif - #if ENABLED(USER_CMD_3_ENABLE) - lv_group_add_obj(g, buttonCustom3); - #endif - #if ENABLED(USER_CMD_4_ENABLE) - lv_group_add_obj(g, buttonCustom4); - #endif - #if ENABLED(USER_CMD_5_ENABLE) - lv_group_add_obj(g, buttonCustom5); - #endif - #if ENABLED(USER_CMD_6_ENABLE) - lv_group_add_obj(g, buttonCustom6); - #endif - #if ENABLED(USER_CMD_7_ENABLE) - lv_group_add_obj(g, buttonCustom7); - #endif + TERN_(USER_CMD_1_ENABLE, lv_group_add_obj(g, buttonCustom1)); + TERN_(USER_CMD_2_ENABLE, lv_group_add_obj(g, buttonCustom2)); + TERN_(USER_CMD_3_ENABLE, lv_group_add_obj(g, buttonCustom3)); + TERN_(USER_CMD_4_ENABLE, lv_group_add_obj(g, buttonCustom4)); + TERN_(USER_CMD_5_ENABLE, lv_group_add_obj(g, buttonCustom5)); + TERN_(USER_CMD_6_ENABLE, lv_group_add_obj(g, buttonCustom6)); + TERN_(USER_CMD_7_ENABLE, lv_group_add_obj(g, buttonCustom7)); lv_group_add_obj(g, buttonBack); } #endif diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_more.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_more.h index 9dfa705c8e..2a68d3da99 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_more.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_more.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_more(void); +extern void lv_draw_more(); extern void lv_clear_more(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp index 860db5d89d..ec948f10be 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp @@ -68,7 +68,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_motor_settings(void) { +void lv_draw_motor_settings() { int index = 0; scr = lv_screen_create(MOTOR_SETTINGS_UI, machine_menu.MotorConfTitle); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.h index 9a1c7a4db5..632f7bd24d 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_motor_settings(void); +extern void lv_draw_motor_settings(); extern void lv_clear_motor_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp index ce240bf16d..6db1810fcf 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp @@ -35,7 +35,7 @@ static lv_obj_t *scr; static lv_obj_t *labelV, *buttonV, *labelP; static lv_task_t *updatePosTask; -static char cur_label = 'Z'; +static char cur_label = 'Z'; static float cur_pos = 0; void disp_cur_pos(); @@ -90,7 +90,7 @@ void refresh_pos(lv_task_t *) { disp_cur_pos(); } -void lv_draw_move_motor(void) { +void lv_draw_move_motor() { scr = lv_screen_create(MOVE_MOTOR_UI); lv_obj_t *buttonXI = lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_M_X_P); lv_obj_clear_protect(buttonXI, LV_PROTECT_FOLLOW); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.h index 4e41c5ff94..a9b75c1d13 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_move_motor(void); +extern void lv_draw_move_motor(); extern void lv_clear_move_motor(); extern void disp_move_dist(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp index 1c339bde7e..0694f89d74 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp @@ -656,7 +656,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_number_key(void) { +void lv_draw_number_key() { scr = lv_screen_create(NUMBER_KEY_UI, ""); buttonValue = lv_btn_create(scr, 92, 40, 296, 40, event_handler, ID_NUM_KEY1, &style_num_text); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.h index 7902da3649..dbf9015452 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_number_key(void); +extern void lv_draw_number_key(); extern void lv_clear_number_key(); #ifdef __cplusplus 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 50aa85e338..eb4b370838 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp @@ -114,7 +114,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_operation(void) { +void lv_draw_operation() { lv_obj_t *buttonExtrusion = nullptr, *buttonSpeed = nullptr, *buttonBack = nullptr, *labelPreHeat = nullptr, *labelExtrusion = nullptr, diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_operation.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_operation.h index 0257812ec9..e034f7070b 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_operation.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_operation.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_operation(void); +extern void lv_draw_operation(); extern void lv_clear_operation(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.cpp index 59c30bdb95..46aa1a58d1 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.cpp @@ -59,7 +59,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_draw_number_key(); } -void lv_draw_pause_position(void) { +void lv_draw_pause_position() { scr = lv_screen_create(PAUSE_POS_UI, machine_menu.PausePosText); sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.h index 3e9e079827..e7c92a7396 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_pause_position(void); +extern void lv_draw_pause_position(); extern void lv_clear_pause_position(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp index e1d2aecbe0..43f82bca24 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp @@ -153,7 +153,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_preHeat(void) { +void lv_draw_preHeat() { scr = lv_screen_create(PRE_HEAT_UI); // Create image buttons diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.h index 602f5e9066..da3ce88384 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_preHeat(void); +extern void lv_draw_preHeat(); extern void lv_clear_preHeat(); extern void disp_temp_type(); extern void disp_step_heat(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp index 96a6bc1177..0a8f81ea86 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp @@ -73,8 +73,7 @@ uint8_t sel_id = 0; for (uint16_t i = 0; i < fileCnt; i++) { if (list_file.Sd_file_cnt == list_file.Sd_file_offset) { - const uint16_t nr = SD_ORDER(i, fileCnt); - card.getfilename_sorted(nr); + card.getfilename_sorted(SD_ORDER(i, fileCnt)); list_file.IsFolder[valid_name_cnt] = card.flag.filenameIsDir; strcpy(list_file.file_name[valid_name_cnt], list_file.curDirPath); @@ -205,7 +204,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_print_file(void) { +void lv_draw_print_file() { //uint8_t i; uint8_t file_count; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.h index ac3539e71d..759ccdc1c0 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.h @@ -50,7 +50,7 @@ typedef struct { extern LIST_FILE list_file; extern void disp_gcode_icon(uint8_t file_num); -extern void lv_draw_print_file(void); +extern void lv_draw_print_file(); extern uint32_t lv_open_gcode_file(char *path); extern void lv_gcode_file_read(uint8_t *data_buf); extern void lv_close_gcode_file(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp index 13fad747fa..169cf1af7c 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp @@ -110,7 +110,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_printing(void) { +void lv_draw_printing() { disp_state_stack._disp_index = 0; ZERO(disp_state_stack._disp_state); scr = lv_screen_create(PRINTING_UI); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.h index d6da1a1005..7c98fd767b 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.h @@ -36,7 +36,7 @@ enum { STOP }; -extern void lv_draw_printing(void); +extern void lv_draw_printing(); extern void lv_clear_printing(); extern void disp_ext_temp(); extern void disp_bed_temp(); 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 b16019e8d1..97200efb08 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 @@ -110,7 +110,7 @@ void mks_disp_test() { #endif } -void lv_draw_ready_print(void) { +void lv_draw_ready_print() { char buf[30] = {0}; lv_obj_t *buttonTool; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h index 7a803f80a4..a3cfd67665 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_ready_print(void); +extern void lv_draw_ready_print(); extern void mks_disp_test(); extern void disp_Limit_ok(); extern void disp_Limit_error(); 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 fa8622e69d..f6702b559e 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp @@ -109,7 +109,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_set(void) { +void lv_draw_set() { scr = lv_screen_create(SET_UI); lv_big_button_create(scr, "F:/bmp_eeprom_settings.bin", set_menu.eepromSet, INTERVAL_V, titleHeight, event_handler, ID_S_EEPROM_SET); lv_big_button_create(scr, "F:/bmp_fan.bin", set_menu.fan, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_S_FAN); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_set.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_set.h index eed0c6c959..8ad8b9f2ea 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_set.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_set.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_set(void); +extern void lv_draw_set(); extern void lv_clear_set(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp index 88cebc4218..0f66e5e62d 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp @@ -78,7 +78,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_draw_number_key(); } -void lv_draw_step_settings(void) { +void lv_draw_step_settings() { scr = lv_screen_create(STEPS_UI, machine_menu.StepsConfTitle); if (uiCfg.para_ui_page != 1) { diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.h index b7eaeb4c61..249e5a7942 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_step_settings(void); +extern void lv_draw_step_settings(); extern void lv_clear_step_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp index 028c58ab43..3d503b2115 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp @@ -91,7 +91,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } -void lv_draw_tmc_current_settings(void) { +void lv_draw_tmc_current_settings() { scr = lv_screen_create(TMC_CURRENT_UI, machine_menu.TmcCurrentConfTitle); float milliamps; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.h index 927db37138..8310305e61 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_tmc_current_settings(void); +extern void lv_draw_tmc_current_settings(); extern void lv_clear_tmc_current_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp index 691e46f01d..51108dedcf 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp @@ -107,7 +107,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_tmc_step_mode_settings(void) { +void lv_draw_tmc_step_mode_settings() { buttonXState = buttonYState = buttonZState = buttonE0State = buttonE1State = nullptr; scr = lv_screen_create(TMC_MODE_UI, machine_menu.TmcStepModeConfTitle); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.h index 35c57ab0cc..a15baf21e8 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_tmc_step_mode_settings(void); +extern void lv_draw_tmc_step_mode_settings(); extern void lv_clear_tmc_step_mode_settings(); #ifdef __cplusplus diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp index c48d275e01..23acbb4f84 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp @@ -50,25 +50,13 @@ enum { static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; - #if ENABLED(AUTO_BED_LEVELING_BILINEAR) - bool clear = (obj->mks_obj_id != ID_T_LEVELING); - #else - constexpr bool clear = true; - #endif - if (clear) lv_clear_tool(); + if (TERN1(AUTO_BED_LEVELING_BILINEAR, obj->mks_obj_id != ID_T_LEVELING)) + lv_clear_tool(); switch (obj->mks_obj_id) { - case ID_T_PRE_HEAT: - lv_draw_preHeat(); - break; - case ID_T_EXTRUCT: - lv_draw_extrusion(); - break; - case ID_T_MOV: - lv_draw_move_motor(); - break; - case ID_T_HOME: - lv_draw_home(); - break; + case ID_T_PRE_HEAT: lv_draw_preHeat(); break; + case ID_T_EXTRUCT: lv_draw_extrusion(); break; + case ID_T_MOV: lv_draw_move_motor(); break; + case ID_T_HOME: lv_draw_home(); break; case ID_T_LEVELING: #if ENABLED(AUTO_BED_LEVELING_BILINEAR) get_gcode_command(AUTO_LEVELING_COMMAND_ADDR,(uint8_t *)public_buf_m); @@ -91,7 +79,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_tool(void) { +void lv_draw_tool() { scr = lv_screen_create(TOOL_UI); lv_big_button_create(scr, "F:/bmp_preHeat.bin", tool_menu.preheat, INTERVAL_V, titleHeight, event_handler, ID_T_PRE_HEAT); lv_big_button_create(scr, "F:/bmp_extruct.bin", tool_menu.extrude, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_T_EXTRUCT); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.h index 2191adccbc..1cfd297aba 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.h @@ -25,7 +25,7 @@ extern "C" { /* C-declarations for C++ */ #endif -extern void lv_draw_tool(void); +extern void lv_draw_tool(); extern void lv_clear_tool(); #ifdef __cplusplus 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 bb6e9419f0..50282536e6 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp @@ -72,9 +72,6 @@ extern bool once_flag; extern uint8_t sel_id; extern lv_group_t *g; -extern uint8_t bmp_public_buf[14 * 1024]; -extern uint8_t public_buf[513]; - extern void LCD_IO_WriteData(uint16_t RegValue); static const char custom_gcode_command[][100] = { 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 68ef59728e..2728a07ef1 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h @@ -444,7 +444,7 @@ extern lv_point_t line_points[4][2]; extern void gCfgItems_init(); extern void ui_cfg_init(); extern void tft_style_init(); -extern char *creat_title_text(void); +extern char *creat_title_text(); extern void preview_gcode_prehandle(char *path); extern void update_spi_flash(); extern void update_gcode_command(int addr,uint8_t *s); 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 d52d508eb3..fe22923b44 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp @@ -59,7 +59,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_wifi(void) { +void lv_draw_wifi() { scr = lv_screen_create(WIFI_UI); lv_obj_t *buttonReconnect = nullptr, *label_Reconnect = nullptr; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.h index 966a84d3b1..1187741ad6 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.h @@ -26,7 +26,7 @@ #endif -extern void lv_draw_wifi(void); +extern void lv_draw_wifi(); extern void lv_clear_wifi(); extern void disp_wifi_state(); 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 699b3fdaef..d45f9980fc 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 @@ -88,7 +88,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_wifi_list(void) { +void lv_draw_wifi_list() { scr = lv_screen_create(WIFI_LIST_UI); lv_obj_t *buttonDown = lv_imgbtn_create(scr, "F:/bmp_pageDown.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL + INTERVAL_H, event_handler, ID_WL_DOWN); @@ -130,7 +130,7 @@ void lv_draw_wifi_list(void) { disp_wifi_list(); } -void disp_wifi_list(void) { +void disp_wifi_list() { int8_t tmpStr[WIFI_NAME_BUFFER_SIZE] = { 0 }; uint8_t i, j; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.h index e2d9275ef9..e42b738f14 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.h @@ -27,7 +27,7 @@ extern void lv_draw_wifi_list(); extern void lv_clear_wifi_list(); -extern void disp_wifi_list(void); +extern void disp_wifi_list(); extern void cutWifiName(char *name, int len,char *outStr); extern void wifi_scan_handle(); 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 9c8c094e4c..fd2c6467e7 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 @@ -93,7 +93,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } } -void lv_draw_wifi_settings(void) { +void lv_draw_wifi_settings() { scr = lv_screen_create(WIFI_SETTINGS_UI, machine_menu.WifiConfTitle); lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.wifiMode); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_settings.h index c0d6e0ccdd..605423b131 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_settings.h @@ -28,7 +28,7 @@ #define WIFI_AP_TEXT "AP" #define WIFI_STA_TEXT "STA" -extern void lv_draw_wifi_settings(void); +extern void lv_draw_wifi_settings(); extern void lv_clear_wifi_settings(); #ifdef __cplusplus 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 7428d36488..3db89a87c9 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 @@ -36,7 +36,7 @@ TIPS_TYPE wifi_tips_type; TIPS_DISP tips_disp; tips_menu_def tips_menu; -void lv_draw_wifi_tips(void) { +void lv_draw_wifi_tips() { static lv_obj_t *text_tips,*wifi_name; scr = lv_screen_create(WIFI_TIPS_UI, ""); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.h index 4f81f00a43..f9896edcc8 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.h @@ -26,7 +26,7 @@ #endif -extern void lv_draw_wifi_tips(void); +extern void lv_draw_wifi_tips(); extern void lv_clear_wifi_tips(); typedef enum { 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 388c4a35b8..98b4aff881 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/irq_overrid.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/irq_overrid.cpp @@ -45,7 +45,7 @@ #define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH); #define WIFI_IO1_RESET() WRITE(WIFI_IO1_PIN, LOW); -void __irq_usart1(void) { +void __irq_usart1() { if ((USART1_BASE->CR1 & USART_CR1_RXNEIE) && (USART1_BASE->SR & USART_SR_RXNE)) WRITE(WIFI_IO1_PIN, HIGH); 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 4fdc946cca..2261eeeba9 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 @@ -399,7 +399,6 @@ #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_EN "Load filament completed,\nclick for return!" #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_EN "Unload filament completed,\nclick for return!" - #define PRE_HEAT_EXT_TEXT_EN "E" #define PRE_HEAT_BED_TEXT_EN "Bed" 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 0d4ea1f404..d0ea4e376f 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 @@ -37,9 +37,6 @@ extern uint8_t bmp_public_buf[14 * 1024]; extern uint8_t public_buf[513]; -extern uint8_t bmp_public_buf[14 * 1024]; -extern uint8_t public_buf[513]; - 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); extern bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data); @@ -48,7 +45,7 @@ extern bool my_mousewheel_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * dat extern void LCD_Clear(uint16_t Color); extern void tft_set_point(uint16_t x, uint16_t y, uint16_t point); extern void LCD_setWindowArea(uint16_t StartX, uint16_t StartY, uint16_t width, uint16_t heigh); -extern void LCD_WriteRAM_Prepare(void); +extern void LCD_WriteRAM_Prepare(); extern void lcd_draw_logo(); extern void lv_encoder_pin_init(); extern void lv_update_encoder(); 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 2efe68a4ce..0401faeebd 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 @@ -944,7 +944,7 @@ void disp_language_init() { filesys_menu.sd_sys = SD_CARD_TEXT_CN; filesys_menu.usb_sys = U_DISK_TEXT_CN; // - more_menu.title = TITLE_MORE_CN; + more_menu.title = TITLE_MORE_CN; #if ENABLED(USER_CMD_1_ENABLE) more_menu.custom1 = MORE_CUSTOM1_TEXT_CN; #endif @@ -1006,7 +1006,6 @@ void disp_language_init() { filament_menu.filament_dialog_unloading = FILAMENT_DIALOG_UNLOADING_TIPS_CN; filament_menu.filament_dialog_unload_completed = FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_CN; - // language_menu.title = TITLE_LANGUAGE_CN; language_menu.next = PAGE_DOWN_TEXT_CN; @@ -1191,7 +1190,7 @@ void disp_language_init() { filesys_menu.sd_sys = SD_CARD_TEXT_T_CN; filesys_menu.usb_sys = U_DISK_TEXT_T_CN; // - more_menu.title = TITLE_MORE_T_CN; + more_menu.title = TITLE_MORE_T_CN; #if ENABLED(USER_CMD_1_ENABLE) more_menu.custom1 = MORE_CUSTOM1_TEXT_T_CN; #endif @@ -1423,28 +1422,15 @@ void disp_language_init() { set_menu.shutdown = SHUTDOWN_TEXT_EN; set_menu.machine_para = MACHINE_PARA_EN; set_menu.eepromSet = EEPROM_SETTINGS_EN; + // more_menu.title = TITLE_MORE_EN; - #if ENABLED(USER_CMD_1_ENABLE) - more_menu.custom1 = MORE_CUSTOM1_TEXT_EN; - #endif - #if ENABLED(USER_CMD_2_ENABLE) - more_menu.custom2 = MORE_CUSTOM2_TEXT_EN; - #endif - #if ENABLED(USER_CMD_3_ENABLE) - more_menu.custom3 = MORE_CUSTOM3_TEXT_EN; - #endif - #if ENABLED(USER_CMD_4_ENABLE) - more_menu.custom4 = MORE_CUSTOM4_TEXT_EN; - #endif - #if ENABLED(USER_CMD_5_ENABLE) - more_menu.custom5 = MORE_CUSTOM5_TEXT_EN; - #endif - #if ENABLED(USER_CMD_6_ENABLE) - more_menu.custom6 = MORE_CUSTOM6_TEXT_EN; - #endif - #if ENABLED(USER_CMD_7_ENABLE) - more_menu.custom7 = MORE_CUSTOM7_TEXT_EN; - #endif + TERN_(USER_CMD_1_ENABLE, more_menu.custom1 = MORE_CUSTOM1_TEXT_EN); + TERN_(USER_CMD_2_ENABLE, more_menu.custom2 = MORE_CUSTOM2_TEXT_EN); + TERN_(USER_CMD_3_ENABLE, more_menu.custom3 = MORE_CUSTOM3_TEXT_EN); + TERN_(USER_CMD_4_ENABLE, more_menu.custom4 = MORE_CUSTOM4_TEXT_EN); + TERN_(USER_CMD_5_ENABLE, more_menu.custom5 = MORE_CUSTOM5_TEXT_EN); + TERN_(USER_CMD_6_ENABLE, more_menu.custom6 = MORE_CUSTOM6_TEXT_EN); + TERN_(USER_CMD_7_ENABLE, more_menu.custom7 = MORE_CUSTOM7_TEXT_EN); // filesys_menu.title = TITLE_FILESYS_EN; @@ -2694,28 +2680,14 @@ void disp_language_init() { set_menu.machine_para = MACHINE_PARA_EN; set_menu.eepromSet = EEPROM_SETTINGS_EN; // - more_menu.title = TITLE_MORE_EN; - #if ENABLED(USER_CMD_1_ENABLE) - more_menu.custom1 = MORE_CUSTOM1_TEXT_EN; - #endif - #if ENABLED(USER_CMD_2_ENABLE) - more_menu.custom2 = MORE_CUSTOM2_TEXT_EN; - #endif - #if ENABLED(USER_CMD_3_ENABLE) - more_menu.custom3 = MORE_CUSTOM3_TEXT_EN; - #endif - #if ENABLED(USER_CMD_4_ENABLE) - more_menu.custom4 = MORE_CUSTOM4_TEXT_EN; - #endif - #if ENABLED(USER_CMD_5_ENABLE) - more_menu.custom5 = MORE_CUSTOM5_TEXT_EN; - #endif - #if ENABLED(USER_CMD_6_ENABLE) - more_menu.custom6 = MORE_CUSTOM6_TEXT_EN; - #endif - #if ENABLED(USER_CMD_7_ENABLE) - more_menu.custom7 = MORE_CUSTOM7_TEXT_EN; - #endif + more_menu.title = TITLE_MORE_EN; + TERN_(USER_CMD_1_ENABLE, more_menu.custom1 = MORE_CUSTOM1_TEXT_EN); + TERN_(USER_CMD_2_ENABLE, more_menu.custom2 = MORE_CUSTOM2_TEXT_EN); + TERN_(USER_CMD_3_ENABLE, more_menu.custom3 = MORE_CUSTOM3_TEXT_EN); + TERN_(USER_CMD_4_ENABLE, more_menu.custom4 = MORE_CUSTOM4_TEXT_EN); + TERN_(USER_CMD_5_ENABLE, more_menu.custom5 = MORE_CUSTOM5_TEXT_EN); + TERN_(USER_CMD_6_ENABLE, more_menu.custom6 = MORE_CUSTOM6_TEXT_EN); + TERN_(USER_CMD_7_ENABLE, more_menu.custom7 = MORE_CUSTOM7_TEXT_EN); // filesys_menu.title = TITLE_FILESYS_EN; filesys_menu.sd_sys = SD_CARD_TEXT_EN; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp b/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp index 6999c638f5..9e528821d7 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp @@ -59,7 +59,7 @@ WifiSerial::WifiSerial(usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) { if (with_irq) usart_enable(usart_device); else { usart_reg_map *regs = usart_device->regs; - regs->CR1 |= (USART_CR1_TE | USART_CR1_RE);// don't change the word length etc, and 'or' in the patten not overwrite |USART_CR1_M_8N1); + regs->CR1 |= (USART_CR1_TE | USART_CR1_RE); // don't change the word length etc, and 'or' in the pattern not overwrite |USART_CR1_M_8N1); regs->CR1 |= USART_CR1_UE; } } @@ -71,7 +71,7 @@ WifiSerial::WifiSerial(usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) { if (with_irq) usart_enable(usart_device); else { usart_reg_map *regs = usart_device->regs; - regs->CR1 |= (USART_CR1_TE | USART_CR1_RE);// don't change the word length etc, and 'or' in the patten not overwrite |USART_CR1_M_8N1); + regs->CR1 |= (USART_CR1_TE | USART_CR1_RE); // don't change the word length etc, and 'or' in the pattern not overwrite |USART_CR1_M_8N1); regs->CR1 |= USART_CR1_UE; } } @@ -111,11 +111,11 @@ void WifiSerial::begin(uint32 baud, uint8_t config) { usart_enable_no_irq(this->usart_device, baud == WIFI_BAUDRATE); } -void WifiSerial::end(void) { +void WifiSerial::end() { usart_disable(this->usart_device); } -int WifiSerial::available(void) { +int WifiSerial::available() { return usart_data_available(this->usart_device); } @@ -123,7 +123,7 @@ int WifiSerial::available(void) { // I/O // -int WifiSerial::read(void) { +int WifiSerial::read() { if (usart_data_available(usart_device) <= 0) return -1; return usart_getc(usart_device); } @@ -133,7 +133,7 @@ int WifiSerial::write(unsigned char ch) { return 1; } -int WifiSerial::wifi_rb_is_full(void) { +int WifiSerial::wifi_rb_is_full() { return rb_is_full(this->usart_device->rb); } diff --git a/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h b/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h index 656ec1b9d0..c2885ccc90 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h @@ -58,8 +58,8 @@ class WifiSerial { void begin(uint32 baud); void begin(uint32 baud,uint8_t config); void end(); - int available(void); - int read(void); + int available(); + int read(); int write(uint8_t); inline void wifi_usart_irq(usart_reg_map *regs) { /* Handling RXNEIE and TXEIE interrupts. @@ -87,8 +87,7 @@ class WifiSerial { } } - int wifi_rb_is_full(void); - + int wifi_rb_is_full(); struct usart_dev *usart_device; private: 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 dce4ce5977..eefdbafbda 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp @@ -183,7 +183,7 @@ static bool longName2DosName(const char *longName, uint8_t *dosName) { uint8_t c = *longName++; if (c == '.') { // For a dot... if (i == 0) return false; - strcat((char *)dosName, ".GCO"); + strcat_P((char *)dosName, PSTR(".GCO")); break; } else { @@ -194,7 +194,7 @@ static bool longName2DosName(const char *longName, uint8_t *dosName) { dosName[i++] = c + (WITHIN(c, 'a', 'z') ? 'A' - 'a' : 0); // Uppercase required for 8.3 name } if (i >= 5) { - strcat((char *)dosName, "~1.GCO"); + strcat_P((char *)dosName, PSTR("~1.GCO")); break; } } @@ -212,7 +212,6 @@ static int storeRcvData(volatile uint8_t *bufToCpy, int32_t len) { wifiDmaRcvFifo.write_cur = (tmpW + 1) % TRANS_RCV_FIFO_BLOCK_NUM; return 1; } - return 0; } @@ -253,6 +252,7 @@ static void dma_ch5_irq_handle() { WIFI_IO1_SET(); } } + static void wifi_usart_dma_init() { dma_init(DMA1); uint32_t flags = ( DMA_MINC_MODE | DMA_TRNS_CMPLT | DMA_HALF_TRNS | DMA_TRNS_ERR); @@ -289,7 +289,7 @@ void esp_port_begin(uint8_t interrupt) { if (interrupt) { for (uint16_t i = 0; i < 65535; i++) { /*nada*/ } WIFISERIAL.begin(WIFI_BAUDRATE); - uint32_t serial_connect_timeout = millis() + 1000UL; + millis_t serial_connect_timeout = millis() + 1000UL; while (PENDING(millis(), serial_connect_timeout)) { /*nada*/ } } else { @@ -305,7 +305,7 @@ void esp_port_begin(uint8_t interrupt) { WIFISERIAL.end(); for (uint16_t i = 0; i < 65535; i++) { /*nada*/ } WIFISERIAL.begin(interrupt ? WIFI_BAUDRATE : WIFI_UPLOAD_BAUDRATE); - uint32_t serial_connect_timeout = millis() + 1000UL; + millis_t serial_connect_timeout = millis() + 1000UL; while (PENDING(millis(), serial_connect_timeout)) { /*nada*/ } #endif if (!interrupt) wifi_usart_dma_init(); @@ -511,16 +511,16 @@ int write_to_file(char *buf, int len) { res = upload_file.write(public_buf, file_writer.write_index); } } - if (res == -1) { - return -1; - } + + if (res == -1) return -1; + upload_file.getpos(&pos); file_writer.write_index = 0; } } if (res == -1) { - memset(public_buf, 0, sizeof(public_buf)); + ZERO(public_buf); file_writer.write_index = 0; return -1; } @@ -576,17 +576,16 @@ uint8_t Explore_Disk(char* path , uint8_t recu_level) { for (uint8_t i = 0; i < fileCnt; i++) { card.getfilename_sorted(SD_ORDER(i, fileCnt)); - - memset(tmp, 0, sizeof(tmp)); + ZERO(tmp); strcpy(tmp, card.filename); ZERO(Fstream); strcpy(Fstream, tmp); if (card.flag.filenameIsDir && recu_level <= 10) - strcat(Fstream, ".DIR"); + strcat_P(Fstream, PSTR(".DIR")); - strcat(Fstream, "\r\n"); + strcat_P(Fstream, PSTR("\r\n")); send_to_wifi((uint8_t*)Fstream, strlen(Fstream)); } @@ -662,23 +661,23 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { int index = 0; while (tmpStr[index] == ' ') index++; - if (strstr((char *)&tmpStr[index], ".g") || strstr((char *)&tmpStr[index], ".G")) { + if (strstr_P((char *)&tmpStr[index], PSTR(".g")) || strstr_P((char *)&tmpStr[index], PSTR(".G"))) { if (strlen((char *)&tmpStr[index]) < 80) { ZERO(list_file.file_name[sel_id]); ZERO(list_file.long_name[sel_id]); uint8_t has_path_selected = 0; if (gCfgItems.wifi_type == ESP_WIFI) { - if (strncmp((char *)&tmpStr[index], "1:", 2) == 0) { + if (strncmp_P((char *)&tmpStr[index], PSTR("1:"), 2) == 0) { gCfgItems.fileSysType = FILE_SYS_SD; has_path_selected = 1; } - else if (strncmp((char *)&tmpStr[index], "0:", 2) == 0) { + else if (strncmp_P((char *)&tmpStr[index], PSTR("0:"), 2) == 0) { gCfgItems.fileSysType = FILE_SYS_USB; has_path_selected = 1; } else if (tmpStr[index] != '/') - strcat((char *)list_file.file_name[sel_id], "/"); + strcat_P((char *)list_file.file_name[sel_id], PSTR("/")); if (file_writer.fileTransfer == 1) { uint8_t dosName[FILENAME_LENGTH]; @@ -686,12 +685,11 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { fileName[0] = '\0'; if (has_path_selected == 1) { strcat((char *)fileName, (char *)&tmpStr[index + 3]); - strcat((char *)list_file.file_name[sel_id], "/"); + strcat_P((char *)list_file.file_name[sel_id], PSTR("/")); } else strcat((char *)fileName, (char *)&tmpStr[index]); - if (!longName2DosName((const char *)fileName, dosName)) { - strcpy(list_file.file_name[sel_id], "notValid"); - } + if (!longName2DosName((const char *)fileName, dosName)) + strcpy_P(list_file.file_name[sel_id], PSTR("notValid")); strcat((char *)list_file.file_name[sel_id], (char *)dosName); strcat((char *)list_file.long_name[sel_id], (char *)dosName); } @@ -712,7 +710,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { send_to_wifi((uint8_t *)"File selected\r\n", strlen("File selected\r\n")); else { send_to_wifi((uint8_t *)"file.open failed\r\n", strlen("file.open failed\r\n")); - strcpy(list_file.file_name[sel_id], "notValid"); + strcpy_P(list_file.file_name[sel_id], PSTR("notValid")); } SEND_OK_TO_WIFI; } @@ -721,7 +719,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { break; case 24: - if (strcmp(list_file.file_name[sel_id], "notValid") != 0) { + if (strcmp_P(list_file.file_name[sel_id], PSTR("notValid")) != 0) { if (uiCfg.print_state == IDLE) { clear_cur_ui(); reset_print_time(); @@ -830,7 +828,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)|| (uiCfg.print_state == REPRINTING)) { print_rate = uiCfg.totalSend; ZERO(tempBuf); - sprintf((char *)tempBuf, "M27 %d\r\n", print_rate); + sprintf_P((char *)tempBuf, PSTR("M27 %d\r\n"), print_rate); send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); } break; @@ -842,16 +840,16 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { int index = 0; while (tmpStr[index] == ' ') index++; - if (strstr((char *)&tmpStr[index], ".g") || strstr((char *)&tmpStr[index], ".G")) { + if (strstr_P((char *)&tmpStr[index], PSTR(".g")) || strstr_P((char *)&tmpStr[index], PSTR(".G"))) { strcpy((char *)file_writer.saveFileName, (char *)&tmpStr[index]); if (gCfgItems.fileSysType == FILE_SYS_SD) { ZERO(tempBuf); - sprintf((char *)tempBuf, "%s", file_writer.saveFileName); + sprintf_P((char *)tempBuf, PSTR("%s"), file_writer.saveFileName); } else if (gCfgItems.fileSysType == FILE_SYS_USB) { ZERO(tempBuf); - sprintf((char *)tempBuf, "%s", (char *)file_writer.saveFileName); + sprintf_P((char *)tempBuf, PSTR("%s"), (char *)file_writer.saveFileName); } mount_file_sys(gCfgItems.fileSysType); @@ -862,7 +860,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { ZERO(file_writer.saveFileName); strcpy((char *)file_writer.saveFileName, (char *)&tmpStr[index]); ZERO(tempBuf); - sprintf((char *)tempBuf, "Writing to file: %s\r\n", (char *)file_writer.saveFileName); + sprintf_P((char *)tempBuf, PSTR("Writing to file: %s\r\n"), (char *)file_writer.saveFileName); wifi_ret_ack(); send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); wifi_link_state = WIFI_WAIT_TRANS_START; @@ -881,7 +879,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { ZERO(tempBuf); if (cmd_value == 105) { SEND_OK_TO_WIFI; - sprintf((char *)tempBuf,"T:%.1f /%.1f B:%.1f /%.1f T0:%.1f /%.1f T1:%.1f /%.1f @:0 B@:0\r\n", + sprintf_P((char *)tempBuf, PSTR("T:%.1f /%.1f B:%.1f /%.1f T0:%.1f /%.1f T1:%.1f /%.1f @:0 B@:0\r\n"), (float)thermalManager.temp_hotend[0].celsius, (float)thermalManager.temp_hotend[0].target, #if HAS_HEATED_BED @@ -890,7 +888,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { 0.0f, 0.0f, #endif (float)thermalManager.temp_hotend[0].celsius, (float)thermalManager.temp_hotend[0].target, - #if !defined(SINGLENOZZLE) && HAS_MULTI_EXTRUDER + #if DISABLED(SINGLENOZZLE) && HAS_MULTI_EXTRUDER (float)thermalManager.temp_hotend[1].celsius, (float)thermalManager.temp_hotend[1].target #else 0.0f, 0.0f @@ -898,7 +896,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { ); } else { - sprintf((char *)tempBuf,"T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n", + sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"), (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target, #if HAS_HEATED_BED @@ -907,7 +905,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { 0, 0, #endif (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target, - #if !defined(SINGLENOZZLE) && HAS_MULTI_EXTRUDER + #if DISABLED(SINGLENOZZLE) && HAS_MULTI_EXTRUDER (int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target #else 0, 0 @@ -922,7 +920,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { case 992: if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)) { ZERO(tempBuf); - sprintf((char *)tempBuf, "M992 %d%d:%d%d:%d%d\r\n", print_time.hours/10, print_time.hours%10, print_time.minutes/10, print_time.minutes%10, print_time.seconds/10, print_time.seconds%10); + sprintf_P((char *)tempBuf, PSTR("M992 %d%d:%d%d:%d%d\r\n"), print_time.hours/10, print_time.hours%10, print_time.minutes/10, print_time.minutes%10, print_time.seconds/10, print_time.seconds%10); wifi_ret_ack(); send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); } @@ -932,7 +930,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)) { ZERO(tempBuf); if (strlen((char *)list_file.file_name[sel_id]) > (100 - 1)) return; - sprintf((char *)tempBuf, "M994 %s;%d\n", list_file.file_name[sel_id],(int)gCfgItems.curFilesize); + sprintf_P((char *)tempBuf, PSTR("M994 %s;%d\n"), list_file.file_name[sel_id], (int)gCfgItems.curFilesize); wifi_ret_ack(); send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); } @@ -976,7 +974,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { break; default: - strcat((char *)cmd_line, "\n"); + strcat_P((char *)cmd_line, PSTR("\n")); if (espGcodeFifo.wait_tick > 5) { uint32_t left; @@ -1002,7 +1000,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { } } else { - strcat((char *)cmd_line, "\n"); + strcat_P((char *)cmd_line, PSTR("\n")); if (espGcodeFifo.wait_tick > 5) { uint32_t left_g; @@ -1045,7 +1043,7 @@ static void net_msg_handle(uint8_t * msg, uint16_t msgLen) { if (msgLen <= 0) return; // ip - sprintf(ipPara.ip_addr, "%d.%d.%d.%d", msg[0], msg[1], msg[2], msg[3]); + sprintf_P(ipPara.ip_addr, PSTR("%d.%d.%d.%d"), msg[0], msg[1], msg[2], msg[3]); // port // connect state @@ -1143,16 +1141,15 @@ static void wifi_list_msg_handle(uint8_t * msg, uint16_t msgLen) { memset(str, 0, WIFI_NAME_BUFFER_SIZE); memcpy(str, &msg[wifiMsgIdex], wifiNameLen); for (j = 0; j < valid_name_num; j++) { - if (strcmp((const char *)str,(const char *)wifi_list.wifiName[j]) == 0) { + if (strcmp((const char *)str, (const char *)wifi_list.wifiName[j]) == 0) { wifi_name_is_same = 1; break; } } - if (wifi_name_is_same != 1) { - if (str[0] > 0x80) { - wifi_name_is_same = 1; - } - } + + if (wifi_name_is_same != 1 && str[0] > 0x80) + wifi_name_is_same = 1; + if (wifi_name_is_same == 1) { wifi_name_is_same = 0; wifiMsgIdex += wifiNameLen; @@ -1199,7 +1196,7 @@ static void gcode_msg_handle(uint8_t * msg, uint16_t msgLen) { } } -void utf8_2_unicode(uint8_t *source,uint8_t Len) { +void utf8_2_unicode(uint8_t *source, uint8_t Len) { uint8_t i = 0, char_i = 0, char_byte_num = 0; uint16_t u16_h, u16_m, u16_l, u16_value; uint8_t FileName_unicode[30]; @@ -1216,7 +1213,6 @@ void utf8_2_unicode(uint8_t *source,uint8_t Len) { } else if (char_byte_num == 0XC0 || char_byte_num == 0XD0) { //--2byte - u16_h = (((uint16_t)source[i] << 8) & 0x1F00) >> 2; u16_l = ((uint16_t)source[i + 1] & 0x003F); u16_value = (u16_h | u16_l); @@ -1241,9 +1237,9 @@ void utf8_2_unicode(uint8_t *source,uint8_t Len) { i += 4; //char_i += 3; } - else { + else break; - } + if (i >= Len || i >= 255) break; } COPY(source, FileName_unicode); @@ -1297,7 +1293,7 @@ static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) { lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE); return; } - sprintf((char *)saveFilePath, "%s", dosName); + sprintf_P((char *)saveFilePath, PSTR("%s"), dosName); card.cdroot(); upload_file.close(); @@ -1386,8 +1382,7 @@ static void file_fragment_msg_handle(uint8_t * msg, uint16_t msgLen) { } void esp_data_parser(char *cmdRxBuf, int len) { - int32_t head_pos; - int32_t tail_pos; + int32_t head_pos, tail_pos; uint16_t cpyLen; int16_t leftLen = len; bool loop_again = false; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.cpp b/Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.cpp index 2776db3cac..f4412f3830 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.cpp @@ -338,6 +338,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t // Extract elements from the header resp = (uint8_t)getData(1, hdr, 0); opRet = (uint8_t)getData(1, hdr, 1); + // Sync packets often provoke a response with a zero opcode instead of ESP_SYNC if (resp != 0x01 || opRet != op) return respHeader; @@ -666,14 +667,12 @@ int32_t wifi_upload(int type) { ResetWiFiForUpload(0); - if (type == 0) - SendUpdateFile(ESP_FIRMWARE_FILE, FirmwareAddress); - else if (type == 1) - SendUpdateFile(ESP_WEB_FIRMWARE_FILE, FirmwareAddress); - else if (type == 2) - SendUpdateFile(ESP_WEB_FILE, WebFilesAddress); - else - return -1; + switch (type) { + case 0: SendUpdateFile(ESP_FIRMWARE_FILE, FirmwareAddress); break; + case 1: SendUpdateFile(ESP_WEB_FIRMWARE_FILE, FirmwareAddress); break; + case 2: SendUpdateFile(ESP_WEB_FILE, WebFilesAddress); break; + default: return -1; + } while (esp_upload.state != upload_idle) { upload_spin(); diff --git a/Marlin/src/lcd/tft/tft_queue.cpp b/Marlin/src/lcd/tft/tft_queue.cpp index ea0bf0f00a..3f604005f9 100644 --- a/Marlin/src/lcd/tft/tft_queue.cpp +++ b/Marlin/src/lcd/tft/tft_queue.cpp @@ -142,7 +142,6 @@ void TFT_Queue::canvas(queueTask_t *task) { if (Canvas.ToScreen()) task->state = TASK_STATE_COMPLETED; } - void TFT_Queue::fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { finish_sketch(); diff --git a/Marlin/src/libs/W25Qxx.cpp b/Marlin/src/libs/W25Qxx.cpp index dc96758e6d..be5b4290dd 100644 --- a/Marlin/src/libs/W25Qxx.cpp +++ b/Marlin/src/libs/W25Qxx.cpp @@ -330,9 +330,8 @@ void W25QXXFlash::SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, ui pBuffer += count; SPI_FLASH_PageWrite(pBuffer, WriteAddr, temp); } - else { + else SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite); - } } else { // NumByteToWrite > SPI_FLASH_PageSize NumByteToWrite -= count; @@ -387,9 +386,9 @@ void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint pBuffer++; } } - else { + else spi_flash_Read(pBuffer, NumByteToRead); - } + W25QXX_CS_H; }