|
@@ -178,15 +178,13 @@
|
178
|
178
|
* nozzle in a problem area and doing a G29 P4 R command.
|
179
|
179
|
*/
|
180
|
180
|
void gcode_G26() {
|
181
|
|
- float circle_x, circle_y, x, y, xe, ye, tmp,
|
182
|
|
- start_angle, end_angle;
|
183
|
|
- int i, xi, yi, lcd_init_counter = 0;
|
|
181
|
+ float tmp, start_angle, end_angle;
|
|
182
|
+ int i, xi, yi;
|
184
|
183
|
mesh_index_pair location;
|
185
|
184
|
|
186
|
|
- if (axis_unhomed_error(true, true, true)) // Don't allow Mesh Validation without homing first
|
187
|
|
- gcode_G28();
|
188
|
|
-
|
189
|
|
- if (parse_G26_parameters()) return; // If the paramter parsing did not go OK, we abort the command
|
|
185
|
+ // Don't allow Mesh Validation without homing first
|
|
186
|
+ // If the paramter parsing did not go OK, we abort the command
|
|
187
|
+ if (axis_unhomed_error(true, true, true) || parse_G26_parameters()) return;
|
190
|
188
|
|
191
|
189
|
if (current_position[Z_AXIS] < Z_CLEARANCE_BETWEEN_PROBES) {
|
192
|
190
|
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
|
@@ -194,15 +192,12 @@
|
194
|
192
|
set_current_to_destination();
|
195
|
193
|
}
|
196
|
194
|
|
197
|
|
- ubl.has_control_of_lcd_panel = true; // Take control of the LCD Panel!
|
198
|
|
- if (turn_on_heaters()) // Turn on the heaters, leave the command if anything
|
199
|
|
- goto LEAVE; // has gone wrong.
|
|
195
|
+ if (turn_on_heaters()) goto LEAVE;
|
200
|
196
|
|
201
|
197
|
current_position[E_AXIS] = 0.0;
|
202
|
198
|
sync_plan_position_e();
|
203
|
199
|
|
204
|
|
- if (prime_flag && prime_nozzle()) // if prime_nozzle() returns an error, we just bail out.
|
205
|
|
- goto LEAVE;
|
|
200
|
+ if (prime_flag && prime_nozzle()) goto LEAVE;
|
206
|
201
|
|
207
|
202
|
/**
|
208
|
203
|
* Bed is preheated
|
|
@@ -214,20 +209,17 @@
|
214
|
209
|
* It's "Show Time" !!!
|
215
|
210
|
*/
|
216
|
211
|
|
217
|
|
- // Clear all of the flags we need
|
218
|
212
|
ZERO(circle_flags);
|
219
|
213
|
ZERO(horizontal_mesh_line_flags);
|
220
|
214
|
ZERO(vertical_mesh_line_flags);
|
221
|
215
|
|
222
|
|
- //
|
223
|
216
|
// Move nozzle to the specified height for the first layer
|
224
|
|
- //
|
225
|
217
|
set_destination_to_current();
|
226
|
218
|
destination[Z_AXIS] = layer_height;
|
227
|
219
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0.0);
|
228
|
220
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], ooze_amount);
|
229
|
221
|
|
230
|
|
- ubl.has_control_of_lcd_panel = true; // Take control of the LCD Panel!
|
|
222
|
+ ubl.has_control_of_lcd_panel++;
|
231
|
223
|
//debug_current_and_destination((char*)"Starting G26 Mesh Validation Pattern.");
|
232
|
224
|
|
233
|
225
|
/**
|
|
@@ -259,14 +251,13 @@
|
259
|
251
|
goto LEAVE;
|
260
|
252
|
}
|
261
|
253
|
|
262
|
|
- if (continue_with_closest)
|
263
|
|
- location = find_closest_circle_to_print(current_position[X_AXIS], current_position[Y_AXIS]);
|
264
|
|
- else
|
265
|
|
- location = find_closest_circle_to_print(x_pos, y_pos); // Find the closest Mesh Intersection to where we are now.
|
|
254
|
+ location = continue_with_closest
|
|
255
|
+ ? find_closest_circle_to_print(current_position[X_AXIS], current_position[Y_AXIS])
|
|
256
|
+ : find_closest_circle_to_print(x_pos, y_pos); // Find the closest Mesh Intersection to where we are now.
|
266
|
257
|
|
267
|
258
|
if (location.x_index >= 0 && location.y_index >= 0) {
|
268
|
|
- circle_x = ubl.mesh_index_to_xpos[location.x_index];
|
269
|
|
- circle_y = ubl.mesh_index_to_ypos[location.y_index];
|
|
259
|
+ const float circle_x = ubl.mesh_index_to_xpos[location.x_index],
|
|
260
|
+ circle_y = ubl.mesh_index_to_ypos[location.y_index];
|
270
|
261
|
|
271
|
262
|
// Let's do a couple of quick sanity checks. We can pull this code out later if we never see it catch a problem
|
272
|
263
|
#ifdef DELTA
|
|
@@ -324,18 +315,17 @@
|
324
|
315
|
for (tmp = start_angle; tmp < end_angle - 0.1; tmp += 30.0) {
|
325
|
316
|
int tmp_div_30 = tmp / 30.0;
|
326
|
317
|
if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
|
327
|
|
-
|
328
|
|
- x = circle_x + cos_table[tmp_div_30]; // for speed, these are now a lookup table entry
|
329
|
|
- y = circle_y + sin_table[tmp_div_30];
|
330
|
|
-
|
331
|
318
|
if (tmp_div_30 > 11) tmp_div_30 -= 360 / 30;
|
332
|
|
- xe = circle_x + cos_table[tmp_div_30 + 1]; // for speed, these are now a lookup table entry
|
333
|
|
- ye = circle_y + sin_table[tmp_div_30 + 1];
|
|
319
|
+
|
|
320
|
+ float x = circle_x + cos_table[tmp_div_30], // for speed, these are now a lookup table entry
|
|
321
|
+ y = circle_y + sin_table[tmp_div_30],
|
|
322
|
+ xe = circle_x + cos_table[tmp_div_30 + 1],
|
|
323
|
+ ye = circle_y + sin_table[tmp_div_30 + 1];
|
334
|
324
|
#ifdef DELTA
|
335
|
325
|
if (HYPOT2(x, y) > sq(DELTA_PRINTABLE_RADIUS)) // Check to make sure this part of
|
336
|
326
|
continue; // the 'circle' is on the bed. If
|
337
|
327
|
#else // not, we need to skip
|
338
|
|
- x = constrain(x, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
|
|
328
|
+ x = constrain(x, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
|
339
|
329
|
y = constrain(y, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
340
|
330
|
xe = constrain(xe, X_MIN_POS + 1, X_MAX_POS - 1);
|
341
|
331
|
ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
|
@@ -352,15 +342,9 @@
|
352
|
342
|
// debug_current_and_destination(seg_msg);
|
353
|
343
|
//}
|
354
|
344
|
|
355
|
|
- print_line_from_here_to_there(x, y, layer_height, xe, ye, layer_height);
|
|
345
|
+ print_line_from_here_to_there(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y), layer_height, LOGICAL_X_POSITION(xe), LOGICAL_Y_POSITION(ye), layer_height);
|
356
|
346
|
|
357
|
347
|
}
|
358
|
|
- //lcd_init_counter++;
|
359
|
|
- //if (lcd_init_counter > 10) {
|
360
|
|
- // lcd_init_counter = 0;
|
361
|
|
- // lcd_init(); // Some people's LCD Displays are locking up. This might help them
|
362
|
|
- // ubl.has_control_of_lcd_panel = true; // Make sure UBL still is controlling the LCD Panel
|
363
|
|
- //}
|
364
|
348
|
|
365
|
349
|
//debug_current_and_destination((char*)"Looking for lines to connect.");
|
366
|
350
|
look_for_lines_to_connect();
|
|
@@ -368,8 +352,8 @@
|
368
|
352
|
}
|
369
|
353
|
|
370
|
354
|
//debug_current_and_destination((char*)"Done with current circle.");
|
371
|
|
- }
|
372
|
|
- while (location.x_index >= 0 && location.y_index >= 0);
|
|
355
|
+
|
|
356
|
+ } while (location.x_index >= 0 && location.y_index >= 0);
|
373
|
357
|
|
374
|
358
|
LEAVE:
|
375
|
359
|
lcd_reset_alert_level();
|
|
@@ -805,7 +789,7 @@
|
805
|
789
|
lcd_setstatuspgm(PSTR("G26 Heating Bed."), 99);
|
806
|
790
|
lcd_quick_feedback();
|
807
|
791
|
#endif
|
808
|
|
- ubl.has_control_of_lcd_panel = true;
|
|
792
|
+ ubl.has_control_of_lcd_panel++;
|
809
|
793
|
thermalManager.setTargetBed(bed_temp);
|
810
|
794
|
while (abs(thermalManager.degBed() - bed_temp) > 3) {
|
811
|
795
|
if (ubl_lcd_clicked()) return exit_from_g26();
|
|
@@ -840,6 +824,9 @@
|
840
|
824
|
float Total_Prime = 0.0;
|
841
|
825
|
|
842
|
826
|
if (prime_flag == -1) { // The user wants to control how much filament gets purged
|
|
827
|
+
|
|
828
|
+ ubl.has_control_of_lcd_panel++;
|
|
829
|
+
|
843
|
830
|
lcd_setstatuspgm(PSTR("User-Controlled Prime"), 99);
|
844
|
831
|
chirp_at_user();
|
845
|
832
|
|
|
@@ -876,6 +863,9 @@
|
876
|
863
|
lcd_setstatuspgm(PSTR("Done Priming"), 99);
|
877
|
864
|
lcd_quick_feedback();
|
878
|
865
|
#endif
|
|
866
|
+
|
|
867
|
+ ubl.has_control_of_lcd_panel = false;
|
|
868
|
+
|
879
|
869
|
}
|
880
|
870
|
else {
|
881
|
871
|
#if ENABLED(ULTRA_LCD)
|