|
@@ -152,7 +152,7 @@
|
152
|
152
|
static void save_ubl_active_state_and_disable();
|
153
|
153
|
static void restore_ubl_active_state_and_leave();
|
154
|
154
|
static void display_map(const int);
|
155
|
|
- static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const float&, const float&, const bool, unsigned int[16], bool);
|
|
155
|
+ static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const float&, const float&, const bool, uint16_t[16], bool);
|
156
|
156
|
static void reset();
|
157
|
157
|
static void invalidate();
|
158
|
158
|
static void set_all_mesh_points_to_value(float);
|
|
@@ -247,10 +247,10 @@
|
247
|
247
|
|
248
|
248
|
/**
|
249
|
249
|
* z_correction_for_x_on_horizontal_mesh_line is an optimization for
|
250
|
|
- * the rare occasion when a point lies exactly on a Mesh line (denoted by index yi).
|
|
250
|
+ * the case where the printer is making a vertical line that only crosses horizontal mesh lines.
|
251
|
251
|
*/
|
252
|
252
|
inline static float z_correction_for_x_on_horizontal_mesh_line(const float &lx0, const int x1_i, const int yi) {
|
253
|
|
- if (!WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(yi, 0, GRID_MAX_POINTS_Y - 1)) {
|
|
253
|
+ if (!WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 2) || !WITHIN(yi, 0, GRID_MAX_POINTS_Y - 1)) {
|
254
|
254
|
serialprintPGM( !WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 1) ? PSTR("x1l_i") : PSTR("yi") );
|
255
|
255
|
SERIAL_ECHOPAIR(" out of bounds in z_correction_for_x_on_horizontal_mesh_line(lx0=", lx0);
|
256
|
256
|
SERIAL_ECHOPAIR(",x1_i=", x1_i);
|
|
@@ -270,7 +270,7 @@
|
270
|
270
|
// See comments above for z_correction_for_x_on_horizontal_mesh_line
|
271
|
271
|
//
|
272
|
272
|
inline static float z_correction_for_y_on_vertical_mesh_line(const float &ly0, const int xi, const int y1_i) {
|
273
|
|
- if (!WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(y1_i, 0, GRID_MAX_POINTS_Y - 1)) {
|
|
273
|
+ if (!WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(y1_i, 0, GRID_MAX_POINTS_Y - 2)) {
|
274
|
274
|
serialprintPGM( !WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) ? PSTR("xi") : PSTR("yl_i") );
|
275
|
275
|
SERIAL_ECHOPAIR(" out of bounds in z_correction_for_y_on_vertical_mesh_line(ly0=", ly0);
|
276
|
276
|
SERIAL_ECHOPAIR(", xi=", xi);
|
|
@@ -296,7 +296,7 @@
|
296
|
296
|
const int8_t cx = get_cell_index_x(RAW_X_POSITION(lx0)),
|
297
|
297
|
cy = get_cell_index_y(RAW_Y_POSITION(ly0));
|
298
|
298
|
|
299
|
|
- if (!WITHIN(cx, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(cy, 0, GRID_MAX_POINTS_Y - 1)) {
|
|
299
|
+ if (!WITHIN(cx, 0, GRID_MAX_POINTS_X - 2) || !WITHIN(cy, 0, GRID_MAX_POINTS_Y - 2)) {
|
300
|
300
|
|
301
|
301
|
SERIAL_ECHOPAIR("? in get_z_correction(lx0=", lx0);
|
302
|
302
|
SERIAL_ECHOPAIR(", ly0=", ly0);
|
|
@@ -307,7 +307,7 @@
|
307
|
307
|
strcpy(lcd_status_message, "get_z_correction() indexes out of range.");
|
308
|
308
|
lcd_quick_feedback();
|
309
|
309
|
#endif
|
310
|
|
- return 0.0; // this used to return state.z_offset
|
|
310
|
+ return NAN; // this used to return state.z_offset
|
311
|
311
|
}
|
312
|
312
|
|
313
|
313
|
const float z1 = calc_z0(RAW_X_POSITION(lx0),
|
|
@@ -384,8 +384,19 @@
|
384
|
384
|
FORCE_INLINE static float fade_scaling_factor_for_z(const float &lz) { return 1.0; }
|
385
|
385
|
#endif
|
386
|
386
|
|
387
|
|
- FORCE_INLINE static float mesh_index_to_xpos(const uint8_t i) { return pgm_read_float(&_mesh_index_to_xpos[i]); }
|
388
|
|
- FORCE_INLINE static float mesh_index_to_ypos(const uint8_t i) { return pgm_read_float(&_mesh_index_to_ypos[i]); }
|
|
387
|
+ FORCE_INLINE static float mesh_index_to_xpos(const uint8_t i) {
|
|
388
|
+ if (i<GRID_MAX_POINTS_X)
|
|
389
|
+ return pgm_read_float(&_mesh_index_to_xpos[i]);
|
|
390
|
+ else
|
|
391
|
+ return UBL_MESH_MIN_X + i * (MESH_X_DIST);
|
|
392
|
+ }
|
|
393
|
+
|
|
394
|
+ FORCE_INLINE static float mesh_index_to_ypos(const uint8_t i) {
|
|
395
|
+ if (i<GRID_MAX_POINTS_Y)
|
|
396
|
+ return pgm_read_float(&_mesh_index_to_ypos[i]);
|
|
397
|
+ else
|
|
398
|
+ return UBL_MESH_MIN_Y + i * (MESH_Y_DIST);
|
|
399
|
+ }
|
389
|
400
|
|
390
|
401
|
static bool prepare_segmented_line_to(const float ltarget[XYZE], const float &feedrate);
|
391
|
402
|
static void line_to_destination_cartesian(const float &fr, uint8_t e);
|