Browse Source

Remove extraneous MKS UI sprintf

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
e0ed57db67
  1. 7
      Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp
  2. 7
      Marlin/src/lcd/extui/lib/mks_ui/draw_auto_level_offset_settings.cpp
  3. 9
      Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.cpp
  4. 2
      Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp
  5. 11
      Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp
  6. 129
      Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp
  7. 7
      Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.cpp
  8. 3
      Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp
  9. 11
      Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp
  10. 11
      Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp
  11. 20
      Marlin/src/lcd/extui/lib/mks_ui/draw_tramming_pos_settings.cpp
  12. 20
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp
  13. 2
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h
  14. 4
      Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp

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

@ -109,15 +109,14 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_acceleration_settings() {
scr = lv_screen_create(ACCELERATION_UI, machine_menu.AccelerationConfTitle);
char str_1[16];
if (!uiCfg.para_ui_page) {
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.acceleration, 1, 1, str_1));
dtostrf(planner.settings.acceleration, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.PrintAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ACCE_PRINT, 0, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.retract_acceleration, 1, 1, str_1));
dtostrf(planner.settings.retract_acceleration, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.RetractAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_ACCE_RETRA, 1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.travel_acceleration, 1, 1, str_1));
dtostrf(planner.settings.travel_acceleration, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.TravelAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_ACCE_TRAVEL, 2, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);

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

@ -65,16 +65,15 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_auto_level_offset_settings() {
char str_1[16];
scr = lv_screen_create(NOZZLE_PROBE_OFFSET_UI, machine_menu.OffsetConfTitle);
sprintf_P(public_buf_l, PSTR("%s"), TERN(HAS_PROBE_XY_OFFSET, dtostrf(probe.offset.x, 1, 1, str_1) , 0));
dtostrf(TERN0(HAS_PROBE_XY_OFFSET, probe.offset.x), 1, 1, public_buf_l);
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);
sprintf_P(public_buf_l, PSTR("%s"), TERN(HAS_PROBE_XY_OFFSET, dtostrf(probe.offset.y, 1, 1, str_1) , 0));
dtostrf(TERN0(HAS_PROBE_XY_OFFSET, probe.offset.y), 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Yoffset, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_OFFSET_Y, 1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), TERN(HAS_PROBE_XY_OFFSET, dtostrf(probe.offset.z, 1, 1, str_1) , 0));
dtostrf(TERN0(HAS_PROBE_XY_OFFSET, probe.offset.z), 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Zoffset, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_OFFSET_Z, 2, public_buf_l);
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_OFFSET_RETURN, true);

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

@ -71,19 +71,18 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_jerk_settings() {
char str_1[16];
scr = lv_screen_create(JERK_UI, machine_menu.JerkConfTitle);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.max_jerk[X_AXIS], 1, 1, str_1));
dtostrf(planner.max_jerk[X_AXIS], 1, 1, public_buf_l);
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);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.max_jerk[Y_AXIS], 1, 1, str_1));
dtostrf(planner.max_jerk[Y_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Y_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_JERK_Y, 1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.max_jerk[Z_AXIS], 1, 1, str_1));
dtostrf(planner.max_jerk[Z_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Z_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_JERK_Z, 2, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.max_jerk[E_AXIS], 1, 1, str_1));
dtostrf(planner.max_jerk[E_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.E_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_JERK_E, 3, public_buf_l);
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_JERK_RETURN, true);

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

@ -54,7 +54,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
queue.inject_P(G28_STR);
}
const int ind = obj->mks_obj_id - ID_M_POINT1;
sprintf_P(public_buf_l, PSTR("G1 Z10\nG1 X%d Y%d\nG1 Z0"), (int)gCfgItems.trammingPos[ind][X_AXIS], (int)gCfgItems.trammingPos[ind][Y_AXIS]);
sprintf_P(public_buf_l, PSTR("G1 Z10\nG1 X%d Y%d\nG1 Z0"), gCfgItems.trammingPos[ind].x, gCfgItems.trammingPos[ind].y);
queue.inject(public_buf_l);
}
break;

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

