Scott Lahteine 4 лет назад
Родитель
Сommit
299f849ffa
1 измененных файлов: 22 добавлений и 10 удалений
  1. 22
    10
      Marlin/src/gcode/calibrate/G76_M192_M871.cpp

+ 22
- 10
Marlin/src/gcode/calibrate/G76_M192_M871.cpp Просмотреть файл

@@ -91,6 +91,12 @@
91 91
  *  - `B` - Run bed temperature calibration.
92 92
  *  - `P` - Run probe temperature calibration.
93 93
  */
94
+
95
+static void say_waiting_for()               { SERIAL_ECHOPGM("Waiting for "); }
96
+static void say_waiting_for_probe_heating() { say_waiting_for(); SERIAL_ECHOLNPGM("probe heating."); }
97
+static void say_successfully_calibrated()   { SERIAL_ECHOPGM("Successfully calibrated"); }
98
+static void say_failed_to_calibrate()       { SERIAL_ECHOPGM("!Failed to calibrate"); }
99
+
94 100
 void GcodeSuite::G76() {
95 101
   // Check if heated bed is available and z-homing is done with probe
96 102
   #if TEMP_SENSOR_BED == 0 || !(HOMING_Z_WITH_PROBE)
@@ -108,7 +114,7 @@ void GcodeSuite::G76() {
108 114
   };
109 115
 
110 116
   auto wait_for_temps = [&](const float tb, const float tp, millis_t &ntr, const millis_t timeout=0) {
111
-    SERIAL_ECHOLNPGM("Waiting for bed and probe temperature.");
117
+    say_waiting_for(); SERIAL_ECHOLNPGM("bed and probe temperature.");
112 118
     while (fabs(thermalManager.degBed() - tb) > 0.1f || thermalManager.degProbe() > tp)
113 119
       if (report_temps(ntr, timeout)) return true;
114 120
     return false;
@@ -184,7 +190,7 @@ void GcodeSuite::G76() {
184 190
     uint16_t target_bed = cali_info_init[TSI_BED].start_temp,
185 191
              target_probe = temp_comp.bed_calib_probe_temp;
186 192
 
187
-    SERIAL_ECHOLNPGM("Waiting for cooling.");
193
+    say_waiting_for(); SERIAL_ECHOLNPGM(" cooling.");
188 194
     while (thermalManager.degBed() > target_bed || thermalManager.degProbe() > target_probe)
189 195
       report_temps(next_temp_report);
190 196
 
@@ -207,7 +213,8 @@ void GcodeSuite::G76() {
207 213
 
208 214
       // Move the nozzle to the probing point and wait for the probe to reach target temp
209 215
       do_blocking_move_to(noz_pos_xyz);
210
-      SERIAL_ECHOLNPGM("Waiting for probe heating.");
216
+      say_waiting_for_probe_heating();
217
+      SERIAL_EOL();
211 218
       while (thermalManager.degProbe() < target_probe)
212 219
         report_temps(next_temp_report);
213 220
 
@@ -216,10 +223,14 @@ void GcodeSuite::G76() {
216 223
     }
217 224
 
218 225
     SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
219
-    if (temp_comp.finish_calibration(TSI_BED))
220
-      SERIAL_ECHOLNPGM("Successfully calibrated bed.");
221
-    else
222
-      SERIAL_ECHOLNPGM("!Failed to calibrate bed. Values reset.");
226
+    if (temp_comp.finish_calibration(TSI_BED)) {
227
+      say_successfully_calibrated();
228
+      SERIAL_ECHOLNPGM(" bed.");
229
+    }
230
+    else {
231
+      say_failed_to_calibrate();
232
+      SERIAL_ECHOLNPGM(" bed. Values reset.");
233
+    }
223 234
 
224 235
     // Cleanup
225 236
     thermalManager.setTargetBed(0);
@@ -254,7 +265,8 @@ void GcodeSuite::G76() {
254 265
       // Move probe to probing point and wait for it to reach target temperature
255 266
       do_blocking_move_to(noz_pos_xyz);
256 267
 
257
-      SERIAL_ECHOLNPAIR("Waiting for probe heating. Bed:", target_bed, " Probe:", target_probe);
268
+      say_waiting_for_probe_heating();
269
+      SERIAL_ECHOLNPAIR(" Bed:", target_bed, " Probe:", target_probe);
258 270
       const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
259 271
       while (thermalManager.degProbe() < target_probe) {
260 272
         if (report_temps(next_temp_report, probe_timeout_ms)) {
@@ -271,9 +283,9 @@ void GcodeSuite::G76() {
271 283
 
272 284
     SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
273 285
     if (temp_comp.finish_calibration(TSI_PROBE))
274
-      SERIAL_ECHOPGM("Successfully calibrated");
286
+      say_successfully_calibrated();
275 287
     else
276
-      SERIAL_ECHOPGM("!Failed to calibrate");
288
+      say_failed_to_calibrate();
277 289
     SERIAL_ECHOLNPGM(" probe.");
278 290
 
279 291
     // Cleanup

Загрузка…
Отмена
Сохранить