Reduce math library code size by 3.4KB (#21575)

This commit is contained in:
Scott Lahteine
2021-04-12 16:49:53 -05:00
committed by GitHub
parent 1742fb8655
commit 24a095c5c1
35 changed files with 141 additions and 145 deletions

View File

@ -583,7 +583,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
* @details Used by probe_at_point to get the bed Z height at the current XY.
* Leaves current_position.z at the height where the probe triggered.
*
* @return The Z position of the bed at the current XY or NAN on error.
* @return The Z position of the bed at the current XY or MFNAN on error.
*/
float Probe::run_z_probe(const bool sanity_check/*=true*/) {
DEBUG_SECTION(log_probe, "Probe::run_z_probe", DEBUGGING(LEVELING));
@ -617,11 +617,11 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#if TOTAL_PROBING == 2
// Attempt to tare the probe
if (TERN0(PROBE_TARE, tare())) return NAN;
if (TERN0(PROBE_TARE, tare())) return MFNAN;
// Do a first probe at the fast speed
if (try_to_probe(PSTR("FAST"), z_probe_low_point, z_probe_fast_mm_s,
sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return NAN;
sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return MFNAN;
const float first_probe_z = current_position.z;
@ -662,7 +662,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
// Probe downward slowly to find the bed
if (try_to_probe(PSTR("SLOW"), z_probe_low_point, MMM_TO_MMS(Z_PROBE_FEEDRATE_SLOW),
sanity_check, Z_CLEARANCE_MULTI_PROBE) ) return NAN;
sanity_check, Z_CLEARANCE_MULTI_PROBE) ) return MFNAN;
TERN_(MEASURE_BACKLASH_WHEN_PROBING, backlash.measure_with_probe());
@ -765,29 +765,29 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
if (probe_relative) { // The given position is in terms of the probe
if (!can_reach(npos)) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Position Not Reachable");
return NAN;
return MFNAN;
}
npos -= offset_xy; // Get the nozzle position
}
else if (!position_is_reachable(npos)) return NAN; // The given position is in terms of the nozzle
else if (!position_is_reachable(npos)) return MFNAN; // The given position is in terms of the nozzle
// Move the probe to the starting XYZ
do_blocking_move_to(npos, feedRate_t(XY_PROBE_FEEDRATE_MM_S));
float measured_z = NAN;
float measured_z = MFNAN;
if (!deploy()) measured_z = run_z_probe(sanity_check) + offset.z;
if (!isnan(measured_z)) {
if (!ISNAN(measured_z)) {
const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
if (big_raise || raise_after == PROBE_PT_RAISE)
do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), z_probe_fast_mm_s);
else if (raise_after == PROBE_PT_STOW)
if (stow()) measured_z = NAN; // Error on stow?
if (stow()) measured_z = MFNAN; // Error on stow?
if (verbose_level > 2)
SERIAL_ECHOLNPAIR("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z);
}
if (isnan(measured_z)) {
if (ISNAN(measured_z)) {
stow();
LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
#if DISABLED(G29_RETRY_AND_RECOVER)