Browse Source

More LVGL UI code reduction (#19879)

vanilla_fb_2.0.x
Victor Oliveira 4 years ago
committed by GitHub
parent
commit
853d01de68
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp
  2. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp
  3. 11
      Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp
  4. 13
      Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp
  5. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.cpp
  6. 13
      Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.cpp
  7. 13
      Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.cpp
  8. 13
      Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp
  9. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.cpp
  10. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_encoder_settings.cpp
  11. 9
      Marlin/src/lcd/extui/lib/mks_ui/draw_error_message.cpp
  12. 13
      Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp
  13. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_fan.cpp
  14. 13
      Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp
  15. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp
  16. 13
      Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp
  17. 10
      Marlin/src/lcd/extui/lib/mks_ui/draw_homing_sensitivity_settings.cpp
  18. 10
      Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.cpp
  19. 19
      Marlin/src/lcd/extui/lib/mks_ui/draw_keyboard.cpp
  20. 15
      Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp
  21. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_level_settings.cpp
  22. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp
  23. 13
      Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp
  24. 11
      Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp
  25. 9
      Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.cpp
  26. 10
      Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp
  27. 14
      Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp
  28. 13
      Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp
  29. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp
  30. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp
  31. 10
      Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.cpp
  32. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp
  33. 5
      Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp
  34. 10
      Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp
  35. 7
      Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp
  36. 13
      Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp
  37. 10
      Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp
  38. 10
      Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp
  39. 10
      Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp
  40. 15
      Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp
  41. 20
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp
  42. 2
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h
  43. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp
  44. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.cpp
  45. 12
      Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_settings.cpp
  46. 9
      Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.cpp
  47. 2
      Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp
  48. 8
      Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.cpp

2
Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp

@ -185,7 +185,7 @@ void SPIFlashStorage::loadPage(uint8_t* buffer) {
// char fname[256];
// snprintf(fname, sizeof(fname), "./pages/page-%03d.data", m_currentPage);
// FILE *fp = fopen(fname, "rb");
// if (fp != nullptr) {
// if (fp) {
// fread(buffer, 1, SPI_FLASH_PageSize, fp);
// fclose(fp);
// }

12
Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp

@ -49,17 +49,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_about(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ABOUT_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ABOUT_UI;
}
disp_state = ABOUT_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(ABOUT_UI);
// Create an Image button
lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN);

11
Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp

@ -108,16 +108,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_acceleration_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ACCELERATION_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ACCELERATION_UI;
}
disp_state = ACCELERATION_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.AccelerationConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(ACCELERATION_UI, machine_menu.AccelerationConfTitle);
if (uiCfg.para_ui_page != 1) {
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.acceleration);

13
Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp

@ -40,6 +40,7 @@ enum {
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_ADVANCE_RETURN:
lv_clear_advance_settings();
@ -69,17 +70,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_advance_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ADVANCED_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ADVANCED_UI;
}
disp_state = ADVANCED_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.AdvancedConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(ADVANCED_UI, machine_menu.AdvancedConfTitle);
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++);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.cpp

@ -65,17 +65,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_auto_level_offset_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != NOZZLE_PROBE_OFFSET_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = NOZZLE_PROBE_OFFSET_UI;
}
disp_state = NOZZLE_PROBE_OFFSET_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.OffsetConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
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));
lv_screen_menu_item_1_edit(scr, machine_menu.Xoffset, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_OFFSET_X, 0, public_buf_l);

13
Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.cpp

@ -112,18 +112,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_baby_stepping(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != BABY_STEP_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = BABY_STEP_UI;
}
disp_state = BABY_STEP_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_big_button_create(scr, "F:/bmp_yAdd.bin", move_menu.y_add, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_BABY_STEP_Y_P);

13
Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.cpp

@ -126,18 +126,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_change_speed(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != CHANGE_SPEED_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = CHANGE_SPEED_UI;
}
disp_state = CHANGE_SPEED_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_big_button_create(scr, "F:/bmp_Dec.bin", speed_menu.dec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_C_DEC);

13
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp

@ -211,19 +211,8 @@ static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
void lv_draw_dialog(uint8_t type) {
lv_obj_t *btnOk = nullptr, *btnCancel = nullptr;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != DIALOG_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = DIALOG_UI;
}
disp_state = DIALOG_UI;
uiCfg.dialogType = type;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(DIALOG_UI);
lv_obj_t *labelDialog = lv_label_create_empty(scr);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.cpp

