Browse Source

Fix: Unsupported use of %f in printf (#21001)

vanilla_fb_2.0.x
MKS-Sean 4 years ago
committed by Scott Lahteine
parent
commit
127a4ada93
  1. 8
      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. 20
      Marlin/src/lcd/extui/lib/mks_ui/draw_baby_stepping.cpp
  4. 9
      Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.cpp
  5. 11
      Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp
  6. 6
      Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp
  7. 58
      Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp
  8. 7
      Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.cpp
  9. 2
      Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp
  10. 3
      Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp
  11. 11
      Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp
  12. 11
      Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp
  13. 11
      Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp
  14. 62
      Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp
  15. 4
      Marlin/src/module/temperature.cpp

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

@ -109,15 +109,15 @@ 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("%.1f"), planner.settings.acceleration);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.acceleration, 1, 1, str_1));
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("%.1f"), planner.settings.retract_acceleration);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.retract_acceleration, 1, 1, str_1));
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("%.1f"), planner.settings.travel_acceleration);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.travel_acceleration, 1, 1, str_1));
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,15 +65,16 @@ 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("%.1f"), TERN(HAS_PROBE_XY_OFFSET, probe.offset.x, 0));
sprintf_P(public_buf_l, PSTR("%s"), TERN(HAS_PROBE_XY_OFFSET, dtostrf(probe.offset.x, 1, 1, str_1) , 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);
sprintf_P(public_buf_l, PSTR("%.1f"), TERN(HAS_PROBE_XY_OFFSET, probe.offset.y, 0));
sprintf_P(public_buf_l, PSTR("%s"), TERN(HAS_PROBE_XY_OFFSET, dtostrf(probe.offset.y, 1, 1, str_1) , 0));
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("%.1f"), probe.offset.z);
sprintf_P(public_buf_l, PSTR("%s"), TERN(HAS_PROBE_XY_OFFSET, dtostrf(probe.offset.z, 1, 1, str_1) , 0));
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);

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

