소스 검색

Optimize some G76 strings

Scott Lahteine 4 년 전
부모
커밋
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
  *  - `B` - Run bed temperature calibration.
91
  *  - `B` - Run bed temperature calibration.
92
  *  - `P` - Run probe temperature calibration.
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
 void GcodeSuite::G76() {
100
 void GcodeSuite::G76() {
95
   // Check if heated bed is available and z-homing is done with probe
101
   // Check if heated bed is available and z-homing is done with probe
96
   #if TEMP_SENSOR_BED == 0 || !(HOMING_Z_WITH_PROBE)
102
   #if TEMP_SENSOR_BED == 0 || !(HOMING_Z_WITH_PROBE)
108
   };
114
   };
109
 
115
 
110
   auto wait_for_temps = [&](const float tb, const float tp, millis_t &ntr, const millis_t timeout=0) {
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
     while (fabs(thermalManager.degBed() - tb) > 0.1f || thermalManager.degProbe() > tp)
118
     while (fabs(thermalManager.degBed() - tb) > 0.1f || thermalManager.degProbe() > tp)
113
       if (report_temps(ntr, timeout)) return true;
119
       if (report_temps(ntr, timeout)) return true;
114
     return false;
120
     return false;
184
     uint16_t target_bed = cali_info_init[TSI_BED].start_temp,
190
     uint16_t target_bed = cali_info_init[TSI_BED].start_temp,
185
              target_probe = temp_comp.bed_calib_probe_temp;
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
     while (thermalManager.degBed() > target_bed || thermalManager.degProbe() > target_probe)
194
     while (thermalManager.degBed() > target_bed || thermalManager.degProbe() > target_probe)
189
       report_temps(next_temp_report);
195
       report_temps(next_temp_report);
190
 
196
 
207
 
213
 
208
       // Move the nozzle to the probing point and wait for the probe to reach target temp
214
       // Move the nozzle to the probing point and wait for the probe to reach target temp
209
       do_blocking_move_to(noz_pos_xyz);
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
       while (thermalManager.degProbe() < target_probe)
218
       while (thermalManager.degProbe() < target_probe)
212
         report_temps(next_temp_report);
219
         report_temps(next_temp_report);
213
 
220
 
216
     }
223
     }
217
 
224
 
218
     SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
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
     // Cleanup
235
     // Cleanup
225
     thermalManager.setTargetBed(0);
236
     thermalManager.setTargetBed(0);
254
       // Move probe to probing point and wait for it to reach target temperature
265
       // Move probe to probing point and wait for it to reach target temperature
255
       do_blocking_move_to(noz_pos_xyz);
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
       const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
270
       const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
259
       while (thermalManager.degProbe() < target_probe) {
271
       while (thermalManager.degProbe() < target_probe) {
260
         if (report_temps(next_temp_report, probe_timeout_ms)) {
272
         if (report_temps(next_temp_report, probe_timeout_ms)) {
271
 
283
 
272
     SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
284
     SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
273
     if (temp_comp.finish_calibration(TSI_PROBE))
285
     if (temp_comp.finish_calibration(TSI_PROBE))
274
-      SERIAL_ECHOPGM("Successfully calibrated");
286
+      say_successfully_calibrated();
275
     else
287
     else
276
-      SERIAL_ECHOPGM("!Failed to calibrate");
288
+      say_failed_to_calibrate();
277
     SERIAL_ECHOLNPGM(" probe.");
289
     SERIAL_ECHOLNPGM(" probe.");
278
 
290
 
279
     // Cleanup
291
     // Cleanup

Loading…
취소
저장