@ -66,17 +66,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_eeprom_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != EEPROM_SETTINGS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = EEPROM_SETTINGS_UI;
}
disp_state = EEPROM_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
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_EEPROM_RETURN, true);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_encoder_settings.cpp

@ -55,18 +55,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_encoder_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ENCODER_SETTINGS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ENCODER_SETTINGS_UI;
}
disp_state = ENCODER_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.EncoderConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
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);
}

9
Marlin/src/lcd/extui/lib/mks_ui/draw_error_message.cpp

@ -41,15 +41,8 @@ static lv_obj_t *scr;
void lv_draw_error_message(PGM_P const msg) {
#if 0
static lv_obj_t *message = nullptr, *kill_message = nullptr, *reset_tips = nullptr;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ERROR_MESSAGE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ERROR_MESSAGE_UI;
}
disp_state = ERROR_MESSAGE_UI;
scr = lv_screen_create();
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(ERROR_MESSAGE_UI, "");
if (msg) {
message = lv_label_create(scr, msg);

13
Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp

@ -122,18 +122,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_extrusion(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != EXTRUSION_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = EXTRUSION_UI;
}
disp_state = EXTRUSION_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_fan.cpp

@ -89,18 +89,8 @@ void lv_draw_fan(void) {
#if HAS_FAN
fanSpeed = thermalManager.fan_speed[0];
#endif
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FAN_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = FAN_UI;
}
disp_state = FAN_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(FAN_UI);
// Create an Image button
buttonAdd = lv_big_button_create(scr, "F:/bmp_Add.bin", fan_menu.add, INTERVAL_V, titleHeight, event_handler, ID_F_ADD);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);

13
Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp

@ -112,18 +112,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_filament_change(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FILAMENTCHANGE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = FILAMENTCHANGE_UI;
}
disp_state = FILAMENTCHANGE_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_obj_clear_protect(buttonIn, LV_PROTECT_FOLLOW);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp

@ -89,17 +89,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_filament_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FILAMENT_SETTINGS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = FILAMENT_SETTINGS_UI;
}
disp_state = FILAMENT_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.FilamentConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(FILAMENT_SETTINGS_UI, machine_menu.FilamentConfTitle);
if (uiCfg.para_ui_page != 1) {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_length);

13
Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp

@ -77,18 +77,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_home(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ZERO_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ZERO_UI;
}
disp_state = ZERO_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_big_button_create(scr, "F:/bmp_zeroY.bin", home_menu.home_y, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_H_Y);

10
Marlin/src/lcd/extui/lib/mks_ui/draw_homing_sensitivity_settings.cpp

@ -75,15 +75,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_homing_sensitivity_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != HOMING_SENSITIVITY_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = HOMING_SENSITIVITY_UI;
}
disp_state = HOMING_SENSITIVITY_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.HomingSensitivityConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(HOMING_SENSITIVITY_UI, machine_menu.HomingSensitivityConfTitle);
sprintf_P(public_buf_l, PSTR("%d"), TERN(X_SENSORLESS, stepperX.homing_threshold(), 0));
lv_screen_menu_item_1_edit(scr, machine_menu.X_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_SENSITIVITY_X, 0, public_buf_l);

10
Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.cpp

@ -71,15 +71,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_jerk_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != JERK_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = JERK_UI;
}
disp_state = JERK_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.JerkConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(JERK_UI, machine_menu.JerkConfTitle);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[X_AXIS]);
lv_screen_menu_item_1_edit(scr, machine_menu.X_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_JERK_X, 0, public_buf_l);

19
Marlin/src/lcd/extui/lib/mks_ui/draw_keyboard.cpp