@ -80,26 +80,25 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_max_feedrate_settings() {
char str_1[16];
scr = lv_screen_create(MAXFEEDRATE_UI, machine_menu.MaxFeedRateConfTitle);
if (!uiCfg.para_ui_page) {
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[X_AXIS], 1, 1, str_1));
dtostrf(planner.settings.max_feedrate_mm_s[X_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.XMaxFeedRate, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FEED_X, 0, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[Y_AXIS], 1, 1, str_1));
dtostrf(planner.settings.max_feedrate_mm_s[Y_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.YMaxFeedRate, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_FEED_Y, 1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[Z_AXIS], 1, 1, str_1));
dtostrf(planner.settings.max_feedrate_mm_s[Z_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.ZMaxFeedRate, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_FEED_Z, 2, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS], 1, 1, str_1));
dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.E0MaxFeedRate, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_FEED_E0, 3, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FEED_DOWN, true);
}
else {
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], 1, 1, str_1));
dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.E1MaxFeedRate, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FEED_E1, 0, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FEED_UP, true);

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

@ -73,214 +73,211 @@ enum {
static void disp_key_value() {
char *temp;
char str_1[16];
#if HAS_TRINAMIC_CONFIG
float milliamps;
#endif
TERN_(HAS_TRINAMIC_CONFIG, float milliamps);
switch (value) {
case PrintAcceleration:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.acceleration, 1, 1, str_1));
dtostrf(planner.settings.acceleration, 1, 1, public_buf_m);
break;
case RetractAcceleration:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.retract_acceleration, 1, 1, str_1));
dtostrf(planner.settings.retract_acceleration, 1, 1, public_buf_m);
break;
case TravelAcceleration:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.travel_acceleration, 1, 1, str_1));
dtostrf(planner.settings.travel_acceleration, 1, 1, public_buf_m);
break;
case XAcceleration:
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
itoa(planner.settings.max_acceleration_mm_per_s2[X_AXIS], public_buf_m, 10);
break;
case YAcceleration:
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
itoa(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], public_buf_m, 10);
break;
case ZAcceleration:
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
itoa(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], public_buf_m, 10);
break;
case E0Acceleration:
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS], public_buf_m, 10);
break;
case E1Acceleration:
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]);
itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], public_buf_m, 10);
break;
case XMaxFeedRate:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[X_AXIS], 1, 1, str_1));
dtostrf(planner.settings.max_feedrate_mm_s[X_AXIS], 1, 1, public_buf_m);
break;
case YMaxFeedRate:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[Y_AXIS], 1, 1, str_1));
dtostrf(planner.settings.max_feedrate_mm_s[Y_AXIS], 1, 1, public_buf_m);
break;
case ZMaxFeedRate:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[Z_AXIS], 1, 1, str_1));
dtostrf(planner.settings.max_feedrate_mm_s[Z_AXIS], 1, 1, public_buf_m);
break;
case E0MaxFeedRate:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS], 1, 1, str_1));
dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS], 1, 1, public_buf_m);
break;
case E1MaxFeedRate:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], 1, 1, str_1));
dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], 1, 1, public_buf_m);
break;
case XJerk:
#if HAS_CLASSIC_JERK
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.max_jerk[X_AXIS], 1, 1, str_1));
dtostrf(planner.max_jerk[X_AXIS], 1, 1, public_buf_m);
#endif
break;
case YJerk:
#if HAS_CLASSIC_JERK
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.max_jerk[Y_AXIS], 1, 1, str_1));
dtostrf(planner.max_jerk[Y_AXIS], 1, 1, public_buf_m);
#endif
break;
case ZJerk:
#if HAS_CLASSIC_JERK
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.max_jerk[Z_AXIS], 1, 1, str_1));
dtostrf(planner.max_jerk[Z_AXIS], 1, 1, public_buf_m);
#endif
break;
case EJerk:
#if HAS_CLASSIC_JERK
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.max_jerk[E_AXIS], 1, 1, str_1));
dtostrf(planner.max_jerk[E_AXIS], 1, 1, public_buf_m);
#endif
break;
case Xstep:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[X_AXIS], 1, 1, str_1));
dtostrf(planner.settings.axis_steps_per_mm[X_AXIS], 1, 1, public_buf_m);
break;
case Ystep:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[Y_AXIS], 1, 1, str_1));
dtostrf(planner.settings.axis_steps_per_mm[Y_AXIS], 1, 1, public_buf_m);
break;
case Zstep:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[Z_AXIS], 1, 1, str_1));
dtostrf(planner.settings.axis_steps_per_mm[Z_AXIS], 1, 1, public_buf_m);
break;
case E0step:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[E_AXIS], 1, 1, str_1));
dtostrf(planner.settings.axis_steps_per_mm[E_AXIS], 1, 1, public_buf_m);
break;
case E1step:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[E_AXIS_N(1)], 1, 1, str_1));
dtostrf(planner.settings.axis_steps_per_mm[E_AXIS_N(1)], 1, 1, public_buf_m);
break;
case Xcurrent:
#if AXIS_IS_TMC(X)
milliamps = stepperX.getMilliamps();
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
dtostrf(milliamps, 1, 1, public_buf_m);
#endif
break;
case Ycurrent:
#if AXIS_IS_TMC(Y)
milliamps = stepperY.getMilliamps();
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
dtostrf(milliamps, 1, 1, public_buf_m);
#endif
break;
case Zcurrent:
#if AXIS_IS_TMC(Z)
milliamps = stepperZ.getMilliamps();
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
dtostrf(milliamps, 1, 1, public_buf_m);
#endif
break;
case E0current:
#if AXIS_IS_TMC(E0)
milliamps = stepperE0.getMilliamps();
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
dtostrf(milliamps, 1, 1, public_buf_m);
#endif
break;
case E1current:
#if AXIS_IS_TMC(E1)
milliamps = stepperE1.getMilliamps();
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
dtostrf(milliamps, 1, 1, public_buf_m);
#endif
break;
case pause_pos_x:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(gCfgItems.pausePosX, 1, 1, str_1));
dtostrf(gCfgItems.pausePosX, 1, 1, public_buf_m);
break;
case pause_pos_y:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(gCfgItems.pausePosY, 1, 1, str_1));
dtostrf(gCfgItems.pausePosY, 1, 1, public_buf_m);
break;
case pause_pos_z:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(gCfgItems.pausePosZ, 1, 1, str_1));
dtostrf(gCfgItems.pausePosZ, 1, 1, public_buf_m);
break;
case level_pos_x1:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[0][X_AXIS]);
itoa(gCfgItems.trammingPos[0].x, public_buf_m, 10);
break;
case level_pos_y1:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[0][Y_AXIS]);
itoa(gCfgItems.trammingPos[0].y, public_buf_m, 10);
break;
case level_pos_x2:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[1][X_AXIS]);
itoa(gCfgItems.trammingPos[1].x, public_buf_m, 10);
break;
case level_pos_y2:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[1][Y_AXIS]);
itoa(gCfgItems.trammingPos[1].y, public_buf_m, 10);
break;
case level_pos_x3:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[2][X_AXIS]);
itoa(gCfgItems.trammingPos[2].x, public_buf_m, 10);
break;
case level_pos_y3:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[2][Y_AXIS]);
itoa(gCfgItems.trammingPos[2].y, public_buf_m, 10);
break;
case level_pos_x4:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[3][X_AXIS]);
itoa(gCfgItems.trammingPos[3].x, public_buf_m, 10);
break;
case level_pos_y4:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[3][Y_AXIS]);
itoa(gCfgItems.trammingPos[3].y, public_buf_m, 10);
break;
case level_pos_x5:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[4][X_AXIS]);
itoa(gCfgItems.trammingPos[4].x, public_buf_m, 10);
break;
case level_pos_y5:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.trammingPos[4][Y_AXIS]);
itoa(gCfgItems.trammingPos[4].y, public_buf_m, 10);
break;
#if HAS_BED_PROBE
case x_offset:
#if HAS_PROBE_XY_OFFSET
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(probe.offset.x, 1, 3, str_1));
dtostrf(probe.offset.x, 1, 3, public_buf_m);
#endif
break;
case y_offset:
#if HAS_PROBE_XY_OFFSET
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(probe.offset.y, 1, 3, str_1));
dtostrf(probe.offset.y, 1, 3, public_buf_m);
#endif
break;
case z_offset:
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(probe.offset.z, 1, 3, str_1));
dtostrf(probe.offset.z, 1, 3, public_buf_m);
break;
#endif
case load_length:
sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_load_length);
itoa(gCfgItems.filamentchange_load_length, public_buf_m, 10);
break;
case load_speed:
sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_load_speed);
itoa(gCfgItems.filamentchange_load_speed, public_buf_m, 10);
break;
case unload_length:
sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_unload_length);
itoa(gCfgItems.filamentchange_unload_length, public_buf_m, 10);
break;
case unload_speed:
sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_unload_speed);
itoa(gCfgItems.filamentchange_unload_speed, public_buf_m, 10);
break;
case filament_temp:
sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filament_limit_temp);
itoa(gCfgItems.filament_limit_temp, public_buf_m, 10);
break;
case x_sensitivity:
#if X_SENSORLESS
sprintf_P(public_buf_m, PSTR("%d"), TERN(X_SENSORLESS, stepperX.homing_threshold(), 0));
itoa(TERN(X_SENSORLESS, stepperX.homing_threshold(), 0), public_buf_m, 10);
#endif
break;
case y_sensitivity:
#if Y_SENSORLESS
sprintf_P(public_buf_m, PSTR("%d"), TERN(Y_SENSORLESS, stepperY.homing_threshold(), 0));
itoa(TERN(Y_SENSORLESS, stepperY.homing_threshold(), 0), public_buf_m, 10);
#endif
break;
case z_sensitivity:
#if Z_SENSORLESS
sprintf_P(public_buf_m, PSTR("%d"), TERN(Z_SENSORLESS, stepperZ.homing_threshold(), 0));
itoa(TERN(Z_SENSORLESS, stepperZ.homing_threshold(), 0), public_buf_m, 10);
#endif
break;
case z2_sensitivity:
#if Z2_SENSORLESS
sprintf_P(public_buf_m, PSTR("%d"), TERN(Z2_SENSORLESS, stepperZ2.homing_threshold(), 0));
itoa(TERN(Z2_SENSORLESS, stepperZ2.homing_threshold(), 0), public_buf_m, 10);
#endif
break;
}
@ -346,16 +343,16 @@ static void set_value_confirm() {
case pause_pos_x: gCfgItems.pausePosX = atof(key_value); update_spi_flash(); break;
case pause_pos_y: gCfgItems.pausePosY = atof(key_value); update_spi_flash(); break;
case pause_pos_z: gCfgItems.pausePosZ = atof(key_value); update_spi_flash(); break;
case level_pos_x1: gCfgItems.trammingPos[0][X_AXIS] = atoi(key_value); update_spi_flash(); break;
case level_pos_y1: gCfgItems.trammingPos[0][Y_AXIS] = atoi(key_value); update_spi_flash(); break;
case level_pos_x2: gCfgItems.trammingPos[1][X_AXIS] = atoi(key_value); update_spi_flash(); break;
case level_pos_y2: gCfgItems.trammingPos[1][Y_AXIS] = atoi(key_value); update_spi_flash(); break;
case level_pos_x3: gCfgItems.trammingPos[2][X_AXIS] = atoi(key_value); update_spi_flash(); break;
case level_pos_y3: gCfgItems.trammingPos[2][Y_AXIS] = atoi(key_value); update_spi_flash(); break;
case level_pos_x4: gCfgItems.trammingPos[3][X_AXIS] = atoi(key_value); update_spi_flash(); break;
case level_pos_y4: gCfgItems.trammingPos[3][Y_AXIS] = atoi(key_value); update_spi_flash(); break;
case level_pos_x5: gCfgItems.trammingPos[4][X_AXIS] = atoi(key_value); update_spi_flash(); break;
case level_pos_y5: gCfgItems.trammingPos[4][Y_AXIS] = atoi(key_value); update_spi_flash(); break;
case level_pos_x1: gCfgItems.trammingPos[0].x = atoi(key_value); update_spi_flash(); break;
case level_pos_y1: gCfgItems.trammingPos[0].y = atoi(key_value); update_spi_flash(); break;
case level_pos_x2: gCfgItems.trammingPos[1].x = atoi(key_value); update_spi_flash(); break;
case level_pos_y2: gCfgItems.trammingPos[1].y = atoi(key_value); update_spi_flash(); break;
case level_pos_x3: gCfgItems.trammingPos[2].x = atoi(key_value); update_spi_flash(); break;
case level_pos_y3: gCfgItems.trammingPos[2].y = atoi(key_value); update_spi_flash(); break;
case level_pos_x4: gCfgItems.trammingPos[3].x = atoi(key_value); update_spi_flash(); break;
case level_pos_y4: gCfgItems.trammingPos[3].y = atoi(key_value); update_spi_flash(); break;
case level_pos_x5: gCfgItems.trammingPos[4].x = atoi(key_value); update_spi_flash(); break;
case level_pos_y5: gCfgItems.trammingPos[4].y = atoi(key_value); update_spi_flash(); break;
#if HAS_BED_PROBE
case x_offset: {
#if HAS_PROBE_XY_OFFSET

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

@ -60,16 +60,15 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_pause_position() {
char str_1[16];
scr = lv_screen_create(PAUSE_POS_UI, machine_menu.PausePosText);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(gCfgItems.pausePosX, 1, 1, str_1));
dtostrf(gCfgItems.pausePosX, 1, 1, public_buf_l);
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);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(gCfgItems.pausePosY, 1, 1, str_1));
dtostrf(gCfgItems.pausePosY, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.yPos, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_PAUSE_Y, 1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(gCfgItems.pausePosZ, 1, 1, str_1));
dtostrf(gCfgItems.pausePosZ, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.zPos, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_PAUSE_Z, 2, public_buf_l);
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_PAUSE_RETURN, true);

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

