Reduce math library code size by 3.4KB (#21575)
This commit is contained in:
@ -43,7 +43,7 @@ bed_mesh_t z_values;
|
||||
* Extrapolate a single point from its neighbors
|
||||
*/
|
||||
static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
|
||||
if (!isnan(z_values[x][y])) return;
|
||||
if (!ISNAN(z_values[x][y])) return;
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
DEBUG_ECHOPGM("Extrapolate [");
|
||||
if (x < 10) DEBUG_CHAR(' ');
|
||||
@ -63,12 +63,12 @@ static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t
|
||||
c1 = z_values[x1][y1], c2 = z_values[x2][y2];
|
||||
|
||||
// Treat far unprobed points as zero, near as equal to far
|
||||
if (isnan(a2)) a2 = 0.0;
|
||||
if (isnan(a1)) a1 = a2;
|
||||
if (isnan(b2)) b2 = 0.0;
|
||||
if (isnan(b1)) b1 = b2;
|
||||
if (isnan(c2)) c2 = 0.0;
|
||||
if (isnan(c1)) c1 = c2;
|
||||
if (ISNAN(a2)) a2 = 0.0;
|
||||
if (ISNAN(a1)) a1 = a2;
|
||||
if (ISNAN(b2)) b2 = 0.0;
|
||||
if (ISNAN(b1)) b1 = b2;
|
||||
if (ISNAN(c2)) c2 = 0.0;
|
||||
if (ISNAN(c1)) c1 = c2;
|
||||
|
||||
const float a = 2 * a1 - a2, b = 2 * b1 - b2, c = 2 * c1 - c2;
|
||||
|
||||
|
@ -132,7 +132,7 @@ void reset_bed_level() {
|
||||
bilinear_start.reset();
|
||||
bilinear_grid_spacing.reset();
|
||||
GRID_LOOP(x, y) {
|
||||
z_values[x][y] = NAN;
|
||||
z_values[x][y] = MFNAN;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, 0));
|
||||
}
|
||||
#elif ABL_PLANAR
|
||||
@ -177,7 +177,7 @@ void reset_bed_level() {
|
||||
LOOP_L_N(x, sx) {
|
||||
SERIAL_CHAR(' ');
|
||||
const float offset = fn(x, y);
|
||||
if (!isnan(offset)) {
|
||||
if (!ISNAN(offset)) {
|
||||
if (offset >= 0) SERIAL_CHAR('+');
|
||||
SERIAL_ECHO_F(offset, int(precision));
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ public:
|
||||
static inline xy_int8_t probe_indexes(const xy_pos_t &xy) { return probe_indexes(xy.x, xy.y); }
|
||||
|
||||
static float calc_z0(const_float_t a0, const_float_t a1, const_float_t z1, const_float_t a2, const_float_t z2) {
|
||||
if (ISNAN(a0) || ISNAN(a1) || ISNAN(z1) || ISNAN(a2) || ISNAN(z2)) return MFNAN;
|
||||
const float delta_z = (z2 - z1) / (a2 - a1),
|
||||
delta_a = a0 - a1;
|
||||
return z1 + delta_a * delta_z;
|
||||
@ -114,9 +115,11 @@ public:
|
||||
const float x1 = index_to_xpos[ind.x], x2 = index_to_xpos[ind.x+1],
|
||||
y1 = index_to_xpos[ind.y], y2 = index_to_xpos[ind.y+1],
|
||||
z1 = calc_z0(pos.x, x1, z_values[ind.x][ind.y ], x2, z_values[ind.x+1][ind.y ]),
|
||||
z2 = calc_z0(pos.x, x1, z_values[ind.x][ind.y+1], x2, z_values[ind.x+1][ind.y+1]);
|
||||
z2 = calc_z0(pos.x, x1, z_values[ind.x][ind.y+1], x2, z_values[ind.x+1][ind.y+1]),
|
||||
zf = calc_z0(pos.y, y1, z1, y2, z2);
|
||||
|
||||
return z_offset + calc_z0(pos.y, y1, z1, y2, z2) * factor;
|
||||
|
||||
return ISNAN(zf) ? zf : z_offset + zf * factor;
|
||||
}
|
||||
|
||||
#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
|
||||
|
@ -48,7 +48,7 @@ void unified_bed_leveling::report_current_mesh() {
|
||||
if (!leveling_is_valid()) return;
|
||||
SERIAL_ECHO_MSG(" G29 I999");
|
||||
GRID_LOOP(x, y)
|
||||
if (!isnan(z_values[x][y])) {
|
||||
if (!ISNAN(z_values[x][y])) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPAIR(" M421 I", x, " J", y);
|
||||
SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z_values[x][y], 4);
|
||||
@ -99,7 +99,7 @@ void unified_bed_leveling::reset() {
|
||||
|
||||
void unified_bed_leveling::invalidate() {
|
||||
set_bed_leveling_enabled(false);
|
||||
set_all_mesh_points_to_value(NAN);
|
||||
set_all_mesh_points_to_value(MFNAN);
|
||||
}
|
||||
|
||||
void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
|
||||
@ -116,7 +116,7 @@ void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
|
||||
|
||||
void unified_bed_leveling::set_store_from_mesh(const bed_mesh_t &in_values, mesh_store_t &stored_values) {
|
||||
auto z_to_store = [](const_float_t z) {
|
||||
if (isnan(z)) return Z_STEPS_NAN;
|
||||
if (ISNAN(z)) return Z_STEPS_NAN;
|
||||
const int32_t z_scaled = TRUNC(z * mesh_store_scaling);
|
||||
if (z_scaled == Z_STEPS_NAN || !WITHIN(z_scaled, INT16_MIN, INT16_MAX))
|
||||
return Z_STEPS_NAN; // If Z is out of range, return our custom 'NaN'
|
||||
@ -127,7 +127,7 @@ void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
|
||||
|
||||
void unified_bed_leveling::set_mesh_from_store(const mesh_store_t &stored_values, bed_mesh_t &out_values) {
|
||||
auto store_to_z = [](const int16_t z_scaled) {
|
||||
return z_scaled == Z_STEPS_NAN ? NAN : z_scaled / mesh_store_scaling;
|
||||
return z_scaled == Z_STEPS_NAN ? MFNAN : z_scaled / mesh_store_scaling;
|
||||
};
|
||||
GRID_LOOP(x, y) out_values[x][y] = store_to_z(stored_values[x][y]);
|
||||
}
|
||||
@ -211,7 +211,7 @@ void unified_bed_leveling::display_map(const int map_type) {
|
||||
if (lcd) {
|
||||
// TODO: Display on Graphical LCD
|
||||
}
|
||||
else if (isnan(f))
|
||||
else if (ISNAN(f))
|
||||
SERIAL_ECHOPGM_P(human ? PSTR(" . ") : PSTR("NAN"));
|
||||
else if (human || csv) {
|
||||
if (human && f >= 0.0) SERIAL_CHAR(f > 0 ? '+' : ' '); // Display sign also for positive numbers (' ' for 0)
|
||||
|
@ -196,7 +196,7 @@ public:
|
||||
#ifdef UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
#define _UBL_OUTER_Z_RAISE UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
#else
|
||||
#define _UBL_OUTER_Z_RAISE NAN
|
||||
#define _UBL_OUTER_Z_RAISE MFNAN
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -264,39 +264,25 @@ public:
|
||||
return UBL_Z_RAISE_WHEN_OFF_MESH;
|
||||
#endif
|
||||
|
||||
const float z1 = calc_z0(rx0,
|
||||
mesh_index_to_xpos(cx), z_values[cx][cy],
|
||||
mesh_index_to_xpos(cx + 1), z_values[_MIN(cx, (GRID_MAX_POINTS_X) - 2) + 1][cy]);
|
||||
const uint8_t mx = _MIN(cx, (GRID_MAX_POINTS_X) - 2) + 1, my = _MIN(cy, (GRID_MAX_POINTS_Y) - 2) + 1;
|
||||
const float z1 = calc_z0(rx0, mesh_index_to_xpos(cx), z_values[cx][cy], mesh_index_to_xpos(cx + 1), z_values[mx][cy]);
|
||||
const float z2 = calc_z0(rx0, mesh_index_to_xpos(cx), z_values[cx][my], mesh_index_to_xpos(cx + 1), z_values[mx][my]);
|
||||
float z0 = calc_z0(ry0, mesh_index_to_ypos(cy), z1, mesh_index_to_ypos(cy + 1), z2);
|
||||
|
||||
const float z2 = calc_z0(rx0,
|
||||
mesh_index_to_xpos(cx), z_values[cx][_MIN(cy, (GRID_MAX_POINTS_Y) - 2) + 1],
|
||||
mesh_index_to_xpos(cx + 1), z_values[_MIN(cx, (GRID_MAX_POINTS_X) - 2) + 1][_MIN(cy, (GRID_MAX_POINTS_Y) - 2) + 1]);
|
||||
|
||||
float z0 = calc_z0(ry0,
|
||||
mesh_index_to_ypos(cy), z1,
|
||||
mesh_index_to_ypos(cy + 1), z2);
|
||||
|
||||
if (DEBUGGING(MESH_ADJUST)) {
|
||||
DEBUG_ECHOPAIR(" raw get_z_correction(", rx0);
|
||||
DEBUG_CHAR(','); DEBUG_ECHO(ry0);
|
||||
DEBUG_ECHOPAIR_F(") = ", z0, 6);
|
||||
DEBUG_ECHOLNPAIR_F(" >>>---> ", z0, 6);
|
||||
}
|
||||
|
||||
if (isnan(z0)) { // if part of the Mesh is undefined, it will show up as NAN
|
||||
if (ISNAN(z0)) { // if part of the Mesh is undefined, it will show up as MFNAN
|
||||
z0 = 0.0; // in ubl.z_values[][] and propagate through the
|
||||
// calculations. If our correction is NAN, we throw it out
|
||||
// because part of the Mesh is undefined and we don't have the
|
||||
// information we need to complete the height correction.
|
||||
|
||||
if (DEBUGGING(MESH_ADJUST)) {
|
||||
DEBUG_ECHOPAIR("??? Yikes! NAN in get_z_correction(", rx0);
|
||||
DEBUG_CHAR(',');
|
||||
DEBUG_ECHO(ry0);
|
||||
DEBUG_CHAR(')');
|
||||
DEBUG_EOL();
|
||||
}
|
||||
if (DEBUGGING(MESH_ADJUST)) DEBUG_ECHOLNPAIR("??? Yikes! NAN in ");
|
||||
}
|
||||
|
||||
if (DEBUGGING(MESH_ADJUST)) {
|
||||
DEBUG_ECHOPAIR("get_z_correction(", rx0, ", ", ry0);
|
||||
DEBUG_ECHOLNPAIR_F(") => ", z0, 6);
|
||||
}
|
||||
|
||||
return z0;
|
||||
}
|
||||
static inline float get_z_correction(const xy_pos_t &pos) { return get_z_correction(pos.x, pos.y); }
|
||||
@ -315,7 +301,7 @@ public:
|
||||
#endif
|
||||
|
||||
static inline bool mesh_is_valid() {
|
||||
GRID_LOOP(x, y) if (isnan(z_values[x][y])) return false;
|
||||
GRID_LOOP(x, y) if (ISNAN(z_values[x][y])) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ void unified_bed_leveling::G29() {
|
||||
// to invalidate the ENTIRE mesh, which can't be done with
|
||||
// find_closest_mesh_point (which only returns REAL points).
|
||||
if (closest.pos.x < 0) { invalidate_all = true; break; }
|
||||
z_values[closest.pos.x][closest.pos.y] = NAN;
|
||||
z_values[closest.pos.x][closest.pos.y] = MFNAN;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(closest.pos, 0.0f));
|
||||
}
|
||||
}
|
||||
@ -516,7 +516,7 @@ void unified_bed_leveling::G29() {
|
||||
if (cpos.x < 0) {
|
||||
// No more REAL INVALID mesh points to populate, so we ASSUME
|
||||
// user meant to populate ALL INVALID mesh points to value
|
||||
GRID_LOOP(x, y) if (isnan(z_values[x][y])) z_values[x][y] = param.C_constant;
|
||||
GRID_LOOP(x, y) if (ISNAN(z_values[x][y])) z_values[x][y] = param.C_constant;
|
||||
break; // No more invalid Mesh Points to populate
|
||||
}
|
||||
else {
|
||||
@ -675,7 +675,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
|
||||
float sum = 0;
|
||||
int n = 0;
|
||||
GRID_LOOP(x, y)
|
||||
if (!isnan(z_values[x][y])) {
|
||||
if (!ISNAN(z_values[x][y])) {
|
||||
sum += z_values[x][y];
|
||||
n++;
|
||||
}
|
||||
@ -687,7 +687,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
|
||||
//
|
||||
float sum_of_diff_squared = 0;
|
||||
GRID_LOOP(x, y)
|
||||
if (!isnan(z_values[x][y]))
|
||||
if (!ISNAN(z_values[x][y]))
|
||||
sum_of_diff_squared += sq(z_values[x][y] - mean);
|
||||
|
||||
SERIAL_ECHOLNPAIR("# of samples: ", n);
|
||||
@ -698,7 +698,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
|
||||
|
||||
if (cflag)
|
||||
GRID_LOOP(x, y)
|
||||
if (!isnan(z_values[x][y])) {
|
||||
if (!ISNAN(z_values[x][y])) {
|
||||
z_values[x][y] -= mean + offset;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
}
|
||||
@ -709,7 +709,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
|
||||
*/
|
||||
void unified_bed_leveling::shift_mesh_height() {
|
||||
GRID_LOOP(x, y)
|
||||
if (!isnan(z_values[x][y])) {
|
||||
if (!ISNAN(z_values[x][y])) {
|
||||
z_values[x][y] += param.C_constant;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
}
|
||||
@ -1017,7 +1017,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
ui.refresh();
|
||||
|
||||
float new_z = z_values[lpos.x][lpos.y];
|
||||
if (isnan(new_z)) new_z = 0; // Invalid points begin at 0
|
||||
if (ISNAN(new_z)) new_z = 0; // Invalid points begin at 0
|
||||
new_z = FLOOR(new_z * 1000) * 0.001f; // Chop off digits after the 1000ths place
|
||||
|
||||
ui.ubl_mesh_edit_start(new_z);
|
||||
@ -1227,7 +1227,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
|
||||
mesh_index_pair farthest { -1, -1, -99999.99 };
|
||||
|
||||
GRID_LOOP(i, j) {
|
||||
if (!isnan(z_values[i][j])) continue; // Skip valid mesh points
|
||||
if (!ISNAN(z_values[i][j])) continue; // Skip valid mesh points
|
||||
|
||||
// Skip unreachable points
|
||||
if (!probe.can_reach(mesh_index_to_xpos(i), mesh_index_to_ypos(j)))
|
||||
@ -1238,7 +1238,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
|
||||
xy_int8_t nearby { -1, -1 };
|
||||
float d1, d2 = 99999.9f;
|
||||
GRID_LOOP(k, l) {
|
||||
if (isnan(z_values[k][l])) continue;
|
||||
if (ISNAN(z_values[k][l])) continue;
|
||||
|
||||
found_a_real = true;
|
||||
|
||||
@ -1282,7 +1282,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
|
||||
|
||||
static bool test_func(uint8_t i, uint8_t j, void *data) {
|
||||
find_closest_t *d = (find_closest_t*)data;
|
||||
if ( (d->type == (isnan(ubl.z_values[i][j]) ? INVALID : REAL))
|
||||
if ( (d->type == (ISNAN(ubl.z_values[i][j]) ? INVALID : REAL))
|
||||
|| (d->type == SET_IN_BITMAP && !d->done_flags->marked(i, j))
|
||||
) {
|
||||
// Found a Mesh Point of the specified type!
|
||||
@ -1326,7 +1326,7 @@ mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const Mesh
|
||||
float best_so_far = 99999.99f;
|
||||
|
||||
GRID_LOOP(i, j) {
|
||||
if ( (type == (isnan(z_values[i][j]) ? INVALID : REAL))
|
||||
if ( (type == (ISNAN(z_values[i][j]) ? INVALID : REAL))
|
||||
|| (type == SET_IN_BITMAP && !done_flags->marked(i, j))
|
||||
) {
|
||||
// Found a Mesh Point of the specified type!
|
||||
@ -1367,12 +1367,12 @@ mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const Mesh
|
||||
|
||||
bool unified_bed_leveling::smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
|
||||
const float v = z_values[x][y];
|
||||
if (isnan(v)) { // A NAN...
|
||||
if (ISNAN(v)) { // A NAN...
|
||||
const int8_t dx = x + xdir, dy = y + ydir;
|
||||
const float v1 = z_values[dx][dy];
|
||||
if (!isnan(v1)) { // ...next to a pair of real values?
|
||||
if (!ISNAN(v1)) { // ...next to a pair of real values?
|
||||
const float v2 = z_values[dx + xdir][dy + ydir];
|
||||
if (!isnan(v2)) {
|
||||
if (!ISNAN(v2)) {
|
||||
z_values[x][y] = v1 < v2 ? v1 : v1 + v1 - v2;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
return true;
|
||||
@ -1441,7 +1441,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
|
||||
measured_z = probe.probe_at_point(points[0], PROBE_PT_RAISE, param.V_verbosity);
|
||||
if (isnan(measured_z))
|
||||
if (ISNAN(measured_z))
|
||||
abort_flag = true;
|
||||
else {
|
||||
measured_z -= get_z_correction(points[0]);
|
||||
@ -1463,7 +1463,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
#ifdef VALIDATE_MESH_TILT
|
||||
z2 = measured_z;
|
||||
#endif
|
||||
if (isnan(measured_z))
|
||||
if (ISNAN(measured_z))
|
||||
abort_flag = true;
|
||||
else {
|
||||
measured_z -= get_z_correction(points[1]);
|
||||
@ -1483,7 +1483,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
#ifdef VALIDATE_MESH_TILT
|
||||
z3 = measured_z;
|
||||
#endif
|
||||
if (isnan(measured_z))
|
||||
if (ISNAN(measured_z))
|
||||
abort_flag = true;
|
||||
else {
|
||||
measured_z -= get_z_correction(points[2]);
|
||||
@ -1522,7 +1522,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
|
||||
measured_z = probe.probe_at_point(rpos, parser.seen('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity); // TODO: Needs error handling
|
||||
|
||||
abort_flag = isnan(measured_z);
|
||||
abort_flag = ISNAN(measured_z);
|
||||
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
@ -1673,14 +1673,14 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
|
||||
const float weight_scaled = weight_factor * _MAX(MESH_X_DIST, MESH_Y_DIST);
|
||||
|
||||
GRID_LOOP(jx, jy) if (!isnan(z_values[jx][jy])) SBI(bitmap[jx], jy);
|
||||
GRID_LOOP(jx, jy) if (!ISNAN(z_values[jx][jy])) SBI(bitmap[jx], jy);
|
||||
|
||||
xy_pos_t ppos;
|
||||
LOOP_L_N(ix, GRID_MAX_POINTS_X) {
|
||||
ppos.x = mesh_index_to_xpos(ix);
|
||||
LOOP_L_N(iy, GRID_MAX_POINTS_Y) {
|
||||
ppos.y = mesh_index_to_ypos(iy);
|
||||
if (isnan(z_values[ix][iy])) {
|
||||
if (ISNAN(z_values[ix][iy])) {
|
||||
// undefined mesh point at (ppos.x,ppos.y), compute weighted LSF from original valid mesh points.
|
||||
incremental_LSF_reset(&lsf_results);
|
||||
xy_pos_t rpos;
|
||||
|
@ -85,7 +85,7 @@
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (!isnan(z0)) end.z += z0;
|
||||
if (!ISNAN(z0)) end.z += z0;
|
||||
planner.buffer_segment(end, scaled_fr_mm_s, extruder);
|
||||
current_position = destination;
|
||||
return;
|
||||
@ -150,7 +150,7 @@
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
if (ISNAN(z0)) z0 = 0.0;
|
||||
|
||||
const float ry = mesh_index_to_ypos(icell.y);
|
||||
|
||||
@ -198,7 +198,7 @@
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
if (ISNAN(z0)) z0 = 0.0;
|
||||
|
||||
/**
|
||||
* Without this check, it's possible to generate a zero length move, as in the case where
|
||||
@ -253,7 +253,7 @@
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
if (ISNAN(z0)) z0 = 0.0;
|
||||
|
||||
if (!inf_normalized_flag) {
|
||||
on_axis_distance = use_x_dist ? rx - start.x : next_mesh_line_y - start.y;
|
||||
@ -276,7 +276,7 @@
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
if (ISNAN(z0)) z0 = 0.0;
|
||||
|
||||
if (!inf_normalized_flag) {
|
||||
on_axis_distance = use_x_dist ? next_mesh_line_x - start.x : ry - start.y;
|
||||
@ -405,10 +405,10 @@
|
||||
z_x0y1 = z_values[icell.x ][icell.y+1], // z at lower right corner
|
||||
z_x1y1 = z_values[icell.x+1][icell.y+1]; // z at upper right corner
|
||||
|
||||
if (isnan(z_x0y0)) z_x0y0 = 0; // ideally activating planner.leveling_active (G29 A)
|
||||
if (isnan(z_x1y0)) z_x1y0 = 0; // should refuse if any invalid mesh points
|
||||
if (isnan(z_x0y1)) z_x0y1 = 0; // in order to avoid isnan tests per cell,
|
||||
if (isnan(z_x1y1)) z_x1y1 = 0; // thus guessing zero for undefined points
|
||||
if (ISNAN(z_x0y0)) z_x0y0 = 0; // ideally activating planner.leveling_active (G29 A)
|
||||
if (ISNAN(z_x1y0)) z_x1y0 = 0; // should refuse if any invalid mesh points
|
||||
if (ISNAN(z_x0y1)) z_x0y1 = 0; // in order to avoid ISNAN tests per cell,
|
||||
if (ISNAN(z_x1y1)) z_x1y1 = 0; // thus guessing zero for undefined points
|
||||
|
||||
const xy_pos_t pos = { mesh_index_to_xpos(icell.x), mesh_index_to_ypos(icell.y) };
|
||||
xy_pos_t cell = raw - pos;
|
||||
|
Reference in New Issue
Block a user