@ -84,7 +84,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
if (lv_btnm_get_btn_ctrl(kb, btn_id, LV_BTNM_CTRL_NO_REPEAT) && event == LV_EVENT_LONG_PRESSED_REPEAT) return;
const char * txt = lv_btnm_get_active_btn_text(kb);
if (txt == nullptr) return;
if (!txt) return;
// Do the corresponding action according to the text of the button
if (strcmp(txt, "abc") == 0) {
@ -169,14 +169,13 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
default: break;
}
}
else {
lv_kb_set_ta(kb, nullptr); /*De-assign the text area to hide it cursor if needed*/
}
else
lv_kb_set_ta(kb, nullptr); // De-assign the text area to hide it cursor if needed
return;
}
/*Add the characters to the text area if set*/
if (ext->ta == nullptr) return;
if (!ext->ta) return;
if (strcmp(txt, "Enter") == 0 || strcmp(txt, LV_SYMBOL_NEW_LINE) == 0)
lv_ta_add_char(ext->ta, '\n');
@ -213,15 +212,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
}
void lv_draw_keyboard() {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != KEY_BOARD_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = KEY_BOARD_UI;
}
disp_state = KEY_BOARD_UI;
scr = lv_screen_create();
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(KEY_BOARD_UI, "");
/*Create styles for the keyboard*/
static lv_style_t rel_style, pr_style;

15
Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp

@ -188,19 +188,7 @@ static void disp_language(uint8_t language, uint8_t state) {
}
void lv_draw_language(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != LANGUAGE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = LANGUAGE_UI;
}
disp_state = LANGUAGE_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_obj_clear_protect(buttonCN, LV_PROTECT_FOLLOW);
@ -211,7 +199,6 @@ void lv_draw_language(void) {
buttonFR = lv_big_button_create(scr, "F:/bmp_french.bin", language_menu.french, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_FR);
buttonIT = lv_big_button_create(scr, "F:/bmp_italy.bin", language_menu.italy, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_IT);
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_L_RETURN);
disp_language(gCfgItems.language, SELECTED);
}

12
Marlin/src/lcd/extui/lib/mks_ui/draw_level_settings.cpp

@ -39,6 +39,7 @@ enum {
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_LEVEL_RETURN:
lv_clear_level_settings();
@ -63,16 +64,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_level_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != LEVELING_PARA_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = LEVELING_PARA_UI;
}
disp_state = LEVELING_PARA_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.LevelingParaConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
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);
#if HAS_BED_PROBE

12
Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp

@ -66,17 +66,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_machine_para(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MACHINE_PARA_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MACHINE_PARA_UI;
}
disp_state = MACHINE_PARA_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_screen_menu_item(scr, MachinePara_menu.leveling, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_PARA_LEVEL, 2);

13
Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp

@ -63,18 +63,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_machine_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MACHINE_SETTINGS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MACHINE_SETTINGS_UI;
}
disp_state = MACHINE_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.MachineConfigTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
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);
#if HAS_CLASSIC_JERK

11
Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp

@ -118,16 +118,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_manualLevel(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != LEVELING_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = LEVELING_UI;
}
disp_state = LEVELING_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_obj_clear_protect(buttonPoint1, LV_PROTECT_FOLLOW);

9
Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.cpp

@ -121,15 +121,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_manual_level_pos_settings(void) {
char buf2[50];
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MANUAL_LEVELING_POSIGION_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MANUAL_LEVELING_POSIGION_UI;
}
disp_state = MANUAL_LEVELING_POSIGION_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.LevelingParaConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle);
if (uiCfg.para_ui_page != 1) {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.levelingPos[0][0]);

10
Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp

@ -90,15 +90,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_max_feedrate_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MAXFEEDRATE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MAXFEEDRATE_UI;
}
disp_state = MAXFEEDRATE_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.MaxFeedRateConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(MAXFEEDRATE_UI, machine_menu.MaxFeedRateConfTitle);
if (uiCfg.para_ui_page != 1) {
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]);

14
Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp

@ -73,19 +73,9 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_motor_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MOTOR_SETTINGS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MOTOR_SETTINGS_UI;
}
disp_state = MOTOR_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.MotorConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
int index = 0;
scr = lv_screen_create(MOTOR_SETTINGS_UI, machine_menu.MotorConfTitle);
lv_screen_menu_item(scr, machine_menu.StepsConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MOTOR_STEPS, index++);
#if USE_SENSORLESS
lv_screen_menu_item(scr, machine_menu.HomingSensitivityConf, PARA_UI_POS_X, PARA_UI_POS_Y * (index + 1), event_handler, ID_HOME_SENSE, index);

13
Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp

@ -115,18 +115,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_move_motor(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MOVE_MOTOR_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MOVE_MOTOR_UI;
}
disp_state = MOVE_MOTOR_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_X_N);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp

@ -662,17 +662,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_number_key(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != NUMBER_KEY_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = NUMBER_KEY_UI;
}
disp_state = NUMBER_KEY_UI;
scr = lv_screen_create();
//(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(NUMBER_KEY_UI, "");
buttonValue = lv_btn_create(scr, 92, 40, 296, 40, event_handler, ID_NUM_KEY1, &style_num_text);
labelValue = lv_label_create_empty(buttonValue);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp

@ -129,17 +129,7 @@ void lv_draw_operation(void) {
*buttonBabyStep = nullptr, *label_BabyStep = nullptr,
*label_Filament = nullptr;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != OPERATE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = OPERATE_UI;
}
disp_state = OPERATE_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(OPERATE_UI);
// Create image buttons
lv_obj_t *buttonPreHeat = lv_imgbtn_create(scr, "F:/bmp_temp.bin", INTERVAL_V, titleHeight, event_handler, ID_O_PRE_HEAT);

10
Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.cpp

@ -65,15 +65,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_pause_position(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PAUSE_POS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = PAUSE_POS_UI;
}
disp_state = PAUSE_POS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.PausePosText);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(PAUSE_POS_UI, machine_menu.PausePosText);
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX);
lv_screen_menu_item_1_edit(scr, machine_menu.xPos, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PAUSE_X, 0, public_buf_l);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp

@ -158,17 +158,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_preHeat(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PRE_HEAT_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = PRE_HEAT_UI;
}
disp_state = PRE_HEAT_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(PRE_HEAT_UI);
// Create image buttons
lv_big_button_create(scr, "F:/bmp_Add.bin", preheat_menu.add, INTERVAL_V, titleHeight, event_handler, ID_P_ADD);

5
Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp

@ -252,10 +252,7 @@ static char test_public_buf_l[40];
void disp_gcode_icon(uint8_t file_num) {
uint8_t i;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(MAIN_UI, "");
// Create image buttons
buttonPageUp = lv_imgbtn_create(scr, "F:/bmp_pageUp.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_P_UP);

10
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp

@ -121,15 +121,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_printing(void) {
disp_state_stack._disp_index = 0;
ZERO(disp_state_stack._disp_state);
disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINTING_UI;
disp_state = PRINTING_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(PRINTING_UI);
// Create image buttons
lv_obj_t *buttonExt1 = lv_img_create(scr, nullptr);

7
Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp

@ -122,13 +122,8 @@ void lv_draw_ready_print(void) {
disp_state_stack._disp_index = 0;
ZERO(disp_state_stack._disp_state);
disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINT_READY_UI;
disp_state = PRINT_READY_UI;
scr = lv_screen_create();
scr = lv_screen_create(PRINT_READY_UI, "");
//lv_obj_set_hidden(scr, true);
lv_refr_now(lv_refr_get_disp_refreshing());
if (mks_test_flag == 0x1E) {
//(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());

13
Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp

@ -126,18 +126,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_set(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != SET_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = SET_UI;
}
disp_state = SET_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_big_button_create(scr, "F:/bmp_about.bin", set_menu.about, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_S_ABOUT);

10
Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp

@ -90,15 +90,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_step_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != STEPS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = STEPS_UI;
}
disp_state = STEPS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.StepsConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(STEPS_UI, machine_menu.StepsConfTitle);
if (uiCfg.para_ui_page != 1) {
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]);

10
Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp

@ -103,15 +103,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_tmc_current_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TMC_CURRENT_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = TMC_CURRENT_UI;
}
disp_state = TMC_CURRENT_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.TmcCurrentConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(TMC_CURRENT_UI, machine_menu.TmcCurrentConfTitle);
float milliamps;
if (uiCfg.para_ui_page != 1) {

10
Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp

@ -112,15 +112,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_tmc_step_mode_settings(void) {
buttonXState = buttonYState = buttonZState = buttonE0State = buttonE1State = nullptr;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TMC_MODE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = TMC_MODE_UI;
}
disp_state = TMC_MODE_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.TmcStepModeConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(TMC_MODE_UI, machine_menu.TmcStepModeConfTitle);
bool stealth_X = false, stealth_Y = false, stealth_Z = false, stealth_E0 = false, stealth_E1 = false;
#if AXIS_HAS_STEALTHCHOP(X)

15
Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp

@ -99,24 +99,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_tool(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TOOL_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = TOOL_UI;
}
disp_state = TOOL_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_big_button_create(scr, "F:/bmp_mov.bin", tool_menu.move, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_T_MOV);
lv_big_button_create(scr, "F:/bmp_zero.bin", tool_menu.home, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_T_HOME);
lv_big_button_create(scr, "F:/bmp_leveling.bin", tool_menu.TERN(AUTO_BED_LEVELING_BILINEAR, autoleveling, leveling), INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_LEVELING);
lv_big_button_create(scr, "F:/bmp_filamentchange.bin", tool_menu.filament, BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight, event_handler,ID_T_FILAMENT);
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_T_RETURN);

20
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp

@ -1628,11 +1628,29 @@ void lv_btn_set_style_both(lv_obj_t *btn, lv_style_t *style) {
}
// Create a screen
lv_obj_t* lv_screen_create() {
lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char* title) {
lv_obj_t *scr = lv_obj_create(nullptr, nullptr);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
// breadcrumbs
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != newScreenType) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = newScreenType;
}
disp_state = newScreenType;
lv_refr_now(lv_refr_get_disp_refreshing());
// title
lv_obj_t *titleLabel = nullptr;
if (!title)
titleLabel = lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
else if (title[0] != '\0')
titleLabel = lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, title);
if (titleLabel)
lv_obj_set_style(titleLabel, &tft_style_label_rel);
return scr;
}