@ -251,8 +251,7 @@ void disp_print_time() {
}
void disp_fan_Zpos() {
char str_1[16];
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(current_position.z, 1, 3, str_1));
dtostrf(current_position.z, 1, 3, public_buf_l);
lv_label_set_text(labelZpos, public_buf_l);
}

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

@ -79,26 +79,25 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
}
void lv_draw_step_settings() {
char str_1[16];
scr = lv_screen_create(STEPS_UI, machine_menu.StepsConfTitle);
if (!uiCfg.para_ui_page) {
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[X_AXIS], 1, 1, str_1));
dtostrf(planner.settings.axis_steps_per_mm[X_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.X_Steps, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_STEP_X, 0, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[Y_AXIS], 1, 1, str_1));
dtostrf(planner.settings.axis_steps_per_mm[Y_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Y_Steps, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_STEP_Y, 1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[Z_AXIS], 1, 1, str_1));
dtostrf(planner.settings.axis_steps_per_mm[Z_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Z_Steps, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_STEP_Z, 2, public_buf_l);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[E_AXIS], 1, 1, str_1));
dtostrf(planner.settings.axis_steps_per_mm[E_AXIS], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.E0_Steps, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_STEP_E0, 3, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_STEP_DOWN, true);
}
else {
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[E_AXIS_N(1)], 1, 1, str_1));
dtostrf(planner.settings.axis_steps_per_mm[E_AXIS_N(1)], 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.E1_Steps, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_STEP_E1, 0, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_STEP_UP, true);

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