@ -60,34 +60,35 @@ static uint8_t has_adjust_z = 0;
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
char baby_buf[30] = { 0 };
char str_1[16];
switch (obj->mks_obj_id) {
case ID_BABY_STEP_X_P:
sprintf_P(baby_buf, PSTR("M290 X%.3f"), babystep_dist);
sprintf_P(baby_buf, PSTR("M290 X%s"), dtostrf(babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1;
break;
case ID_BABY_STEP_X_N:
sprintf_P(baby_buf, PSTR("M290 X%.3f"), -babystep_dist);
sprintf_P(baby_buf, PSTR("M290 X%s"), dtostrf(-babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1;
break;
case ID_BABY_STEP_Y_P:
sprintf_P(baby_buf, PSTR("M290 Y%.3f"), babystep_dist);
sprintf_P(baby_buf, PSTR("M290 Y%s"), dtostrf(babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1;
break;
case ID_BABY_STEP_Y_N:
sprintf_P(baby_buf, PSTR("M290 Y%.3f"), -babystep_dist);
sprintf_P(baby_buf, PSTR("M290 Y%s"), dtostrf(-babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1;
break;
case ID_BABY_STEP_Z_P:
sprintf_P(baby_buf, PSTR("M290 Z%.3f"), babystep_dist);
sprintf_P(baby_buf, PSTR("M290 Z%s"), dtostrf(babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1;
break;
case ID_BABY_STEP_Z_N:
sprintf_P(baby_buf, PSTR("M290 Z%.3f"), -babystep_dist);
sprintf_P(baby_buf, PSTR("M290 Z%s"), dtostrf(-babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1;
break;
@ -161,7 +162,12 @@ void disp_baby_step_dist() {
void disp_z_offset_value() {
char buf[20];
sprintf_P(buf, PSTR("offset Z: %.3f"), (float)TERN(HAS_BED_PROBE, probe.offset.z, 0));
#if HAS_BED_PROBE
char str_1[16];
sprintf_P(buf, PSTR("Offset Z: %s mm"), dtostrf(probe.offset.z, 1, 3, str_1));
#else
strcpy_P(buf, PSTR("Offset Z: 0 mm"));
#endif
lv_label_set_text(zOffsetText, buf);
}

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

@ -71,18 +71,19 @@ 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("%.1f"), planner.max_jerk[X_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.max_jerk[X_AXIS], 1, 1, str_1));
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("%.1f"), planner.max_jerk[Y_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.max_jerk[Y_AXIS], 1, 1, str_1));
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("%.1f"), planner.max_jerk[Z_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.max_jerk[Z_AXIS], 1, 1, str_1));
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("%.1f"), planner.max_jerk[E_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.max_jerk[E_AXIS], 1, 1, str_1));
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);

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

@ -80,25 +80,26 @@ 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("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[X_AXIS], 1, 1, str_1));
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("%.1f"), planner.settings.max_feedrate_mm_s[Y_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[Y_AXIS], 1, 1, str_1));
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("%.1f"), planner.settings.max_feedrate_mm_s[Z_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[Z_AXIS], 1, 1, str_1));
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("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS], 1, 1, str_1));
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("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS_N(1)]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], 1, 1, str_1));
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);

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

@ -52,6 +52,7 @@ enum {
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
char str_1[16];
if (event != LV_EVENT_RELEASED) return;
if (queue.length <= (BUFSIZE - 3)) {
bool do_inject = true;
@ -63,7 +64,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
default: do_inject = false;
}
if (do_inject) {
sprintf_P(public_buf_l, PSTR("G91\nG1 %c%3.1f F%d\nG90"), cur_label, dist, uiCfg.moveSpeed);
sprintf_P(public_buf_l, PSTR("G91\nG1 %c%s F%d\nG90"), cur_label, dtostrf(dist, 1, 3, str_1), uiCfg.moveSpeed);
queue.inject(public_buf_l);
}
}
@ -125,7 +126,8 @@ void lv_draw_move_motor() {
}
void disp_cur_pos() {
sprintf_P(public_buf_l, PSTR("%c:%3.1fmm"), cur_label, cur_pos);
char str_1[16];
sprintf_P(public_buf_l, PSTR("%c:%s mm"), cur_label, dtostrf(cur_pos, 1, 1, str_1));
if (labelP) lv_label_set_text(labelP, public_buf_l);
}

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

@ -73,19 +73,20 @@ enum {
static void disp_key_value() {
char *temp;
char str_1[16];
#if HAS_TRINAMIC_CONFIG
float milliamps;
#endif
switch (value) {
case PrintAcceleration:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.acceleration);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.acceleration, 1, 1, str_1));
break;
case RetractAcceleration:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.retract_acceleration);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.retract_acceleration, 1, 1, str_1));
break;
case TravelAcceleration:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.travel_acceleration);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.travel_acceleration, 1, 1, str_1));
break;
case XAcceleration:
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
@ -103,105 +104,104 @@ static void disp_key_value() {
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]);
break;
case XMaxFeedRate:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[X_AXIS], 1, 1, str_1));
break;
case YMaxFeedRate:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Y_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[Y_AXIS], 1, 1, str_1));
break;
case ZMaxFeedRate:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Z_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[Z_AXIS], 1, 1, str_1));
break;
case E0MaxFeedRate:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS], 1, 1, str_1));
break;
case E1MaxFeedRate:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS_N(1)]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], 1, 1, str_1));
break;
case XJerk:
#if HAS_CLASSIC_JERK
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[X_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.max_jerk[X_AXIS], 1, 1, str_1));
#endif
break;
case YJerk:
#if HAS_CLASSIC_JERK
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[Y_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.max_jerk[Y_AXIS], 1, 1, str_1));
#endif
break;
case ZJerk:
#if HAS_CLASSIC_JERK
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[Z_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.max_jerk[Z_AXIS], 1, 1, str_1));
#endif
break;
case EJerk:
#if HAS_CLASSIC_JERK
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[E_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.max_jerk[E_AXIS], 1, 1, str_1));
#endif
break;
case Xstep:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[X_AXIS], 1, 1, str_1));
break;
case Ystep:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Y_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[Y_AXIS], 1, 1, str_1));
break;
case Zstep:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Z_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[Z_AXIS], 1, 1, str_1));
break;
case E0step:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[E_AXIS], 1, 1, str_1));
break;
case E1step:
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS_N(1)]);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[E_AXIS_N(1)], 1, 1, str_1));
break;
case Xcurrent:
#if AXIS_IS_TMC(X)
milliamps = stepperX.getMilliamps();
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
#endif
break;
case Ycurrent:
#if AXIS_IS_TMC(Y)
milliamps = stepperY.getMilliamps();
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
#endif
break;
case Zcurrent:
#if AXIS_IS_TMC(Z)
milliamps = stepperZ.getMilliamps();
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
#endif
break;
case E0current:
#if AXIS_IS_TMC(E0)
milliamps = stepperE0.getMilliamps();
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
#endif
break;
case E1current:
#if AXIS_IS_TMC(E1)
milliamps = stepperE1.getMilliamps();
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
#endif
break;
case pause_pos_x:
sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosX);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(gCfgItems.pausePosX, 1, 1, str_1));
break;
case pause_pos_y:
sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosY);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(gCfgItems.pausePosY, 1, 1, str_1));
break;
case pause_pos_z:
sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosZ);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(gCfgItems.pausePosZ, 1, 1, str_1));
break;
case level_pos_x1:
sprintf_P(public_buf_m, PSTR("%d"), (int)gCfgItems.levelingPos[0][0]);
@ -236,16 +236,16 @@ static void disp_key_value() {
#if HAS_BED_PROBE
case x_offset:
#if HAS_PROBE_XY_OFFSET
sprintf_P(public_buf_m, PSTR("%.1f"), probe.offset.x);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(probe.offset.x, 1, 3, str_1));
#endif
break;
case y_offset:
#if HAS_PROBE_XY_OFFSET
sprintf_P(public_buf_m, PSTR("%.1f"), probe.offset.y);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(probe.offset.y, 1, 3, str_1));
#endif
break;
case z_offset:
sprintf_P(public_buf_m, PSTR("%.1f"), probe.offset.z);
sprintf_P(public_buf_m, PSTR("%s"), dtostrf(probe.offset.z, 1, 3, str_1));
break;
#endif
case load_length:

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

