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

@ -105,7 +105,7 @@ void GcodeSuite::G35() {
do_blocking_move_to_z(SUM_TERN(BLTOUCH_HS_MODE, Z_CLEARANCE_BETWEEN_PROBES, 7));
const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[i], PROBE_PT_RAISE, 0, true);
if (ISNAN(z_probed_height)) {
if (isnan(z_probed_height)) {
SERIAL_ECHOPAIR("G35 failed at point ", i, " (");
SERIAL_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i]));
SERIAL_CHAR(')');

View File

@ -288,11 +288,11 @@ G29_TYPE GcodeSuite::G29() {
G29_RETURN(false);
}
const float rx = RAW_X_POSITION(parser.linearval('X', MFNAN)),
ry = RAW_Y_POSITION(parser.linearval('Y', MFNAN));
const float rx = RAW_X_POSITION(parser.linearval('X', NAN)),
ry = RAW_Y_POSITION(parser.linearval('Y', NAN));
int8_t i = parser.byteval('I', -1), j = parser.byteval('J', -1);
if (!ISNAN(rx) && !ISNAN(ry)) {
if (!isnan(rx) && !isnan(ry)) {
// Get nearest i / j from rx / ry
i = (rx - bilinear_start.x + 0.5 * abl.gridSpacing.x) / abl.gridSpacing.x;
j = (ry - bilinear_start.y + 0.5 * abl.gridSpacing.y) / abl.gridSpacing.y;
@ -609,7 +609,7 @@ G29_TYPE GcodeSuite::G29() {
// Outer loop is X with PROBE_Y_FIRST enabled
// Outer loop is Y with PROBE_Y_FIRST disabled
for (PR_OUTER_VAR = 0; PR_OUTER_VAR < PR_OUTER_SIZE && !ISNAN(abl.measured_z); PR_OUTER_VAR++) {
for (PR_OUTER_VAR = 0; PR_OUTER_VAR < PR_OUTER_SIZE && !isnan(abl.measured_z); PR_OUTER_VAR++) {
int8_t inStart, inStop, inInc;
@ -645,7 +645,7 @@ G29_TYPE GcodeSuite::G29() {
abl.measured_z = faux ? 0.001f * random(-100, 101) : probe.probe_at_point(abl.probePos, raise_after, abl.verbose_level);
if (ISNAN(abl.measured_z)) {
if (isnan(abl.measured_z)) {
set_bed_leveling_enabled(abl.reenable);
break; // Breaks out of both loops
}
@ -691,14 +691,14 @@ G29_TYPE GcodeSuite::G29() {
// Retain the last probe position
abl.probePos = points[i];
abl.measured_z = faux ? 0.001 * random(-100, 101) : probe.probe_at_point(abl.probePos, raise_after, abl.verbose_level);
if (ISNAN(abl.measured_z)) {
if (isnan(abl.measured_z)) {
set_bed_leveling_enabled(abl.reenable);
break;
}
points[i].z = abl.measured_z;
}
if (!abl.dryrun && !ISNAN(abl.measured_z)) {
if (!abl.dryrun && !isnan(abl.measured_z)) {
vector_3 planeNormal = vector_3::cross(points[0] - points[1], points[2] - points[1]).get_normal();
if (planeNormal.z < 0) planeNormal *= -1;
planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
@ -714,7 +714,7 @@ G29_TYPE GcodeSuite::G29() {
// Stow the probe. No raise for FIX_MOUNTED_PROBE.
if (probe.stow()) {
set_bed_leveling_enabled(abl.reenable);
abl.measured_z = MFNAN;
abl.measured_z = NAN;
}
}
#endif // !PROBE_MANUALLY
@ -737,7 +737,7 @@ G29_TYPE GcodeSuite::G29() {
#endif
// Calculate leveling, print reports, correct the position
if (!ISNAN(abl.measured_z)) {
if (!isnan(abl.measured_z)) {
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
if (!abl.dryrun) extrapolate_unprobed_bed_level();
@ -874,7 +874,7 @@ G29_TYPE GcodeSuite::G29() {
// Auto Bed Leveling is complete! Enable if possible.
planner.leveling_active = !abl.dryrun || abl.reenable;
} // !ISNAN(abl.measured_z)
} // !isnan(abl.measured_z)
// Restore state after probing
if (!faux) restore_feedrate_and_scaling();
@ -900,7 +900,7 @@ G29_TYPE GcodeSuite::G29() {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
G29_RETURN(ISNAN(abl.measured_z));
G29_RETURN(isnan(abl.measured_z));
}
#endif // HAS_ABL_NOT_UBL

View File

@ -62,7 +62,7 @@ void GcodeSuite::M421() {
SERIAL_ERROR_MSG(STR_ERR_MESH_XY);
else {
float &zval = ubl.z_values[ij.x][ij.y];
zval = hasN ? MFNAN : parser.value_linear_units() + (hasQ ? zval : 0);
zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0);
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval));
}
}

View File

@ -212,7 +212,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center
const xy_pos_t center{0};
z_pt[CEN] += calibration_probe(center, stow_after_each);
if (ISNAN(z_pt[CEN])) return false;
if (isnan(z_pt[CEN])) return false;
}
if (_7p_calibration) { // probe extra center points
@ -223,7 +223,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
r = dcr * 0.1;
const xy_pos_t vec = { cos(a), sin(a) };
z_pt[CEN] += calibration_probe(vec * r, stow_after_each);
if (ISNAN(z_pt[CEN])) return false;
if (isnan(z_pt[CEN])) return false;
}
z_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points);
}
@ -248,7 +248,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
interpol = FMOD(rad, 1);
const xy_pos_t vec = { cos(a), sin(a) };
const float z_temp = calibration_probe(vec * r, stow_after_each);
if (ISNAN(z_temp)) return false;
if (isnan(z_temp)) return false;
// split probe point to neighbouring calibration points
z_pt[uint8_t(LROUND(rad - interpol + NPP - 1)) % NPP + 1] += z_temp * sq(cos(RADIANS(interpol * 90)));
z_pt[uint8_t(LROUND(rad - interpol)) % NPP + 1] += z_temp * sq(sin(RADIANS(interpol * 90)));

View File

@ -229,7 +229,7 @@ void GcodeSuite::G34() {
// Probing sanity check is disabled, as it would trigger even in normal cases because
// current_position.z has been manually altered in the "dirty trick" above.
const float z_probed_height = probe.probe_at_point(z_stepper_align.xy[iprobe], raise_after, 0, true, false);
if (ISNAN(z_probed_height)) {
if (isnan(z_probed_height)) {
SERIAL_ECHOLNPGM("Probing failed");
LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
err_break = true;

View File

@ -113,7 +113,7 @@ void GcodeSuite::G76() {
auto g76_probe = [](const TempSensorID sid, uint16_t &targ, const xy_pos_t &nozpos) {
do_z_clearance(5.0); // Raise nozzle before probing
const float measured_z = probe.probe_at_point(nozpos, PROBE_PT_STOW, 0, false); // verbose=0, probe_relative=false
if (ISNAN(measured_z))
if (isnan(measured_z))
SERIAL_ECHOLNPGM("!Received NAN. Aborting.");
else {
SERIAL_ECHOLNPAIR_F("Measured: ", measured_z);
@ -208,7 +208,7 @@ void GcodeSuite::G76() {
report_temps(next_temp_report);
const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz);
if (ISNAN(measured_z) || target_bed > BED_MAX_TARGET) break;
if (isnan(measured_z) || target_bed > BED_MAX_TARGET) break;
}
SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
@ -267,7 +267,7 @@ void GcodeSuite::G76() {
if (timeout) break;
const float measured_z = g76_probe(TSI_PROBE, target_probe, noz_pos_xyz);
if (ISNAN(measured_z) || target_probe > cali_info_init[TSI_PROBE].end_temp) break;
if (isnan(measured_z) || target_probe > cali_info_init[TSI_PROBE].end_temp) break;
}
SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());

View File

@ -134,7 +134,7 @@ void GcodeSuite::M48() {
// Move to the first point, deploy, and probe
const float t = probe.probe_at_point(test_position, raise_after, verbose_level);
bool probing_good = !ISNAN(t);
bool probing_good = !isnan(t);
if (probing_good) {
randomSeed(millis());
@ -219,7 +219,7 @@ void GcodeSuite::M48() {
const float pz = probe.probe_at_point(test_position, raise_after, 0);
// Break the loop if the probe fails
probing_good = !ISNAN(pz);
probing_good = !isnan(pz);
if (!probing_good) break;
// Store the new sample

View File

@ -52,7 +52,7 @@ void GcodeSuite::G30() {
const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
const float measured_z = probe.probe_at_point(pos, raise_after, 1);
if (!ISNAN(measured_z))
if (!isnan(measured_z))
SERIAL_ECHOLNPAIR("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z);
restore_feedrate_and_scaling();