|
@@ -113,6 +113,10 @@
|
113
|
113
|
#include "../../module/temperature.h"
|
114
|
114
|
#include "../../lcd/marlinui.h"
|
115
|
115
|
|
|
116
|
+#if ENABLED(UBL_HILBERT_CURVE)
|
|
117
|
+ #include "../../feature/bedlevel/hilbert_curve.h"
|
|
118
|
+#endif
|
|
119
|
+
|
116
|
120
|
#define EXTRUSION_MULTIPLIER 1.0
|
117
|
121
|
#define PRIME_LENGTH 10.0
|
118
|
122
|
#define OOZE_AMOUNT 0.3
|
|
@@ -145,24 +149,9 @@
|
145
|
149
|
|
146
|
150
|
constexpr float g26_e_axis_feedrate = 0.025;
|
147
|
151
|
|
148
|
|
-static MeshFlags circle_flags, horizontal_mesh_line_flags, vertical_mesh_line_flags;
|
|
152
|
+static MeshFlags circle_flags;
|
149
|
153
|
float g26_random_deviation = 0.0;
|
150
|
154
|
|
151
|
|
-static bool g26_retracted = false; // Track the retracted state of the nozzle so mismatched
|
152
|
|
- // retracts/recovers won't result in a bad state.
|
153
|
|
-
|
154
|
|
-float g26_extrusion_multiplier,
|
155
|
|
- g26_retraction_multiplier,
|
156
|
|
- g26_layer_height,
|
157
|
|
- g26_prime_length;
|
158
|
|
-
|
159
|
|
-xy_pos_t g26_xy_pos; // = { 0, 0 }
|
160
|
|
-
|
161
|
|
-int16_t g26_bed_temp,
|
162
|
|
- g26_hotend_temp;
|
163
|
|
-
|
164
|
|
-int8_t g26_prime_flag;
|
165
|
|
-
|
166
|
155
|
#if HAS_LCD_MENU
|
167
|
156
|
|
168
|
157
|
/**
|
|
@@ -178,52 +167,17 @@ int8_t g26_prime_flag;
|
178
|
167
|
|
179
|
168
|
#endif
|
180
|
169
|
|
181
|
|
-mesh_index_pair find_closest_circle_to_print(const xy_pos_t &pos) {
|
182
|
|
- float closest = 99999.99;
|
183
|
|
- mesh_index_pair out_point;
|
184
|
|
-
|
185
|
|
- out_point.pos = -1;
|
186
|
|
-
|
187
|
|
- GRID_LOOP(i, j) {
|
188
|
|
- if (!circle_flags.marked(i, j)) {
|
189
|
|
- // We found a circle that needs to be printed
|
190
|
|
- const xy_pos_t m = { _GET_MESH_X(i), _GET_MESH_Y(j) };
|
191
|
|
-
|
192
|
|
- // Get the distance to this intersection
|
193
|
|
- float f = (pos - m).magnitude();
|
194
|
|
-
|
195
|
|
- // It is possible that we are being called with the values
|
196
|
|
- // to let us find the closest circle to the start position.
|
197
|
|
- // But if this is not the case, add a small weighting to the
|
198
|
|
- // distance calculation to help it choose a better place to continue.
|
199
|
|
- f += (g26_xy_pos - m).magnitude() / 15.0f;
|
200
|
|
-
|
201
|
|
- // Add the specified amount of Random Noise to our search
|
202
|
|
- if (g26_random_deviation > 1.0) f += random(0.0, g26_random_deviation);
|
203
|
|
-
|
204
|
|
- if (f < closest) {
|
205
|
|
- closest = f; // Found a closer un-printed location
|
206
|
|
- out_point.pos.set(i, j); // Save its data
|
207
|
|
- out_point.distance = closest;
|
208
|
|
- }
|
209
|
|
- }
|
210
|
|
- }
|
211
|
|
- circle_flags.mark(out_point); // Mark this location as done.
|
212
|
|
- return out_point;
|
213
|
|
-}
|
214
|
|
-
|
215
|
170
|
void move_to(const_float_t rx, const_float_t ry, const_float_t z, const_float_t e_delta) {
|
216
|
171
|
static float last_z = -999.99;
|
217
|
172
|
|
218
|
173
|
const xy_pos_t dest = { rx, ry };
|
219
|
174
|
|
220
|
|
- const bool has_xy_component = dest != current_position; // Check if X or Y is involved in the movement.
|
221
|
|
- const bool has_e_component = e_delta != 0.0;
|
222
|
|
-
|
223
|
|
- destination = current_position;
|
|
175
|
+ const bool has_xy_component = dest != current_position, // Check if X or Y is involved in the movement.
|
|
176
|
+ has_e_component = e_delta != 0.0;
|
224
|
177
|
|
225
|
178
|
if (z != last_z) {
|
226
|
|
- last_z = destination.z = z;
|
|
179
|
+ last_z = z;
|
|
180
|
+ destination.set(current_position.x, current_position.y, z, current_position.e);
|
227
|
181
|
const feedRate_t fr_mm_s = planner.settings.max_feedrate_mm_s[Z_AXIS] * 0.5f; // Use half of the Z_AXIS max feed rate
|
228
|
182
|
prepare_internal_move_to_destination(fr_mm_s);
|
229
|
183
|
}
|
|
@@ -239,241 +193,293 @@ void move_to(const_float_t rx, const_float_t ry, const_float_t z, const_float_t
|
239
|
193
|
prepare_internal_move_to_destination(fr_mm_s);
|
240
|
194
|
}
|
241
|
195
|
|
242
|
|
-FORCE_INLINE void move_to(const xyz_pos_t &where, const_float_t de) { move_to(where.x, where.y, where.z, de); }
|
|
196
|
+void move_to(const xyz_pos_t &where, const_float_t de) { move_to(where.x, where.y, where.z, de); }
|
243
|
197
|
|
244
|
|
-void retract_filament(const xyz_pos_t &where) {
|
245
|
|
- if (!g26_retracted) { // Only retract if we are not already retracted!
|
246
|
|
- g26_retracted = true;
|
247
|
|
- move_to(where, -1.0f * g26_retraction_multiplier);
|
248
|
|
- }
|
249
|
|
-}
|
|
198
|
+typedef struct {
|
|
199
|
+ float extrusion_multiplier = EXTRUSION_MULTIPLIER,
|
|
200
|
+ retraction_multiplier = G26_RETRACT_MULTIPLIER,
|
|
201
|
+ layer_height = MESH_TEST_LAYER_HEIGHT,
|
|
202
|
+ prime_length = PRIME_LENGTH;
|
250
|
203
|
|
251
|
|
-// TODO: Parameterize the Z lift with a define
|
252
|
|
-void retract_lift_move(const xyz_pos_t &s) {
|
253
|
|
- retract_filament(destination);
|
254
|
|
- move_to(current_position.x, current_position.y, current_position.z + 0.5f, 0.0); // Z lift to minimize scraping
|
255
|
|
- move_to(s.x, s.y, s.z + 0.5f, 0.0); // Get to the starting point with no extrusion while lifted
|
256
|
|
-}
|
|
204
|
+ int16_t bed_temp = MESH_TEST_BED_TEMP,
|
|
205
|
+ hotend_temp = MESH_TEST_HOTEND_TEMP;
|
|
206
|
+
|
|
207
|
+ float nozzle = MESH_TEST_NOZZLE_SIZE,
|
|
208
|
+ filament_diameter = DEFAULT_NOMINAL_FILAMENT_DIA,
|
|
209
|
+ ooze_amount; // 'O' ... OOZE_AMOUNT
|
257
|
210
|
|
258
|
|
-void recover_filament(const xyz_pos_t &where) {
|
259
|
|
- if (g26_retracted) { // Only un-retract if we are retracted.
|
260
|
|
- move_to(where, 1.2f * g26_retraction_multiplier);
|
261
|
|
- g26_retracted = false;
|
|
211
|
+ bool continue_with_closest, // 'C'
|
|
212
|
+ keep_heaters_on; // 'K'
|
|
213
|
+
|
|
214
|
+ xy_pos_t xy_pos; // = { 0, 0 }
|
|
215
|
+
|
|
216
|
+ int8_t prime_flag = 0;
|
|
217
|
+
|
|
218
|
+ bool g26_retracted = false; // Track the retracted state during G26 so mismatched
|
|
219
|
+ // retracts/recovers don't result in a bad state.
|
|
220
|
+
|
|
221
|
+ void retract_filament(const xyz_pos_t &where) {
|
|
222
|
+ if (!g26_retracted) { // Only retract if we are not already retracted!
|
|
223
|
+ g26_retracted = true;
|
|
224
|
+ move_to(where, -1.0f * retraction_multiplier);
|
|
225
|
+ }
|
262
|
226
|
}
|
263
|
|
-}
|
264
|
227
|
|
265
|
|
-/**
|
266
|
|
- * print_line_from_here_to_there() takes two cartesian coordinates and draws a line from one
|
267
|
|
- * to the other. But there are really three sets of coordinates involved. The first coordinate
|
268
|
|
- * is the present location of the nozzle. We don't necessarily want to print from this location.
|
269
|
|
- * We first need to move the nozzle to the start of line segment where we want to print. Once
|
270
|
|
- * there, we can use the two coordinates supplied to draw the line.
|
271
|
|
- *
|
272
|
|
- * Note: Although we assume the first set of coordinates is the start of the line and the second
|
273
|
|
- * set of coordinates is the end of the line, it does not always work out that way. This function
|
274
|
|
- * optimizes the movement to minimize the travel distance before it can start printing. This saves
|
275
|
|
- * a lot of time and eliminates a lot of nonsensical movement of the nozzle. However, it does
|
276
|
|
- * cause a lot of very little short retracement of th nozzle when it draws the very first line
|
277
|
|
- * segment of a 'circle'. The time this requires is very short and is easily saved by the other
|
278
|
|
- * cases where the optimization comes into play.
|
279
|
|
- */
|
280
|
|
-void print_line_from_here_to_there(const xyz_pos_t &s, const xyz_pos_t &e) {
|
|
228
|
+ // TODO: Parameterize the Z lift with a define
|
|
229
|
+ void retract_lift_move(const xyz_pos_t &s) {
|
|
230
|
+ retract_filament(destination);
|
|
231
|
+ move_to(current_position.x, current_position.y, current_position.z + 0.5f, 0.0f); // Z lift to minimize scraping
|
|
232
|
+ move_to(s.x, s.y, s.z + 0.5f, 0.0f); // Get to the starting point with no extrusion while lifted
|
|
233
|
+ }
|
281
|
234
|
|
282
|
|
- // Distances to the start / end of the line
|
283
|
|
- xy_float_t svec = current_position - s, evec = current_position - e;
|
|
235
|
+ void recover_filament(const xyz_pos_t &where) {
|
|
236
|
+ if (g26_retracted) { // Only un-retract if we are retracted.
|
|
237
|
+ move_to(where, 1.2f * retraction_multiplier);
|
|
238
|
+ g26_retracted = false;
|
|
239
|
+ }
|
|
240
|
+ }
|
284
|
241
|
|
285
|
|
- const float dist_start = HYPOT2(svec.x, svec.y),
|
286
|
|
- dist_end = HYPOT2(evec.x, evec.y),
|
287
|
|
- line_length = HYPOT(e.x - s.x, e.y - s.y);
|
|
242
|
+ /**
|
|
243
|
+ * print_line_from_here_to_there() takes two cartesian coordinates and draws a line from one
|
|
244
|
+ * to the other. But there are really three sets of coordinates involved. The first coordinate
|
|
245
|
+ * is the present location of the nozzle. We don't necessarily want to print from this location.
|
|
246
|
+ * We first need to move the nozzle to the start of line segment where we want to print. Once
|
|
247
|
+ * there, we can use the two coordinates supplied to draw the line.
|
|
248
|
+ *
|
|
249
|
+ * Note: Although we assume the first set of coordinates is the start of the line and the second
|
|
250
|
+ * set of coordinates is the end of the line, it does not always work out that way. This function
|
|
251
|
+ * optimizes the movement to minimize the travel distance before it can start printing. This saves
|
|
252
|
+ * a lot of time and eliminates a lot of nonsensical movement of the nozzle. However, it does
|
|
253
|
+ * cause a lot of very little short retracement of th nozzle when it draws the very first line
|
|
254
|
+ * segment of a 'circle'. The time this requires is very short and is easily saved by the other
|
|
255
|
+ * cases where the optimization comes into play.
|
|
256
|
+ */
|
|
257
|
+ void print_line_from_here_to_there(const xyz_pos_t &s, const xyz_pos_t &e) {
|
288
|
258
|
|
289
|
|
- // If the end point of the line is closer to the nozzle, flip the direction,
|
290
|
|
- // moving from the end to the start. On very small lines the optimization isn't worth it.
|
291
|
|
- if (dist_end < dist_start && (INTERSECTION_CIRCLE_RADIUS) < ABS(line_length))
|
292
|
|
- return print_line_from_here_to_there(e, s);
|
|
259
|
+ // Distances to the start / end of the line
|
|
260
|
+ xy_float_t svec = current_position - s, evec = current_position - e;
|
293
|
261
|
|
294
|
|
- // Decide whether to retract & lift
|
295
|
|
- if (dist_start > 2.0) retract_lift_move(s);
|
|
262
|
+ const float dist_start = HYPOT2(svec.x, svec.y),
|
|
263
|
+ dist_end = HYPOT2(evec.x, evec.y),
|
|
264
|
+ line_length = HYPOT(e.x - s.x, e.y - s.y);
|
296
|
265
|
|
297
|
|
- move_to(s, 0.0); // Get to the starting point with no extrusion / un-Z lift
|
|
266
|
+ // If the end point of the line is closer to the nozzle, flip the direction,
|
|
267
|
+ // moving from the end to the start. On very small lines the optimization isn't worth it.
|
|
268
|
+ if (dist_end < dist_start && (INTERSECTION_CIRCLE_RADIUS) < ABS(line_length))
|
|
269
|
+ return print_line_from_here_to_there(e, s);
|
298
|
270
|
|
299
|
|
- const float e_pos_delta = line_length * g26_e_axis_feedrate * g26_extrusion_multiplier;
|
|
271
|
+ // Decide whether to retract & lift
|
|
272
|
+ if (dist_start > 2.0) retract_lift_move(s);
|
300
|
273
|
|
301
|
|
- recover_filament(destination);
|
302
|
|
- move_to(e, e_pos_delta); // Get to the ending point with an appropriate amount of extrusion
|
303
|
|
-}
|
|
274
|
+ move_to(s, 0.0); // Get to the starting point with no extrusion / un-Z lift
|
304
|
275
|
|
305
|
|
-inline bool look_for_lines_to_connect() {
|
306
|
|
- xyz_pos_t s, e;
|
307
|
|
- s.z = e.z = g26_layer_height;
|
|
276
|
+ const float e_pos_delta = line_length * g26_e_axis_feedrate * extrusion_multiplier;
|
308
|
277
|
|
309
|
|
- GRID_LOOP(i, j) {
|
|
278
|
+ recover_filament(destination);
|
|
279
|
+ move_to(e, e_pos_delta); // Get to the ending point with an appropriate amount of extrusion
|
|
280
|
+ }
|
310
|
281
|
|
311
|
|
- if (TERN0(HAS_LCD_MENU, user_canceled())) return true;
|
|
282
|
+ void connect_neighbor_with_line(const xy_int8_t &p1, int8_t dx, int8_t dy) {
|
|
283
|
+ xy_int8_t p2;
|
|
284
|
+ p2.x = p1.x + dx;
|
|
285
|
+ p2.y = p1.y + dy;
|
|
286
|
+
|
|
287
|
+ if (p2.x < 0 || p2.x >= (GRID_MAX_POINTS_X)) return;
|
|
288
|
+ if (p2.y < 0 || p2.y >= (GRID_MAX_POINTS_Y)) return;
|
|
289
|
+
|
|
290
|
+ if(circle_flags.marked(p1.x, p1.y) && circle_flags.marked(p2.x, p2.y)) {
|
|
291
|
+ xyz_pos_t s, e;
|
|
292
|
+ s.x = _GET_MESH_X(p1.x) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dx;
|
|
293
|
+ e.x = _GET_MESH_X(p2.x) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dx;
|
|
294
|
+ s.y = _GET_MESH_Y(p1.y) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dy;
|
|
295
|
+ e.y = _GET_MESH_Y(p2.y) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dy;
|
|
296
|
+ s.z = e.z = layer_height;
|
|
297
|
+
|
|
298
|
+ #if HAS_ENDSTOPS
|
|
299
|
+ LIMIT(s.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
|
300
|
+ LIMIT(e.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
|
301
|
+ LIMIT(s.x, X_MIN_POS + 1, X_MAX_POS - 1);
|
|
302
|
+ LIMIT(e.x, X_MIN_POS + 1, X_MAX_POS - 1);
|
|
303
|
+ #endif
|
|
304
|
+
|
|
305
|
+ if (position_is_reachable(s.x, s.y) && position_is_reachable(e.x, e.y))
|
|
306
|
+ print_line_from_here_to_there(s, e);
|
|
307
|
+ }
|
|
308
|
+ }
|
312
|
309
|
|
313
|
|
- if (i < (GRID_MAX_POINTS_X)) { // Can't connect to anything farther to the right than GRID_MAX_POINTS_X.
|
314
|
|
- // Already a half circle at the edge of the bed.
|
|
310
|
+ /**
|
|
311
|
+ * Turn on the bed and nozzle heat and
|
|
312
|
+ * wait for them to get up to temperature.
|
|
313
|
+ */
|
|
314
|
+ bool turn_on_heaters() {
|
315
|
315
|
|
316
|
|
- if (circle_flags.marked(i, j) && circle_flags.marked(i + 1, j)) { // Test whether a leftward line can be done
|
317
|
|
- if (!horizontal_mesh_line_flags.marked(i, j)) {
|
318
|
|
- // Two circles need a horizontal line to connect them
|
319
|
|
- s.x = _GET_MESH_X( i ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // right edge
|
320
|
|
- e.x = _GET_MESH_X(i + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // left edge
|
|
316
|
+ SERIAL_ECHOLNPGM("Waiting for heatup.");
|
321
|
317
|
|
322
|
|
- #if HAS_ENDSTOPS
|
323
|
|
- LIMIT(s.x, X_MIN_POS + 1, X_MAX_POS - 1);
|
324
|
|
- s.y = e.y = constrain(_GET_MESH_Y(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
|
325
|
|
- LIMIT(e.x, X_MIN_POS + 1, X_MAX_POS - 1);
|
326
|
|
- #else
|
327
|
|
- s.y = e.y = _GET_MESH_Y(j);
|
328
|
|
- #endif
|
|
318
|
+ #if HAS_HEATED_BED
|
329
|
319
|
|
330
|
|
- if (position_is_reachable(s.x, s.y) && position_is_reachable(e.x, e.y))
|
331
|
|
- print_line_from_here_to_there(s, e);
|
|
320
|
+ if (bed_temp > 25) {
|
|
321
|
+ #if HAS_WIRED_LCD
|
|
322
|
+ ui.set_status_P(GET_TEXT(MSG_G26_HEATING_BED), 99);
|
|
323
|
+ ui.quick_feedback();
|
|
324
|
+ TERN_(HAS_LCD_MENU, ui.capture());
|
|
325
|
+ #endif
|
|
326
|
+ thermalManager.setTargetBed(bed_temp);
|
332
|
327
|
|
333
|
|
- horizontal_mesh_line_flags.mark(i, j); // Mark done, even if skipped
|
334
|
|
- }
|
|
328
|
+ // Wait for the temperature to stabilize
|
|
329
|
+ if (!thermalManager.wait_for_bed(true
|
|
330
|
+ #if G26_CLICK_CAN_CANCEL
|
|
331
|
+ , true
|
|
332
|
+ #endif
|
|
333
|
+ )
|
|
334
|
+ ) return G26_ERR;
|
335
|
335
|
}
|
336
|
336
|
|
337
|
|
- if (j < (GRID_MAX_POINTS_Y)) { // Can't connect to anything further back than GRID_MAX_POINTS_Y.
|
338
|
|
- // Already a half circle at the edge of the bed.
|
339
|
|
-
|
340
|
|
- if (circle_flags.marked(i, j) && circle_flags.marked(i, j + 1)) { // Test whether a downward line can be done
|
341
|
|
- if (!vertical_mesh_line_flags.marked(i, j)) {
|
342
|
|
- // Two circles that need a vertical line to connect them
|
343
|
|
- s.y = _GET_MESH_Y( j ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // top edge
|
344
|
|
- e.y = _GET_MESH_Y(j + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // bottom edge
|
345
|
|
-
|
346
|
|
- #if HAS_ENDSTOPS
|
347
|
|
- s.x = e.x = constrain(_GET_MESH_X(i), X_MIN_POS + 1, X_MAX_POS - 1);
|
348
|
|
- LIMIT(s.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
349
|
|
- LIMIT(e.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
350
|
|
- #else
|
351
|
|
- s.x = e.x = _GET_MESH_X(i);
|
352
|
|
- #endif
|
|
337
|
+ #else
|
353
|
338
|
|
354
|
|
- if (position_is_reachable(s.x, s.y) && position_is_reachable(e.x, e.y))
|
355
|
|
- print_line_from_here_to_there(s, e);
|
|
339
|
+ UNUSED(bed_temp);
|
356
|
340
|
|
357
|
|
- vertical_mesh_line_flags.mark(i, j); // Mark done, even if skipped
|
358
|
|
- }
|
359
|
|
- }
|
360
|
|
- }
|
361
|
|
- }
|
|
341
|
+ #endif // HAS_HEATED_BED
|
|
342
|
+
|
|
343
|
+ // Start heating the active nozzle
|
|
344
|
+ #if HAS_WIRED_LCD
|
|
345
|
+ ui.set_status_P(GET_TEXT(MSG_G26_HEATING_NOZZLE), 99);
|
|
346
|
+ ui.quick_feedback();
|
|
347
|
+ #endif
|
|
348
|
+ thermalManager.setTargetHotend(hotend_temp, active_extruder);
|
|
349
|
+
|
|
350
|
+ // Wait for the temperature to stabilize
|
|
351
|
+ if (!thermalManager.wait_for_hotend(active_extruder, true
|
|
352
|
+ #if G26_CLICK_CAN_CANCEL
|
|
353
|
+ , true
|
|
354
|
+ #endif
|
|
355
|
+ )) return G26_ERR;
|
|
356
|
+
|
|
357
|
+ #if HAS_WIRED_LCD
|
|
358
|
+ ui.reset_status();
|
|
359
|
+ ui.quick_feedback();
|
|
360
|
+ #endif
|
|
361
|
+
|
|
362
|
+ return G26_OK;
|
362
|
363
|
}
|
363
|
|
- return false;
|
364
|
|
-}
|
365
|
364
|
|
366
|
|
-/**
|
367
|
|
- * Turn on the bed and nozzle heat and
|
368
|
|
- * wait for them to get up to temperature.
|
369
|
|
- */
|
370
|
|
-inline bool turn_on_heaters() {
|
|
365
|
+ /**
|
|
366
|
+ * Prime the nozzle if needed. Return true on error.
|
|
367
|
+ */
|
|
368
|
+ bool prime_nozzle() {
|
371
|
369
|
|
372
|
|
- SERIAL_ECHOLNPGM("Waiting for heatup.");
|
|
370
|
+ const feedRate_t fr_slow_e = planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0f;
|
|
371
|
+ #if HAS_LCD_MENU && !HAS_TOUCH_BUTTONS // ui.button_pressed issue with touchscreen
|
|
372
|
+ #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
|
373
|
+ float Total_Prime = 0.0;
|
|
374
|
+ #endif
|
373
|
375
|
|
374
|
|
- #if HAS_HEATED_BED
|
|
376
|
+ if (prime_flag == -1) { // The user wants to control how much filament gets purged
|
|
377
|
+ ui.capture();
|
|
378
|
+ ui.set_status_P(GET_TEXT(MSG_G26_MANUAL_PRIME), 99);
|
|
379
|
+ ui.chirp();
|
375
|
380
|
|
376
|
|
- if (g26_bed_temp > 25) {
|
|
381
|
+ destination = current_position;
|
|
382
|
+
|
|
383
|
+ recover_filament(destination); // Make sure G26 doesn't think the filament is retracted().
|
|
384
|
+
|
|
385
|
+ while (!ui.button_pressed()) {
|
|
386
|
+ ui.chirp();
|
|
387
|
+ destination.e += 0.25;
|
|
388
|
+ #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
|
389
|
+ Total_Prime += 0.25;
|
|
390
|
+ if (Total_Prime >= EXTRUDE_MAXLENGTH) {
|
|
391
|
+ ui.release();
|
|
392
|
+ return G26_ERR;
|
|
393
|
+ }
|
|
394
|
+ #endif
|
|
395
|
+ prepare_internal_move_to_destination(fr_slow_e);
|
|
396
|
+ destination = current_position;
|
|
397
|
+ planner.synchronize(); // Without this synchronize, the purge is more consistent,
|
|
398
|
+ // but because the planner has a buffer, we won't be able
|
|
399
|
+ // to stop as quickly. So we put up with the less smooth
|
|
400
|
+ // action to give the user a more responsive 'Stop'.
|
|
401
|
+ }
|
|
402
|
+
|
|
403
|
+ ui.wait_for_release();
|
|
404
|
+
|
|
405
|
+ ui.set_status_P(GET_TEXT(MSG_G26_PRIME_DONE), 99);
|
|
406
|
+ ui.quick_feedback();
|
|
407
|
+ ui.release();
|
|
408
|
+ }
|
|
409
|
+ else
|
|
410
|
+ #endif
|
|
411
|
+ {
|
377
|
412
|
#if HAS_WIRED_LCD
|
378
|
|
- ui.set_status_P(GET_TEXT(MSG_G26_HEATING_BED), 99);
|
|
413
|
+ ui.set_status_P(GET_TEXT(MSG_G26_FIXED_LENGTH), 99);
|
379
|
414
|
ui.quick_feedback();
|
380
|
|
- TERN_(HAS_LCD_MENU, ui.capture());
|
381
|
415
|
#endif
|
382
|
|
- thermalManager.setTargetBed(g26_bed_temp);
|
383
|
|
-
|
384
|
|
- // Wait for the temperature to stabilize
|
385
|
|
- if (!thermalManager.wait_for_bed(true
|
386
|
|
- #if G26_CLICK_CAN_CANCEL
|
387
|
|
- , true
|
388
|
|
- #endif
|
389
|
|
- )
|
390
|
|
- ) return G26_ERR;
|
|
416
|
+ destination = current_position;
|
|
417
|
+ destination.e += prime_length;
|
|
418
|
+ prepare_internal_move_to_destination(fr_slow_e);
|
|
419
|
+ destination.e -= prime_length;
|
|
420
|
+ retract_filament(destination);
|
391
|
421
|
}
|
392
|
422
|
|
393
|
|
- #endif // HAS_HEATED_BED
|
|
423
|
+ return G26_OK;
|
|
424
|
+ }
|
394
|
425
|
|
395
|
|
- // Start heating the active nozzle
|
396
|
|
- #if HAS_WIRED_LCD
|
397
|
|
- ui.set_status_P(GET_TEXT(MSG_G26_HEATING_NOZZLE), 99);
|
398
|
|
- ui.quick_feedback();
|
399
|
|
- #endif
|
400
|
|
- thermalManager.setTargetHotend(g26_hotend_temp, active_extruder);
|
|
426
|
+ /**
|
|
427
|
+ * Find the nearest point at which to print a circle
|
|
428
|
+ */
|
|
429
|
+ mesh_index_pair find_closest_circle_to_print(const xy_pos_t &pos) {
|
401
|
430
|
|
402
|
|
- // Wait for the temperature to stabilize
|
403
|
|
- if (!thermalManager.wait_for_hotend(active_extruder, true
|
404
|
|
- #if G26_CLICK_CAN_CANCEL
|
405
|
|
- , true
|
406
|
|
- #endif
|
407
|
|
- )) return G26_ERR;
|
|
431
|
+ mesh_index_pair out_point;
|
|
432
|
+ out_point.pos = -1;
|
408
|
433
|
|
409
|
|
- #if HAS_WIRED_LCD
|
410
|
|
- ui.reset_status();
|
411
|
|
- ui.quick_feedback();
|
412
|
|
- #endif
|
|
434
|
+ #if ENABLED(UBL_HILBERT_CURVE)
|
413
|
435
|
|
414
|
|
- return G26_OK;
|
415
|
|
-}
|
|
436
|
+ auto test_func = [](uint8_t i, uint8_t j, void *data) -> bool {
|
|
437
|
+ if (!circle_flags.marked(i, j)) {
|
|
438
|
+ mesh_index_pair *out_point = (mesh_index_pair*)data;
|
|
439
|
+ out_point->pos.set(i, j); // Save its data
|
|
440
|
+ return true;
|
|
441
|
+ }
|
|
442
|
+ return false;
|
|
443
|
+ };
|
416
|
444
|
|
417
|
|
-/**
|
418
|
|
- * Prime the nozzle if needed. Return true on error.
|
419
|
|
- */
|
420
|
|
-inline bool prime_nozzle() {
|
|
445
|
+ hilbert_curve::search_from_closest(pos, test_func, &out_point);
|
421
|
446
|
|
422
|
|
- const feedRate_t fr_slow_e = planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0f;
|
423
|
|
- #if HAS_LCD_MENU && !HAS_TOUCH_BUTTONS // ui.button_pressed issue with touchscreen
|
424
|
|
- #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
425
|
|
- float Total_Prime = 0.0;
|
426
|
|
- #endif
|
|
447
|
+ #else
|
427
|
448
|
|
428
|
|
- if (g26_prime_flag == -1) { // The user wants to control how much filament gets purged
|
429
|
|
- ui.capture();
|
430
|
|
- ui.set_status_P(GET_TEXT(MSG_G26_MANUAL_PRIME), 99);
|
431
|
|
- ui.chirp();
|
|
449
|
+ float closest = 99999.99;
|
432
|
450
|
|
433
|
|
- destination = current_position;
|
|
451
|
+ GRID_LOOP(i, j) {
|
|
452
|
+ if (!circle_flags.marked(i, j)) {
|
|
453
|
+ // We found a circle that needs to be printed
|
|
454
|
+ const xy_pos_t m = { _GET_MESH_X(i), _GET_MESH_Y(j) };
|
434
|
455
|
|
435
|
|
- recover_filament(destination); // Make sure G26 doesn't think the filament is retracted().
|
|
456
|
+ // Get the distance to this intersection
|
|
457
|
+ float f = (pos - m).magnitude();
|
436
|
458
|
|
437
|
|
- while (!ui.button_pressed()) {
|
438
|
|
- ui.chirp();
|
439
|
|
- destination.e += 0.25;
|
440
|
|
- #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
441
|
|
- Total_Prime += 0.25;
|
442
|
|
- if (Total_Prime >= EXTRUDE_MAXLENGTH) {
|
443
|
|
- ui.release();
|
444
|
|
- return G26_ERR;
|
|
459
|
+ // It is possible that we are being called with the values
|
|
460
|
+ // to let us find the closest circle to the start position.
|
|
461
|
+ // But if this is not the case, add a small weighting to the
|
|
462
|
+ // distance calculation to help it choose a better place to continue.
|
|
463
|
+ f += (xy_pos - m).magnitude() / 15.0f;
|
|
464
|
+
|
|
465
|
+ // Add the specified amount of Random Noise to our search
|
|
466
|
+ if (g26_random_deviation > 1.0) f += random(0.0, g26_random_deviation);
|
|
467
|
+
|
|
468
|
+ if (f < closest) {
|
|
469
|
+ closest = f; // Found a closer un-printed location
|
|
470
|
+ out_point.pos.set(i, j); // Save its data
|
|
471
|
+ out_point.distance = closest;
|
445
|
472
|
}
|
446
|
|
- #endif
|
447
|
|
- prepare_internal_move_to_destination(fr_slow_e);
|
448
|
|
- destination = current_position;
|
449
|
|
- planner.synchronize(); // Without this synchronize, the purge is more consistent,
|
450
|
|
- // but because the planner has a buffer, we won't be able
|
451
|
|
- // to stop as quickly. So we put up with the less smooth
|
452
|
|
- // action to give the user a more responsive 'Stop'.
|
|
473
|
+ }
|
453
|
474
|
}
|
454
|
475
|
|
455
|
|
- ui.wait_for_release();
|
456
|
|
-
|
457
|
|
- ui.set_status_P(GET_TEXT(MSG_G26_PRIME_DONE), 99);
|
458
|
|
- ui.quick_feedback();
|
459
|
|
- ui.release();
|
460
|
|
- }
|
461
|
|
- else
|
462
|
|
- #endif
|
463
|
|
- {
|
464
|
|
- #if HAS_WIRED_LCD
|
465
|
|
- ui.set_status_P(GET_TEXT(MSG_G26_FIXED_LENGTH), 99);
|
466
|
|
- ui.quick_feedback();
|
467
|
476
|
#endif
|
468
|
|
- destination = current_position;
|
469
|
|
- destination.e += g26_prime_length;
|
470
|
|
- prepare_internal_move_to_destination(fr_slow_e);
|
471
|
|
- destination.e -= g26_prime_length;
|
472
|
|
- retract_filament(destination);
|
|
477
|
+
|
|
478
|
+ circle_flags.mark(out_point); // Mark this location as done.
|
|
479
|
+ return out_point;
|
473
|
480
|
}
|
474
|
481
|
|
475
|
|
- return G26_OK;
|
476
|
|
-}
|
|
482
|
+} g26_helper_t;
|
477
|
483
|
|
478
|
484
|
/**
|
479
|
485
|
* G26: Mesh Validation Pattern generation.
|
|
@@ -510,20 +516,11 @@ void GcodeSuite::G26() {
|
510
|
516
|
// Change the tool first, if specified
|
511
|
517
|
if (parser.seenval('T')) tool_change(parser.value_int());
|
512
|
518
|
|
513
|
|
- g26_extrusion_multiplier = EXTRUSION_MULTIPLIER;
|
514
|
|
- g26_retraction_multiplier = G26_RETRACT_MULTIPLIER;
|
515
|
|
- g26_layer_height = MESH_TEST_LAYER_HEIGHT;
|
516
|
|
- g26_prime_length = PRIME_LENGTH;
|
517
|
|
- g26_bed_temp = MESH_TEST_BED_TEMP;
|
518
|
|
- g26_hotend_temp = MESH_TEST_HOTEND_TEMP;
|
519
|
|
- g26_prime_flag = 0;
|
520
|
|
-
|
521
|
|
- float g26_nozzle = MESH_TEST_NOZZLE_SIZE,
|
522
|
|
- g26_filament_diameter = DEFAULT_NOMINAL_FILAMENT_DIA,
|
523
|
|
- g26_ooze_amount = parser.linearval('O', OOZE_AMOUNT);
|
|
519
|
+ g26_helper_t g26;
|
524
|
520
|
|
525
|
|
- bool g26_continue_with_closest = parser.boolval('C'),
|
526
|
|
- g26_keep_heaters_on = parser.boolval('K');
|
|
521
|
+ g26.ooze_amount = parser.linearval('O', OOZE_AMOUNT);
|
|
522
|
+ g26.continue_with_closest = parser.boolval('C');
|
|
523
|
+ g26.keep_heaters_on = parser.boolval('K');
|
527
|
524
|
|
528
|
525
|
// Accept 'I' if temperature presets are defined
|
529
|
526
|
#if PREHEAT_COUNT
|
|
@@ -548,14 +545,14 @@ void GcodeSuite::G26() {
|
548
|
545
|
SERIAL_ECHOLNPAIR("?Specified bed temperature not plausible (40-", BED_MAX_TARGET, "C).");
|
549
|
546
|
return;
|
550
|
547
|
}
|
551
|
|
- g26_bed_temp = bedtemp;
|
|
548
|
+ g26.bed_temp = bedtemp;
|
552
|
549
|
}
|
553
|
550
|
|
554
|
551
|
#endif // HAS_HEATED_BED
|
555
|
552
|
|
556
|
553
|
if (parser.seenval('L')) {
|
557
|
|
- g26_layer_height = parser.value_linear_units();
|
558
|
|
- if (!WITHIN(g26_layer_height, 0.0, 2.0)) {
|
|
554
|
+ g26.layer_height = parser.value_linear_units();
|
|
555
|
+ if (!WITHIN(g26.layer_height, 0.0, 2.0)) {
|
559
|
556
|
SERIAL_ECHOLNPGM("?Specified layer height not plausible.");
|
560
|
557
|
return;
|
561
|
558
|
}
|
|
@@ -563,8 +560,8 @@ void GcodeSuite::G26() {
|
563
|
560
|
|
564
|
561
|
if (parser.seen('Q')) {
|
565
|
562
|
if (parser.has_value()) {
|
566
|
|
- g26_retraction_multiplier = parser.value_float();
|
567
|
|
- if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) {
|
|
563
|
+ g26.retraction_multiplier = parser.value_float();
|
|
564
|
+ if (!WITHIN(g26.retraction_multiplier, 0.05, 15.0)) {
|
568
|
565
|
SERIAL_ECHOLNPGM("?Specified Retraction Multiplier not plausible.");
|
569
|
566
|
return;
|
570
|
567
|
}
|
|
@@ -576,8 +573,8 @@ void GcodeSuite::G26() {
|
576
|
573
|
}
|
577
|
574
|
|
578
|
575
|
if (parser.seenval('S')) {
|
579
|
|
- g26_nozzle = parser.value_float();
|
580
|
|
- if (!WITHIN(g26_nozzle, 0.1, 2.0)) {
|
|
576
|
+ g26.nozzle = parser.value_float();
|
|
577
|
+ if (!WITHIN(g26.nozzle, 0.1, 2.0)) {
|
581
|
578
|
SERIAL_ECHOLNPGM("?Specified nozzle size not plausible.");
|
582
|
579
|
return;
|
583
|
580
|
}
|
|
@@ -586,16 +583,16 @@ void GcodeSuite::G26() {
|
586
|
583
|
if (parser.seen('P')) {
|
587
|
584
|
if (!parser.has_value()) {
|
588
|
585
|
#if HAS_LCD_MENU
|
589
|
|
- g26_prime_flag = -1;
|
|
586
|
+ g26.prime_flag = -1;
|
590
|
587
|
#else
|
591
|
588
|
SERIAL_ECHOLNPGM("?Prime length must be specified when not using an LCD.");
|
592
|
589
|
return;
|
593
|
590
|
#endif
|
594
|
591
|
}
|
595
|
592
|
else {
|
596
|
|
- g26_prime_flag++;
|
597
|
|
- g26_prime_length = parser.value_linear_units();
|
598
|
|
- if (!WITHIN(g26_prime_length, 0.0, 25.0)) {
|
|
593
|
+ g26.prime_flag++;
|
|
594
|
+ g26.prime_length = parser.value_linear_units();
|
|
595
|
+ if (!WITHIN(g26.prime_length, 0.0, 25.0)) {
|
599
|
596
|
SERIAL_ECHOLNPGM("?Specified prime length not plausible.");
|
600
|
597
|
return;
|
601
|
598
|
}
|
|
@@ -603,17 +600,17 @@ void GcodeSuite::G26() {
|
603
|
600
|
}
|
604
|
601
|
|
605
|
602
|
if (parser.seenval('F')) {
|
606
|
|
- g26_filament_diameter = parser.value_linear_units();
|
607
|
|
- if (!WITHIN(g26_filament_diameter, 1.0, 4.0)) {
|
|
603
|
+ g26.filament_diameter = parser.value_linear_units();
|
|
604
|
+ if (!WITHIN(g26.filament_diameter, 1.0, 4.0)) {
|
608
|
605
|
SERIAL_ECHOLNPGM("?Specified filament size not plausible.");
|
609
|
606
|
return;
|
610
|
607
|
}
|
611
|
608
|
}
|
612
|
|
- g26_extrusion_multiplier *= sq(1.75) / sq(g26_filament_diameter); // If we aren't using 1.75mm filament, we need to
|
|
609
|
+ g26.extrusion_multiplier *= sq(1.75) / sq(g26.filament_diameter); // If we aren't using 1.75mm filament, we need to
|
613
|
610
|
// scale up or down the length needed to get the
|
614
|
611
|
// same volume of filament
|
615
|
612
|
|
616
|
|
- g26_extrusion_multiplier *= g26_filament_diameter * sq(g26_nozzle) / sq(0.3); // Scale up by nozzle size
|
|
613
|
+ g26.extrusion_multiplier *= g26.filament_diameter * sq(g26.nozzle) / sq(0.3); // Scale up by nozzle size
|
617
|
614
|
|
618
|
615
|
// Get a temperature from 'I' or 'H'
|
619
|
616
|
celsius_t noztemp = 0;
|
|
@@ -632,7 +629,7 @@ void GcodeSuite::G26() {
|
632
|
629
|
SERIAL_ECHOLNPGM("?Specified nozzle temperature not plausible.");
|
633
|
630
|
return;
|
634
|
631
|
}
|
635
|
|
- g26_hotend_temp = noztemp;
|
|
632
|
+ g26.hotend_temp = noztemp;
|
636
|
633
|
}
|
637
|
634
|
|
638
|
635
|
// 'U' to Randomize and optionally set circle deviation
|
|
@@ -660,9 +657,9 @@ void GcodeSuite::G26() {
|
660
|
657
|
}
|
661
|
658
|
|
662
|
659
|
// Set a position with 'X' and/or 'Y'. Default: current_position
|
663
|
|
- g26_xy_pos.set(parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position.x,
|
|
660
|
+ g26.xy_pos.set(parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position.x,
|
664
|
661
|
parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position.y);
|
665
|
|
- if (!position_is_reachable(g26_xy_pos)) {
|
|
662
|
+ if (!position_is_reachable(g26.xy_pos)) {
|
666
|
663
|
SERIAL_ECHOLNPGM("?Specified X,Y coordinate out of bounds.");
|
667
|
664
|
return;
|
668
|
665
|
}
|
|
@@ -680,12 +677,12 @@ void GcodeSuite::G26() {
|
680
|
677
|
planner.calculate_volumetric_multipliers();
|
681
|
678
|
#endif
|
682
|
679
|
|
683
|
|
- if (turn_on_heaters() != G26_OK) goto LEAVE;
|
|
680
|
+ if (g26.turn_on_heaters() != G26_OK) goto LEAVE;
|
684
|
681
|
|
685
|
682
|
current_position.e = 0.0;
|
686
|
683
|
sync_plan_position_e();
|
687
|
684
|
|
688
|
|
- if (g26_prime_flag && prime_nozzle() != G26_OK) goto LEAVE;
|
|
685
|
+ if (g26.prime_flag && g26.prime_nozzle() != G26_OK) goto LEAVE;
|
689
|
686
|
|
690
|
687
|
/**
|
691
|
688
|
* Bed is preheated
|
|
@@ -698,14 +695,12 @@ void GcodeSuite::G26() {
|
698
|
695
|
*/
|
699
|
696
|
|
700
|
697
|
circle_flags.reset();
|
701
|
|
- horizontal_mesh_line_flags.reset();
|
702
|
|
- vertical_mesh_line_flags.reset();
|
703
|
698
|
|
704
|
699
|
// Move nozzle to the specified height for the first layer
|
705
|
700
|
destination = current_position;
|
706
|
|
- destination.z = g26_layer_height;
|
|
701
|
+ destination.z = g26.layer_height;
|
707
|
702
|
move_to(destination, 0.0);
|
708
|
|
- move_to(destination, g26_ooze_amount);
|
|
703
|
+ move_to(destination, g26.ooze_amount);
|
709
|
704
|
|
710
|
705
|
TERN_(HAS_LCD_MENU, ui.capture());
|
711
|
706
|
|
|
@@ -732,7 +727,7 @@ void GcodeSuite::G26() {
|
732
|
727
|
mesh_index_pair location;
|
733
|
728
|
do {
|
734
|
729
|
// Find the nearest confluence
|
735
|
|
- location = find_closest_circle_to_print(g26_continue_with_closest ? xy_pos_t(current_position) : g26_xy_pos);
|
|
730
|
+ location = g26.find_closest_circle_to_print(g26.continue_with_closest ? xy_pos_t(current_position) : g26.xy_pos);
|
736
|
731
|
|
737
|
732
|
if (location.valid()) {
|
738
|
733
|
const xy_pos_t circle = _GET_MESH_POS(location.pos);
|
|
@@ -762,7 +757,7 @@ void GcodeSuite::G26() {
|
762
|
757
|
if (!b) { e.x = circle.x; e.y += INTERSECTION_CIRCLE_RADIUS; }
|
763
|
758
|
arc_length = (f || b) ? ARC_LENGTH(1) : ARC_LENGTH(2);
|
764
|
759
|
}
|
765
|
|
- else if (r) { // right edge
|
|
760
|
+ else if (r) { // right edge
|
766
|
761
|
if (b) s.set(circle.x - (INTERSECTION_CIRCLE_RADIUS), circle.y);
|
767
|
762
|
else s.set(circle.x, circle.y + INTERSECTION_CIRCLE_RADIUS);
|
768
|
763
|
if (f) e.set(circle.x - (INTERSECTION_CIRCLE_RADIUS), circle.y);
|
|
@@ -782,25 +777,24 @@ void GcodeSuite::G26() {
|
782
|
777
|
const xy_float_t dist = current_position - s; // Distance from the start of the actual circle
|
783
|
778
|
const float dist_start = HYPOT2(dist.x, dist.y);
|
784
|
779
|
const xyze_pos_t endpoint = {
|
785
|
|
- e.x, e.y, g26_layer_height,
|
786
|
|
- current_position.e + (arc_length * g26_e_axis_feedrate * g26_extrusion_multiplier)
|
|
780
|
+ e.x, e.y, g26.layer_height,
|
|
781
|
+ current_position.e + (arc_length * g26_e_axis_feedrate * g26.extrusion_multiplier)
|
787
|
782
|
};
|
788
|
783
|
|
789
|
784
|
if (dist_start > 2.0) {
|
790
|
|
- s.z = g26_layer_height + 0.5f;
|
791
|
|
- retract_lift_move(s);
|
|
785
|
+ s.z = g26.layer_height + 0.5f;
|
|
786
|
+ g26.retract_lift_move(s);
|
792
|
787
|
}
|
793
|
788
|
|
794
|
|
- s.z = g26_layer_height;
|
|
789
|
+ s.z = g26.layer_height;
|
795
|
790
|
move_to(s, 0.0); // Get to the starting point with no extrusion / un-Z lift
|
796
|
791
|
|
797
|
|
- recover_filament(destination);
|
|
792
|
+ g26.recover_filament(destination);
|
798
|
793
|
|
799
|
|
- const feedRate_t old_feedrate = feedrate_mm_s;
|
800
|
|
- feedrate_mm_s = PLANNER_XY_FEEDRATE() * 0.1f;
|
801
|
|
- plan_arc(endpoint, arc_offset, false, 0); // Draw a counter-clockwise arc
|
802
|
|
- feedrate_mm_s = old_feedrate;
|
803
|
|
- destination = current_position;
|
|
794
|
+ { REMEMBER(fr, feedrate_mm_s, PLANNER_XY_FEEDRATE() * 0.1f);
|
|
795
|
+ plan_arc(endpoint, arc_offset, false, 0); // Draw a counter-clockwise arc
|
|
796
|
+ destination = current_position;
|
|
797
|
+ }
|
804
|
798
|
|
805
|
799
|
if (TERN0(HAS_LCD_MENU, user_canceled())) goto LEAVE; // Check if the user wants to stop the Mesh Validation
|
806
|
800
|
|
|
@@ -828,8 +822,8 @@ void GcodeSuite::G26() {
|
828
|
822
|
|
829
|
823
|
if (TERN0(HAS_LCD_MENU, user_canceled())) goto LEAVE; // Check if the user wants to stop the Mesh Validation
|
830
|
824
|
|
831
|
|
- xyz_float_t p = { circle.x + _COS(ind ), circle.y + _SIN(ind ), g26_layer_height },
|
832
|
|
- q = { circle.x + _COS(ind + 1), circle.y + _SIN(ind + 1), g26_layer_height };
|
|
825
|
+ xyz_float_t p = { circle.x + _COS(ind ), circle.y + _SIN(ind ), g26.layer_height },
|
|
826
|
+ q = { circle.x + _COS(ind + 1), circle.y + _SIN(ind + 1), g26.layer_height };
|
833
|
827
|
|
834
|
828
|
#if IS_KINEMATIC
|
835
|
829
|
// Check to make sure this segment is entirely on the bed, skip if not.
|
|
@@ -841,13 +835,17 @@ void GcodeSuite::G26() {
|
841
|
835
|
LIMIT(q.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
842
|
836
|
#endif
|
843
|
837
|
|
844
|
|
- print_line_from_here_to_there(p, q);
|
|
838
|
+ g26.print_line_from_here_to_there(p, q);
|
845
|
839
|
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
846
|
840
|
}
|
847
|
841
|
|
848
|
842
|
#endif // !ARC_SUPPORT
|
849
|
843
|
|
850
|
|
- if (look_for_lines_to_connect()) goto LEAVE;
|
|
844
|
+ g26.connect_neighbor_with_line(location.pos, -1, 0);
|
|
845
|
+ g26.connect_neighbor_with_line(location.pos, 1, 0);
|
|
846
|
+ g26.connect_neighbor_with_line(location.pos, 0, -1);
|
|
847
|
+ g26.connect_neighbor_with_line(location.pos, 0, 1);
|
|
848
|
+ if (TERN0(HAS_LCD_MENU, user_canceled())) goto LEAVE;
|
851
|
849
|
}
|
852
|
850
|
|
853
|
851
|
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
|
@@ -857,12 +855,9 @@ void GcodeSuite::G26() {
|
857
|
855
|
LEAVE:
|
858
|
856
|
ui.set_status_P(GET_TEXT(MSG_G26_LEAVING), -1);
|
859
|
857
|
|
860
|
|
- retract_filament(destination);
|
|
858
|
+ g26.retract_filament(destination);
|
861
|
859
|
destination.z = Z_CLEARANCE_BETWEEN_PROBES;
|
862
|
|
- move_to(destination, 0); // Raise the nozzle
|
863
|
|
-
|
864
|
|
- destination = g26_xy_pos; // Move back to the starting XY position
|
865
|
|
- move_to(destination, 0); // Move back to the starting position
|
|
860
|
+ move_to(destination, 0); // Raise the nozzle
|
866
|
861
|
|
867
|
862
|
#if DISABLED(NO_VOLUMETRICS)
|
868
|
863
|
parser.volumetric_enabled = volumetric_was_enabled;
|
|
@@ -871,7 +866,7 @@ void GcodeSuite::G26() {
|
871
|
866
|
|
872
|
867
|
TERN_(HAS_LCD_MENU, ui.release()); // Give back control of the LCD
|
873
|
868
|
|
874
|
|
- if (!g26_keep_heaters_on) {
|
|
869
|
+ if (!g26.keep_heaters_on) {
|
875
|
870
|
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(0));
|
876
|
871
|
thermalManager.setTargetHotend(active_extruder, 0);
|
877
|
872
|
}
|