@ -60,15 +60,16 @@ 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("%.1f"), gCfgItems.pausePosX);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(gCfgItems.pausePosX, 1, 1, str_1));
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("%.1f"), gCfgItems.pausePosY);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(gCfgItems.pausePosY, 1, 1, str_1));
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("%.1f"), gCfgItems.pausePosZ);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(gCfgItems.pausePosZ, 1, 1, str_1));
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);

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

@ -56,7 +56,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
}
}
#if DISABLED(SINGLENOZZLE) && HAS_MULTI_EXTRUDER
#if HAS_MULTI_HOTEND
else if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
}

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

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

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

@ -79,25 +79,26 @@ 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("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[X_AXIS], 1, 1, str_1));
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("%.1f"), planner.settings.axis_steps_per_mm[Y_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[Y_AXIS], 1, 1, str_1));
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("%.1f"), planner.settings.axis_steps_per_mm[Z_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[Z_AXIS], 1, 1, str_1));
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("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[E_AXIS], 1, 1, str_1));
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("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS_N(1)]);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(planner.settings.axis_steps_per_mm[E_AXIS_N(1)], 1, 1, str_1));
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,13 +95,14 @@ 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("%.1f"), milliamps);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
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)
@ -109,7 +110,7 @@ void lv_draw_tmc_current_settings() {
#else
milliamps = -1;
#endif
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
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)
@ -117,7 +118,7 @@ void lv_draw_tmc_current_settings() {
#else
milliamps = -1;
#endif
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
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)
@ -125,7 +126,7 @@ void lv_draw_tmc_current_settings() {
#else
milliamps = -1;
#endif
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
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);
@ -136,7 +137,7 @@ void lv_draw_tmc_current_settings() {
#else
milliamps = -1;
#endif
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
sprintf_P(public_buf_l, PSTR("%s"), dtostrf(milliamps, 1, 1, str_1));
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);

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