2
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h

@ -468,7 +468,7 @@ void lv_btn_use_label_style(lv_obj_t *btn);
void lv_btn_set_style_both(lv_obj_t *btn, lv_style_t *style);
// Create a screen
lv_obj_t* lv_screen_create();
lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char* title = nullptr);
// Create an empty label
lv_obj_t* lv_label_create_empty(lv_obj_t *par);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp

@ -58,17 +58,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_wifi(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_UI;
}
disp_state = WIFI_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(WIFI_UI);
// Create an Image button
lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_RETURN);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.cpp

@ -89,17 +89,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_wifi_list(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_LIST_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_LIST_UI;
}
disp_state = WIFI_LIST_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
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);
lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_back.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + (OTHER_BTN_YPIEL + INTERVAL_H) * 2, event_handler, ID_WL_RETURN);

12
Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_settings.cpp

@ -94,17 +94,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_wifi_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_SETTINGS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_SETTINGS_UI;
}
disp_state = WIFI_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.WifiConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
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);

9
Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.cpp

@ -39,14 +39,7 @@ tips_menu_def tips_menu;
void lv_draw_wifi_tips(void) {
static lv_obj_t *text_tips,*wifi_name;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_TIPS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_TIPS_UI;
}
disp_state = WIFI_TIPS_UI;
scr = lv_screen_create();
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(WIFI_TIPS_UI, "");
wifi_name = lv_label_create(scr, (const char *)wifi_list.wifiName[wifi_list.nameIndex]);
lv_obj_align(wifi_name, nullptr, LV_ALIGN_CENTER, 0, -20);

2
Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp

@ -53,7 +53,7 @@ WifiSerial::WifiSerial(usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) {
/* F1 MCUs have no GPIO_AFR[HL], so turn off PWM if there's a conflict
* on this GPIO bit. */
static void disable_timer_if_necessary(timer_dev *dev, uint8 ch) {
if (dev != nullptr) timer_set_mode(dev, ch, TIMER_DISABLED);
if (dev) timer_set_mode(dev, ch, TIMER_DISABLED);
}
#elif STM32_MCU_SERIES == STM32_SERIES_F2 || STM32_MCU_SERIES == STM32_SERIES_F4
#define disable_timer_if_necessary(dev, ch) ((void)0)

8
Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.cpp

@ -533,12 +533,8 @@ EspUploadResult flashFinish(signed char reboot) {
// Compute the checksum of a block of data
uint16_t checksum(const uint8_t *data, uint16_t dataLen, uint16_t cksum) {
if (data != nullptr) {
while (dataLen--) {
cksum ^= (uint16_t)*data++;
}
}
return(cksum);
if (data) while (dataLen--) cksum ^= (uint16_t)*data++;
return cksum;
}
EspUploadResult flashWriteBlock(uint16_t flashParmVal, uint16_t flashParmMask) {

Loading…
Cancel
Save