@ -95,14 +95,13 @@ void lv_draw_tmc_current_settings() {
scr = lv_screen_create(TMC_CURRENT_UI, machine_menu.TmcCurrentConfTitle);
float milliamps;
char str_1[16];
if (!uiCfg.para_ui_page) {
#if AXIS_IS_TMC(X)
milliamps = stepperX.getMilliamps();
#else
milliamps = -1;
#endif
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
dtostrf(milliamps, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.X_Current, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_TMC_CURRENT_X, 0, public_buf_l);
#if AXIS_IS_TMC(Y)
@ -110,7 +109,7 @@ void lv_draw_tmc_current_settings() {
#else
milliamps = -1;
#endif
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
dtostrf(milliamps, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Y_Current, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_TMC_CURRENT_Y, 1, public_buf_l);
#if AXIS_IS_TMC(Z)
@ -118,7 +117,7 @@ void lv_draw_tmc_current_settings() {
#else
milliamps = -1;
#endif
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
dtostrf(milliamps, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Z_Current, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_TMC_CURRENT_Z, 2, public_buf_l);
#if AXIS_IS_TMC(E0)
@ -126,7 +125,7 @@ void lv_draw_tmc_current_settings() {
#else
milliamps = -1;
#endif
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
dtostrf(milliamps, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.E0_Current, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_TMC_CURRENT_E0, 3, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_TMC_CURRENT_DOWN, true);
@ -137,7 +136,7 @@ void lv_draw_tmc_current_settings() {
#else
milliamps = -1;
#endif
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
dtostrf(milliamps, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.E1_Current, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_TMC_CURRENT_E1, 0, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_TMC_CURRENT_UP, true);

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

@ -107,27 +107,27 @@ void lv_draw_tramming_pos_settings() {
scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle);
if (!uiCfg.para_ui_page) {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[0][X_AXIS]);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[0][Y_AXIS]);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[0].x);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[0].y);
lv_screen_menu_item_2_edit(scr, leveling_menu.position1, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MANUAL_POS_Y1, 0, buf2, ID_MANUAL_POS_X1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[1][X_AXIS]);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[1][Y_AXIS]);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[1].x);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[1].y);
lv_screen_menu_item_2_edit(scr, leveling_menu.position2, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_MANUAL_POS_Y2, 1, buf2, ID_MANUAL_POS_X2, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[2][X_AXIS]);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[2][Y_AXIS]);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[2].x);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[2].y);
lv_screen_menu_item_2_edit(scr, leveling_menu.position3, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_MANUAL_POS_Y3, 2, buf2, ID_MANUAL_POS_X3, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[3][X_AXIS]);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[3][Y_AXIS]);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[3].x);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[3].y);
lv_screen_menu_item_2_edit(scr, leveling_menu.position4, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_MANUAL_POS_Y4, 3, buf2, ID_MANUAL_POS_X4, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_MANUAL_POS_DOWN, true);
}
else {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[4][X_AXIS]);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[4][Y_AXIS]);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[4].x);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[4].y);
lv_screen_menu_item_2_edit(scr, leveling_menu.position4, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MANUAL_POS_Y5, 0, buf2, ID_MANUAL_POS_X5, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_MANUAL_POS_UP, true);

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