@ -42,6 +42,7 @@ extern uint32_t To_pre_view;
extern bool flash_preview_begin, default_preview_flg, gcode_preview_over;
void printer_state_polling() {
char str_1[16];
if (uiCfg.print_state == PAUSING) {
#if ENABLED(SDSUPPORT)
if (!planner.has_blocks_queued() && card.getIndex() > MIN_FILE_PRINTED)
@ -59,11 +60,11 @@ void printer_state_polling() {
uiCfg.current_z_position_bak = current_position.z;
if (gCfgItems.pausePosZ != (float)-1) {
sprintf_P(public_buf_l, PSTR("G91\nG1 Z%.1f\nG90"), gCfgItems.pausePosZ);
sprintf_P(public_buf_l, PSTR("G91\nG1 Z%s\nG90"), dtostrf(gCfgItems.pausePosZ, 1, 1, str_1));
gcode.process_subcommands_now(public_buf_l);
}
if (gCfgItems.pausePosX != (float)-1 && gCfgItems.pausePosY != (float)-1) {
sprintf_P(public_buf_l, PSTR("G1 X%.1f Y%.1f"), gCfgItems.pausePosX, gCfgItems.pausePosY);
sprintf_P(public_buf_l, PSTR("G1 X%s Y%s"), dtostrf(gCfgItems.pausePosX, 1, 1, str_1), dtostrf(gCfgItems.pausePosY, 1, 1, str_1));
gcode.process_subcommands_now(public_buf_l);
}
uiCfg.print_state = PAUSED;
@ -83,12 +84,12 @@ void printer_state_polling() {
if (uiCfg.print_state == RESUMING) {
if (IS_SD_PAUSED()) {
if (gCfgItems.pausePosX != (float)-1 && gCfgItems.pausePosY != (float)-1) {
sprintf_P(public_buf_m, PSTR("G1 X%.1f Y%.1f"), uiCfg.current_x_position_bak, uiCfg.current_y_position_bak);
sprintf_P(public_buf_m, PSTR("G1 X%s Y%s"), dtostrf(uiCfg.current_x_position_bak, 1, 1, str_1), dtostrf(uiCfg.current_y_position_bak, 1, 1, str_1));
gcode.process_subcommands_now(public_buf_m);
}
if (gCfgItems.pausePosZ != (float)-1) {
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("G1 Z%.1f"), uiCfg.current_z_position_bak);
sprintf_P(public_buf_m, PSTR("G1 Z%s"), dtostrf(uiCfg.current_z_position_bak, 1, 1, str_1));
gcode.process_subcommands_now(public_buf_m);
}
gcode.process_subcommands_now_P(M24_STR);
@ -126,7 +127,7 @@ void printer_state_polling() {
gcode.process_subcommands_now(public_buf_m);
if (gCfgItems.pause_reprint && gCfgItems.pausePosZ != -1.0f) {
sprintf_P(public_buf_l, PSTR("G91\nG1 Z-%.1f\nG90"), gCfgItems.pausePosZ);
sprintf_P(public_buf_l, PSTR("G91\nG1 Z-%s\nG90"), dtostrf(gCfgItems.pausePosZ, 1, 1, str_2));
gcode.process_subcommands_now(public_buf_l);
}
#endif

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

@ -874,38 +874,64 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
}
}
break;
case 105:
case 991:
ZERO(tempBuf);
if (cmd_value == 105) {
SEND_OK_TO_WIFI;
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,
char *outBuf = (char *)tempBuf;
char str_1[16], tbuf[34];
dtostrf(thermalManager.temp_hotend[0].celsius, 1, 1, tbuf);
strcat_P(tbuf, PSTR(" /"));
strcat(tbuf, dtostrf(thermalManager.temp_hotend[0].target, 1, 1, str_1));
const int tlen = strlen(tbuf);
sprintf_P(outBuf, PSTR("T:%s"), tbuf);
outBuf += 2 + tlen;
strcpy_P(outBuf, PSTR(" B:"));
outBuf += 3;
#if HAS_HEATED_BED
(float)thermalManager.temp_bed.celsius, (float)thermalManager.temp_bed.target,
strcpy(outBuf, dtostrf(thermalManager.temp_bed.celsius, 1, 1, str_1));
strcat_P(outBuf, PSTR(" /"));
strcat(outBuf, dtostrf(thermalManager.temp_bed.target, 1, 1, str_1));
#else
0.0f, 0.0f,
strcpy_P(outBuf, PSTR("0 /0"));
#endif
(float)thermalManager.temp_hotend[0].celsius, (float)thermalManager.temp_hotend[0].target,
#if DISABLED(SINGLENOZZLE) && HAS_MULTI_EXTRUDER
(float)thermalManager.temp_hotend[1].celsius, (float)thermalManager.temp_hotend[1].target
outBuf += 4;
strcat_P(outBuf, PSTR(" T0:"));
strcat(outBuf, tbuf);
outBuf += 4 + tlen;
strcat_P(outBuf, PSTR(" T1:"));
outBuf += 4;
#if HAS_MULTI_HOTEND
strcat(outBuf, dtostrf(thermalManager.temp_hotend[1].celsius, 1, 1, str_1));
strcat_P(outBuf, PSTR(" /"));
strcat(outBuf, dtostrf(thermalManager.temp_hotend[1].target, 1, 1, str_1));
#else
0.0f, 0.0f
strcat_P(outBuf, PSTR("0 /0"));
#endif
);
outBuf += 4;
strcat_P(outBuf, PSTR(" @:0 B@:0\r\n"));
}
else {
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
(int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target,
#else
0, 0,
#endif
(int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target,
#if DISABLED(SINGLENOZZLE) && HAS_MULTI_EXTRUDER
(int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target,
#if HAS_HEATED_BED
(int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target,
#else
0, 0,
#endif
(int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target,
#if HAS_MULTI_HOTEND
(int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target
#else
0, 0

4
Marlin/src/module/temperature.cpp

@ -3093,7 +3093,7 @@ void Temperature::tick() {
#endif
, H_CHAMBER
);
#endif // HAS_TEMP_CHAMBER
#endif
#if HAS_TEMP_PROBE
print_heater_state(degProbe(), 0
#if ENABLED(SHOW_TEMP_ADC_VALUES)
@ -3101,7 +3101,7 @@ void Temperature::tick() {
#endif
, H_PROBE
);
#endif // HAS_TEMP_PROBE
#endif
#if HAS_MULTI_HOTEND
HOTEND_LOOP() print_heater_state(degHotend(e), degTargetHotend(e)
#if ENABLED(SHOW_TEMP_ADC_VALUES)

Loading…
Cancel
Save