Browse Source

Eliminate goto in gcode_M48

pull/1/head
Scott Lahteine 7 years ago
parent
commit
ac76101ec3
  1. 20
      Marlin/Marlin_main.cpp

20
Marlin/Marlin_main.cpp

@ -7038,8 +7038,9 @@ inline void gcode_M42() {
// Move to the first point, deploy, and probe
const float t = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
if (nan_error(t)) goto FAIL;
bool probing_good = !isnan(t);
if (probing_good) {
randomSeed(millis());
for (uint8_t n = 0; n < n_samples; n++) {
@ -7113,7 +7114,10 @@ inline void gcode_M42() {
// Probe a single point
sample_set[n] = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, 0);
if (nan_error(sample_set[n])) goto FAIL;
// Break the loop if the probe fails
probing_good = !isnan(sample_set[n]);
if (!probing_good) break;
/**
* Get the current mean for the data points we have so far
@ -7157,12 +7161,13 @@ inline void gcode_M42() {
}
}
} // End of probe loop
} // n_samples loop
}
if (STOW_PROBE()) goto FAIL;
STOW_PROBE();
SERIAL_PROTOCOLPGM("Finished!");
SERIAL_EOL();
if (probing_good) {
SERIAL_PROTOCOLLNPGM("Finished!");
if (verbose_level > 0) {
SERIAL_PROTOCOLPGM("Mean: ");
@ -7180,8 +7185,7 @@ inline void gcode_M42() {
SERIAL_PROTOCOL_F(sigma, 6);
SERIAL_EOL();
SERIAL_EOL();
FAIL:
}
clean_up_after_endstop_or_probe_move();

Loading…
Cancel
Save