@ -125,16 +125,16 @@ void gCfgItems_init() {
gCfgItems.pausePosX = -1;
gCfgItems.pausePosY = -1;
gCfgItems.pausePosZ = 5;
gCfgItems.trammingPos[0][X_AXIS] = X_MIN_POS + 30;
gCfgItems.trammingPos[0][Y_AXIS] = Y_MIN_POS + 30;
gCfgItems.trammingPos[1][X_AXIS] = X_MAX_POS - 30;
gCfgItems.trammingPos[1][Y_AXIS] = Y_MIN_POS + 30;
gCfgItems.trammingPos[2][X_AXIS] = X_MAX_POS - 30;
gCfgItems.trammingPos[2][Y_AXIS] = Y_MAX_POS - 30;
gCfgItems.trammingPos[3][X_AXIS] = X_MIN_POS + 30;
gCfgItems.trammingPos[3][Y_AXIS] = Y_MAX_POS - 30;
gCfgItems.trammingPos[4][X_AXIS] = X_BED_SIZE / 2;
gCfgItems.trammingPos[4][Y_AXIS] = Y_BED_SIZE / 2;
gCfgItems.trammingPos[0].x = X_MIN_POS + 30;
gCfgItems.trammingPos[0].y = Y_MIN_POS + 30;
gCfgItems.trammingPos[1].x = X_MAX_POS - 30;
gCfgItems.trammingPos[1].y = Y_MIN_POS + 30;
gCfgItems.trammingPos[2].x = X_MAX_POS - 30;
gCfgItems.trammingPos[2].y = Y_MAX_POS - 30;
gCfgItems.trammingPos[3].x = X_MIN_POS + 30;
gCfgItems.trammingPos[3].y = Y_MAX_POS - 30;
gCfgItems.trammingPos[4].x = X_BED_SIZE / 2;
gCfgItems.trammingPos[4].y = Y_BED_SIZE / 2;
gCfgItems.cloud_enable = false;
gCfgItems.wifi_mode_sel = STA_MODEL;
gCfgItems.fileSysType = FILE_SYS_SD;

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

@ -197,7 +197,7 @@ typedef struct {
uint8_t wifi_type;
bool cloud_enable,
encoder_enable;
int trammingPos[5][2]; // XY
xy_int_t trammingPos[5];
int filamentchange_load_length,
filamentchange_load_speed,
filamentchange_unload_length,

4
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp

@ -883,7 +883,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
SEND_OK_TO_WIFI;
char *outBuf = (char *)tempBuf;
char str_1[16], tbuf[34];
char tbuf[34];
sprintf_P(tbuf, PSTR("%d /%d"), (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
@ -1313,7 +1313,7 @@ static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) {
lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE);
return;
}
sprintf_P((char *)saveFilePath, PSTR("%s"), dosName);
strcpy(saveFilePath, dosName);
card.cdroot();
upload_file.close();

Loading…
Cancel
Save