Revert experimental NAN patch

Hold changes from #21575 (24a095c) for more testing.
This commit is contained in:
Scott Lahteine
2021-04-16 02:43:59 -05:00
parent 32dba5e0c7
commit 528b9bd872
31 changed files with 104 additions and 109 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 MFNAN on error.
* @return The Z position of the bed at the current XY or NAN 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 MFNAN;
if (TERN0(PROBE_TARE, tare())) return NAN;
// 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 MFNAN;
sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return NAN;
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 MFNAN;
sanity_check, Z_CLEARANCE_MULTI_PROBE) ) return NAN;
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 MFNAN;
return NAN;
}
npos -= offset_xy; // Get the nozzle position
}
else if (!position_is_reachable(npos)) return MFNAN; // The given position is in terms of the nozzle
else if (!position_is_reachable(npos)) return NAN; // 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 = MFNAN;
float measured_z = NAN;
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 = MFNAN; // Error on stow?
if (stow()) measured_z = NAN; // 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)

View File

@ -900,8 +900,8 @@ void MarlinSettings::postprocess() {
HOTEND_LOOP() {
PIDCF_t pidcf = {
#if DISABLED(PIDTEMP)
MFNAN, MFNAN, MFNAN,
MFNAN, MFNAN
NAN, NAN, NAN,
NAN, NAN
#else
PID_PARAM(Kp, e),
unscalePID_i(PID_PARAM(Ki, e)),
@ -928,7 +928,7 @@ void MarlinSettings::postprocess() {
const PID_t bed_pid = {
#if DISABLED(PIDTEMPBED)
MFNAN, MFNAN, MFNAN
NAN, NAN, NAN
#else
// Store the unscaled PID values
thermalManager.temp_bed.pid.Kp,
@ -947,7 +947,7 @@ void MarlinSettings::postprocess() {
const PID_t chamber_pid = {
#if DISABLED(PIDTEMPCHAMBER)
MFNAN, MFNAN, MFNAN
NAN, NAN, NAN
#else
// Store the unscaled PID values
thermalManager.temp_chamber.pid.Kp,
@ -1786,7 +1786,7 @@ void MarlinSettings::postprocess() {
PIDCF_t pidcf;
EEPROM_READ(pidcf);
#if ENABLED(PIDTEMP)
if (!validating && !ISNAN(pidcf.Kp)) {
if (!validating && !isnan(pidcf.Kp)) {
// Scale PID values since EEPROM values are unscaled
PID_PARAM(Kp, e) = pidcf.Kp;
PID_PARAM(Ki, e) = scalePID_i(pidcf.Ki);
@ -1818,7 +1818,7 @@ void MarlinSettings::postprocess() {
PID_t pid;
EEPROM_READ(pid);
#if ENABLED(PIDTEMPBED)
if (!validating && !ISNAN(pid.Kp)) {
if (!validating && !isnan(pid.Kp)) {
// Scale PID values since EEPROM values are unscaled
thermalManager.temp_bed.pid.Kp = pid.Kp;
thermalManager.temp_bed.pid.Ki = scalePID_i(pid.Ki);
@ -1834,7 +1834,7 @@ void MarlinSettings::postprocess() {
PID_t pid;
EEPROM_READ(pid);
#if ENABLED(PIDTEMPCHAMBER)
if (!validating && !ISNAN(pid.Kp)) {
if (!validating && !isnan(pid.Kp)) {
// Scale PID values since EEPROM values are unscaled
thermalManager.temp_chamber.pid.Kp = pid.Kp;
thermalManager.temp_chamber.pid.Ki = scalePID_i(pid.Ki);

View File

@ -74,9 +74,9 @@ hotend_pid_t;
#endif
#define PID_PARAM(F,H) _PID_##F(TERN(PID_PARAMS_PER_HOTEND, H, 0 & H)) // Always use 'H' to suppress warning
#define _PID_Kp(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kp, MFNAN)
#define _PID_Ki(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Ki, MFNAN)
#define _PID_Kd(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kd, MFNAN)
#define _PID_Kp(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kp, NAN)
#define _PID_Ki(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Ki, NAN)
#define _PID_Kd(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kd, NAN)
#if ENABLED(PIDTEMP)
#define _PID_Kc(H) TERN(PID_EXTRUSION_SCALING, Temperature::temp_hotend[H].pid.Kc, 1)
#define _PID_Kf(H) TERN(PID_FAN_SCALING, Temperature::temp_hotend[H].pid.Kf, 0)