|
|
@ -32,7 +32,7 @@
|
|
|
|
#define PRIME_LENGTH 10.0 // So, we put these number in an easy to find and change place.
|
|
|
|
#define PRIME_LENGTH 10.0 // So, we put these number in an easy to find and change place.
|
|
|
|
#define BED_TEMP 60.0
|
|
|
|
#define BED_TEMP 60.0
|
|
|
|
#define HOTEND_TEMP 205.0
|
|
|
|
#define HOTEND_TEMP 205.0
|
|
|
|
#define OOOOZE_AMOUNT 0.3
|
|
|
|
#define OOZE_AMOUNT 0.3
|
|
|
|
|
|
|
|
|
|
|
|
#include "Marlin.h"
|
|
|
|
#include "Marlin.h"
|
|
|
|
#include "Configuration.h"
|
|
|
|
#include "Configuration.h"
|
|
|
@ -111,7 +111,7 @@
|
|
|
|
* Y # Y coordinate Specify the starting location of the drawing activity.
|
|
|
|
* Y # Y coordinate Specify the starting location of the drawing activity.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
extern int UBL_has_control_of_LCD_Panel;
|
|
|
|
extern bool ubl_has_control_of_lcd_panel;
|
|
|
|
extern float feedrate;
|
|
|
|
extern float feedrate;
|
|
|
|
//extern bool relative_mode;
|
|
|
|
//extern bool relative_mode;
|
|
|
|
extern Planner planner;
|
|
|
|
extern Planner planner;
|
|
|
@ -141,12 +141,12 @@
|
|
|
|
bool prime_nozzle();
|
|
|
|
bool prime_nozzle();
|
|
|
|
void chirp_at_user();
|
|
|
|
void chirp_at_user();
|
|
|
|
|
|
|
|
|
|
|
|
static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16], Continue_with_closest = 0;
|
|
|
|
static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16], continue_with_closest = 0;
|
|
|
|
float G26_E_AXIS_feedrate = 0.020,
|
|
|
|
float g26_e_axis_feedrate = 0.020,
|
|
|
|
Random_Deviation = 0.0,
|
|
|
|
random_deviation = 0.0,
|
|
|
|
Layer_Height = LAYER_HEIGHT;
|
|
|
|
layer_height = LAYER_HEIGHT;
|
|
|
|
|
|
|
|
|
|
|
|
bool G26_retracted = false; // We keep track of the state of the nozzle to know if it
|
|
|
|
bool g26_retracted = false; // We keep track of the state of the nozzle to know if it
|
|
|
|
// is currently retracted or not. This allows us to be
|
|
|
|
// is currently retracted or not. This allows us to be
|
|
|
|
// less careful because mis-matched retractions and un-retractions
|
|
|
|
// less careful because mis-matched retractions and un-retractions
|
|
|
|
// won't leave us in a bad state.
|
|
|
|
// won't leave us in a bad state.
|
|
|
@ -157,24 +157,24 @@
|
|
|
|
float valid_trig_angle(float);
|
|
|
|
float valid_trig_angle(float);
|
|
|
|
mesh_index_pair find_closest_circle_to_print(float, float);
|
|
|
|
mesh_index_pair find_closest_circle_to_print(float, float);
|
|
|
|
void debug_current_and_destination(char *title);
|
|
|
|
void debug_current_and_destination(char *title);
|
|
|
|
void UBL_line_to_destination(const float&, const float&, const float&, const float&, const float&, uint8_t);
|
|
|
|
void ubl_line_to_destination(const float&, const float&, const float&, const float&, const float&, uint8_t);
|
|
|
|
//uint16_t x_splits = 0xFFFF, uint16_t y_splits = 0xFFFF); /* needed for the old mesh_buffer_line() routine */
|
|
|
|
//uint16_t x_splits = 0xFFFF, uint16_t y_splits = 0xFFFF); /* needed for the old mesh_buffer_line() routine */
|
|
|
|
|
|
|
|
|
|
|
|
static float E_Pos_Delta,
|
|
|
|
static float extrusion_multiplier = EXTRUSION_MULTIPLIER,
|
|
|
|
Extrusion_Multiplier = EXTRUSION_MULTIPLIER,
|
|
|
|
retraction_multiplier = RETRACTION_MULTIPLIER,
|
|
|
|
Retraction_Multiplier = RETRACTION_MULTIPLIER,
|
|
|
|
nozzle = NOZZLE,
|
|
|
|
Nozzle = NOZZLE,
|
|
|
|
filament_diameter = FILAMENT,
|
|
|
|
Filament = FILAMENT,
|
|
|
|
prime_length = PRIME_LENGTH,
|
|
|
|
Prime_Length = PRIME_LENGTH,
|
|
|
|
x_pos, y_pos,
|
|
|
|
X_Pos, Y_Pos,
|
|
|
|
|
|
|
|
bed_temp = BED_TEMP,
|
|
|
|
bed_temp = BED_TEMP,
|
|
|
|
hotend_temp = HOTEND_TEMP,
|
|
|
|
hotend_temp = HOTEND_TEMP,
|
|
|
|
Ooooze_Amount = OOOOZE_AMOUNT;
|
|
|
|
ooze_amount = OOZE_AMOUNT;
|
|
|
|
|
|
|
|
|
|
|
|
int8_t Prime_Flag = 0;
|
|
|
|
int8_t prime_flag = 0;
|
|
|
|
|
|
|
|
|
|
|
|
bool Keep_Heaters_On = false,
|
|
|
|
bool keep_heaters_on = false;
|
|
|
|
G26_Debug_flag = false;
|
|
|
|
|
|
|
|
|
|
|
|
bool g26_debug_flag = false;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* These support functions allow the use of large bit arrays of flags that take very
|
|
|
|
* These support functions allow the use of large bit arrays of flags that take very
|
|
|
@ -217,7 +217,7 @@
|
|
|
|
current_position[E_AXIS] = 0.0;
|
|
|
|
current_position[E_AXIS] = 0.0;
|
|
|
|
sync_plan_position_e();
|
|
|
|
sync_plan_position_e();
|
|
|
|
|
|
|
|
|
|
|
|
if (Prime_Flag && prime_nozzle()) // if prime_nozzle() returns an error, we just bail out.
|
|
|
|
if (prime_flag && prime_nozzle()) // if prime_nozzle() returns an error, we just bail out.
|
|
|
|
goto LEAVE;
|
|
|
|
goto LEAVE;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -239,17 +239,19 @@
|
|
|
|
// Move nozzle to the specified height for the first layer
|
|
|
|
// Move nozzle to the specified height for the first layer
|
|
|
|
//
|
|
|
|
//
|
|
|
|
set_destination_to_current();
|
|
|
|
set_destination_to_current();
|
|
|
|
destination[Z_AXIS] = Layer_Height;
|
|
|
|
destination[Z_AXIS] = layer_height;
|
|
|
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0.0);
|
|
|
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0.0);
|
|
|
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], Ooooze_Amount);
|
|
|
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], ooze_amount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ubl_has_control_of_lcd_panel++; // Take control of the LCD Panel!
|
|
|
|
|
|
|
|
debug_current_and_destination((char*)"Starting G26 Mesh Validation Pattern.");
|
|
|
|
|
|
|
|
|
|
|
|
UBL_has_control_of_LCD_Panel = 1; // Take control of the LCD Panel!
|
|
|
|
wait_for_user = true;
|
|
|
|
debug_current_and_destination((char *)"Starting G26 Mesh Validation Pattern.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
if (G29_lcd_clicked()) { // Check if the user wants to stop the Mesh Validation
|
|
|
|
|
|
|
|
|
|
|
|
if (!wait_for_user) { // Check if the user wants to stop the Mesh Validation
|
|
|
|
strcpy(lcd_status_message, "Mesh Validation Stopped."); // We can't do lcd_setstatus() without having it continue;
|
|
|
|
strcpy(lcd_status_message, "Mesh Validation Stopped."); // We can't do lcd_setstatus() without having it continue;
|
|
|
|
while (G29_lcd_clicked()) idle(); // Debounce the switch click
|
|
|
|
|
|
|
|
#if ENABLED(ULTRA_LCD)
|
|
|
|
#if ENABLED(ULTRA_LCD)
|
|
|
|
lcd_setstatus("Mesh Validation Stopped.", true);
|
|
|
|
lcd_setstatus("Mesh Validation Stopped.", true);
|
|
|
|
lcd_quick_feedback();
|
|
|
|
lcd_quick_feedback();
|
|
|
@ -257,14 +259,14 @@
|
|
|
|
goto LEAVE;
|
|
|
|
goto LEAVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Continue_with_closest)
|
|
|
|
if (continue_with_closest)
|
|
|
|
location = find_closest_circle_to_print(current_position[X_AXIS], current_position[Y_AXIS]);
|
|
|
|
location = find_closest_circle_to_print(current_position[X_AXIS], current_position[Y_AXIS]);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
location = find_closest_circle_to_print(X_Pos, Y_Pos); // Find the closest Mesh Intersection to where we are now.
|
|
|
|
location = find_closest_circle_to_print(x_pos, y_pos); // Find the closest Mesh Intersection to where we are now.
|
|
|
|
|
|
|
|
|
|
|
|
if (location.x_index >= 0 && location.y_index >= 0) {
|
|
|
|
if (location.x_index >= 0 && location.y_index >= 0) {
|
|
|
|
circle_x = blm.map_x_index_to_bed_location(location.x_index);
|
|
|
|
circle_x = ubl.map_x_index_to_bed_location(location.x_index);
|
|
|
|
circle_y = blm.map_y_index_to_bed_location(location.y_index);
|
|
|
|
circle_y = ubl.map_y_index_to_bed_location(location.y_index);
|
|
|
|
|
|
|
|
|
|
|
|
// Let's do a couple of quick sanity checks. We can pull this code out later if we never see it catch a problem
|
|
|
|
// Let's do a couple of quick sanity checks. We can pull this code out later if we never see it catch a problem
|
|
|
|
#ifdef DELTA
|
|
|
|
#ifdef DELTA
|
|
|
@ -282,7 +284,7 @@
|
|
|
|
xi = location.x_index; // Just to shrink the next few lines and make them easier to understand
|
|
|
|
xi = location.x_index; // Just to shrink the next few lines and make them easier to understand
|
|
|
|
yi = location.y_index;
|
|
|
|
yi = location.y_index;
|
|
|
|
|
|
|
|
|
|
|
|
if (G26_Debug_flag) {
|
|
|
|
if (g26_debug_flag) {
|
|
|
|
SERIAL_ECHOPGM(" Doing circle at: (xi=");
|
|
|
|
SERIAL_ECHOPGM(" Doing circle at: (xi=");
|
|
|
|
SERIAL_ECHO(xi);
|
|
|
|
SERIAL_ECHO(xi);
|
|
|
|
SERIAL_ECHOPGM(", yi=");
|
|
|
|
SERIAL_ECHOPGM(", yi=");
|
|
|
@ -322,14 +324,13 @@
|
|
|
|
* the CPU load and make the arc drawing faster and more smooth
|
|
|
|
* the CPU load and make the arc drawing faster and more smooth
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
float sin_table[360 / 30 + 1], cos_table[360 / 30 + 1];
|
|
|
|
float sin_table[360 / 30 + 1], cos_table[360 / 30 + 1];
|
|
|
|
int tmp_div_30;
|
|
|
|
|
|
|
|
for (i = 0; i <= 360 / 30; i++) {
|
|
|
|
for (i = 0; i <= 360 / 30; i++) {
|
|
|
|
cos_table[i] = SIZE_OF_INTERSECTION_CIRCLES * cos(RADIANS(valid_trig_angle(i * 30.0)));
|
|
|
|
cos_table[i] = SIZE_OF_INTERSECTION_CIRCLES * cos(RADIANS(valid_trig_angle(i * 30.0)));
|
|
|
|
sin_table[i] = SIZE_OF_INTERSECTION_CIRCLES * sin(RADIANS(valid_trig_angle(i * 30.0)));
|
|
|
|
sin_table[i] = SIZE_OF_INTERSECTION_CIRCLES * sin(RADIANS(valid_trig_angle(i * 30.0)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (tmp = start_angle; tmp < end_angle - 0.1; tmp += 30.0) {
|
|
|
|
for (tmp = start_angle; tmp < end_angle - 0.1; tmp += 30.0) {
|
|
|
|
tmp_div_30 = tmp / 30.0;
|
|
|
|
int tmp_div_30 = tmp / 30.0;
|
|
|
|
if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
|
|
|
|
if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
|
|
|
|
|
|
|
|
|
|
|
|
x = circle_x + cos_table[tmp_div_30]; // for speed, these are now a lookup table entry
|
|
|
|
x = circle_x + cos_table[tmp_div_30]; // for speed, these are now a lookup table entry
|
|
|
@ -348,18 +349,18 @@
|
|
|
|
ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
|
|
|
ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (G26_Debug_flag) {
|
|
|
|
if (g26_debug_flag) {
|
|
|
|
char ccc, *cptr, seg_msg[50], seg_num[10];
|
|
|
|
char ccc, *cptr, seg_msg[50], seg_num[10];
|
|
|
|
strcpy(seg_msg, " segment: ");
|
|
|
|
strcpy(seg_msg, " segment: ");
|
|
|
|
strcpy(seg_num, " \n");
|
|
|
|
strcpy(seg_num, " \n");
|
|
|
|
cptr = (char *) "01234567890ABCDEF????????";
|
|
|
|
cptr = (char*) "01234567890ABCDEF????????";
|
|
|
|
ccc = cptr[tmp_div_30];
|
|
|
|
ccc = cptr[tmp_div_30];
|
|
|
|
seg_num[1] = ccc;
|
|
|
|
seg_num[1] = ccc;
|
|
|
|
strcat(seg_msg, seg_num);
|
|
|
|
strcat(seg_msg, seg_num);
|
|
|
|
debug_current_and_destination(seg_msg);
|
|
|
|
debug_current_and_destination(seg_msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print_line_from_here_to_there(x, y, Layer_Height, xe, ye, Layer_Height);
|
|
|
|
print_line_from_here_to_there(x, y, layer_height, xe, ye, layer_height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lcd_init_counter++;
|
|
|
|
lcd_init_counter++;
|
|
|
|
if (lcd_init_counter > 10) {
|
|
|
|
if (lcd_init_counter > 10) {
|
|
|
@ -367,35 +368,37 @@
|
|
|
|
lcd_init(); // Some people's LCD Displays are locking up. This might help them
|
|
|
|
lcd_init(); // Some people's LCD Displays are locking up. This might help them
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
debug_current_and_destination((char *)"Looking for lines to connect.");
|
|
|
|
debug_current_and_destination((char*)"Looking for lines to connect.");
|
|
|
|
look_for_lines_to_connect();
|
|
|
|
look_for_lines_to_connect();
|
|
|
|
debug_current_and_destination((char *)"Done with line connect.");
|
|
|
|
debug_current_and_destination((char*)"Done with line connect.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
debug_current_and_destination((char *)"Done with current circle.");
|
|
|
|
debug_current_and_destination((char*)"Done with current circle.");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (location.x_index >= 0 && location.y_index >= 0) ;
|
|
|
|
while (location.x_index >= 0 && location.y_index >= 0);
|
|
|
|
|
|
|
|
|
|
|
|
LEAVE:
|
|
|
|
LEAVE:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wait_for_user = false;
|
|
|
|
|
|
|
|
|
|
|
|
retract_filament();
|
|
|
|
retract_filament();
|
|
|
|
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Raise the nozzle
|
|
|
|
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Raise the nozzle
|
|
|
|
|
|
|
|
|
|
|
|
debug_current_and_destination((char *)"ready to do Z-Raise.");
|
|
|
|
debug_current_and_destination((char*)"ready to do Z-Raise.");
|
|
|
|
move_to( destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Raise the nozzle
|
|
|
|
move_to( destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Raise the nozzle
|
|
|
|
debug_current_and_destination((char *)"done doing Z-Raise.");
|
|
|
|
debug_current_and_destination((char*)"done doing Z-Raise.");
|
|
|
|
|
|
|
|
|
|
|
|
destination[X_AXIS] = X_Pos; // Move back to the starting position
|
|
|
|
destination[X_AXIS] = x_pos; // Move back to the starting position
|
|
|
|
destination[Y_AXIS] = Y_Pos;
|
|
|
|
destination[Y_AXIS] = y_pos;
|
|
|
|
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is
|
|
|
|
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is
|
|
|
|
|
|
|
|
|
|
|
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Move back to the starting position
|
|
|
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Move back to the starting position
|
|
|
|
debug_current_and_destination((char *)"done doing X/Y move.");
|
|
|
|
debug_current_and_destination((char*)"done doing X/Y move.");
|
|
|
|
|
|
|
|
|
|
|
|
UBL_has_control_of_LCD_Panel = 0; // Give back control of the LCD Panel!
|
|
|
|
ubl_has_control_of_lcd_panel = false; // Give back control of the LCD Panel!
|
|
|
|
|
|
|
|
|
|
|
|
if (!Keep_Heaters_On) {
|
|
|
|
if (!keep_heaters_on) {
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
thermalManager.setTargetBed(0.0);
|
|
|
|
thermalManager.setTargetBed(0.0);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -420,22 +423,22 @@
|
|
|
|
for (uint8_t i = 0; i < UBL_MESH_NUM_X_POINTS; i++) {
|
|
|
|
for (uint8_t i = 0; i < UBL_MESH_NUM_X_POINTS; i++) {
|
|
|
|
for (uint8_t j = 0; j < UBL_MESH_NUM_Y_POINTS; j++) {
|
|
|
|
for (uint8_t j = 0; j < UBL_MESH_NUM_Y_POINTS; j++) {
|
|
|
|
if (!is_bit_set(circle_flags, i, j)) {
|
|
|
|
if (!is_bit_set(circle_flags, i, j)) {
|
|
|
|
mx = blm.map_x_index_to_bed_location(i); // We found a circle that needs to be printed
|
|
|
|
mx = ubl.map_x_index_to_bed_location(i); // We found a circle that needs to be printed
|
|
|
|
my = blm.map_y_index_to_bed_location(j);
|
|
|
|
my = ubl.map_y_index_to_bed_location(j);
|
|
|
|
|
|
|
|
|
|
|
|
dx = X - mx; // Get the distance to this intersection
|
|
|
|
dx = X - mx; // Get the distance to this intersection
|
|
|
|
dy = Y - my;
|
|
|
|
dy = Y - my;
|
|
|
|
f = HYPOT(dx, dy);
|
|
|
|
f = HYPOT(dx, dy);
|
|
|
|
|
|
|
|
|
|
|
|
dx = X_Pos - mx; // It is possible that we are being called with the values
|
|
|
|
dx = x_pos - mx; // It is possible that we are being called with the values
|
|
|
|
dy = Y_Pos - my; // to let us find the closest circle to the start position.
|
|
|
|
dy = y_pos - my; // to let us find the closest circle to the start position.
|
|
|
|
f += HYPOT(dx, dy) / 15.0; // But if this is not the case,
|
|
|
|
f += HYPOT(dx, dy) / 15.0; // But if this is not the case,
|
|
|
|
// we are going to add in a small
|
|
|
|
// we are going to add in a small
|
|
|
|
// weighting to the distance calculation to help it choose
|
|
|
|
// weighting to the distance calculation to help it choose
|
|
|
|
// a better place to continue.
|
|
|
|
// a better place to continue.
|
|
|
|
|
|
|
|
|
|
|
|
if (Random_Deviation > 1.0)
|
|
|
|
if (random_deviation > 1.0)
|
|
|
|
f += random(0.0, Random_Deviation); // Add in the specified amount of Random Noise to our search
|
|
|
|
f += random(0.0, random_deviation); // Add in the specified amount of Random Noise to our search
|
|
|
|
|
|
|
|
|
|
|
|
if (f < closest) {
|
|
|
|
if (f < closest) {
|
|
|
|
closest = f; // We found a closer location that is still
|
|
|
|
closest = f; // We found a closer location that is still
|
|
|
@ -466,11 +469,11 @@
|
|
|
|
// We found two circles that need a horizontal line to connect them
|
|
|
|
// We found two circles that need a horizontal line to connect them
|
|
|
|
// Print it!
|
|
|
|
// Print it!
|
|
|
|
//
|
|
|
|
//
|
|
|
|
sx = blm.map_x_index_to_bed_location(i);
|
|
|
|
sx = ubl.map_x_index_to_bed_location(i);
|
|
|
|
sx = sx + SIZE_OF_INTERSECTION_CIRCLES - SIZE_OF_CROSS_HAIRS; // get the right edge of the circle
|
|
|
|
sx = sx + SIZE_OF_INTERSECTION_CIRCLES - SIZE_OF_CROSS_HAIRS; // get the right edge of the circle
|
|
|
|
sy = blm.map_y_index_to_bed_location(j);
|
|
|
|
sy = ubl.map_y_index_to_bed_location(j);
|
|
|
|
|
|
|
|
|
|
|
|
ex = blm.map_x_index_to_bed_location(i + 1);
|
|
|
|
ex = ubl.map_x_index_to_bed_location(i + 1);
|
|
|
|
ex = ex - SIZE_OF_INTERSECTION_CIRCLES + SIZE_OF_CROSS_HAIRS; // get the left edge of the circle
|
|
|
|
ex = ex - SIZE_OF_INTERSECTION_CIRCLES + SIZE_OF_CROSS_HAIRS; // get the left edge of the circle
|
|
|
|
ey = sy;
|
|
|
|
ey = sy;
|
|
|
|
|
|
|
|
|
|
|
@ -479,7 +482,7 @@
|
|
|
|
ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
|
|
|
|
ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
|
|
|
|
ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
|
|
|
ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
|
|
|
|
|
|
|
|
|
|
|
if (G26_Debug_flag) {
|
|
|
|
if (g26_debug_flag) {
|
|
|
|
SERIAL_ECHOPGM(" Connecting with horizontal line (sx=");
|
|
|
|
SERIAL_ECHOPGM(" Connecting with horizontal line (sx=");
|
|
|
|
SERIAL_ECHO(sx);
|
|
|
|
SERIAL_ECHO(sx);
|
|
|
|
SERIAL_ECHOPGM(", sy=");
|
|
|
|
SERIAL_ECHOPGM(", sy=");
|
|
|
@ -489,10 +492,10 @@
|
|
|
|
SERIAL_ECHOPGM(", ey=");
|
|
|
|
SERIAL_ECHOPGM(", ey=");
|
|
|
|
SERIAL_ECHO(ey);
|
|
|
|
SERIAL_ECHO(ey);
|
|
|
|
SERIAL_ECHOLNPGM(")");
|
|
|
|
SERIAL_ECHOLNPGM(")");
|
|
|
|
debug_current_and_destination((char *)"Connecting horizontal line.");
|
|
|
|
debug_current_and_destination((char*)"Connecting horizontal line.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print_line_from_here_to_there(sx, sy, Layer_Height, ex, ey, Layer_Height);
|
|
|
|
print_line_from_here_to_there(sx, sy, layer_height, ex, ey, layer_height);
|
|
|
|
bit_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again
|
|
|
|
bit_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -506,12 +509,12 @@
|
|
|
|
// We found two circles that need a vertical line to connect them
|
|
|
|
// We found two circles that need a vertical line to connect them
|
|
|
|
// Print it!
|
|
|
|
// Print it!
|
|
|
|
//
|
|
|
|
//
|
|
|
|
sx = blm.map_x_index_to_bed_location(i);
|
|
|
|
sx = ubl.map_x_index_to_bed_location(i);
|
|
|
|
sy = blm.map_y_index_to_bed_location(j);
|
|
|
|
sy = ubl.map_y_index_to_bed_location(j);
|
|
|
|
sy = sy + SIZE_OF_INTERSECTION_CIRCLES - SIZE_OF_CROSS_HAIRS; // get the top edge of the circle
|
|
|
|
sy = sy + SIZE_OF_INTERSECTION_CIRCLES - SIZE_OF_CROSS_HAIRS; // get the top edge of the circle
|
|
|
|
|
|
|
|
|
|
|
|
ex = sx;
|
|
|
|
ex = sx;
|
|
|
|
ey = blm.map_y_index_to_bed_location(j + 1);
|
|
|
|
ey = ubl.map_y_index_to_bed_location(j + 1);
|
|
|
|
ey = ey - SIZE_OF_INTERSECTION_CIRCLES + SIZE_OF_CROSS_HAIRS; // get the bottom edge of the circle
|
|
|
|
ey = ey - SIZE_OF_INTERSECTION_CIRCLES + SIZE_OF_CROSS_HAIRS; // get the bottom edge of the circle
|
|
|
|
|
|
|
|
|
|
|
|
sx = constrain(sx, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
|
|
|
|
sx = constrain(sx, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
|
|
|
@ -519,7 +522,7 @@
|
|
|
|
ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
|
|
|
|
ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
|
|
|
|
ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
|
|
|
ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
|
|
|
|
|
|
|
|
|
|
|
if (G26_Debug_flag) {
|
|
|
|
if (g26_debug_flag) {
|
|
|
|
SERIAL_ECHOPGM(" Connecting with vertical line (sx=");
|
|
|
|
SERIAL_ECHOPGM(" Connecting with vertical line (sx=");
|
|
|
|
SERIAL_ECHO(sx);
|
|
|
|
SERIAL_ECHO(sx);
|
|
|
|
SERIAL_ECHOPGM(", sy=");
|
|
|
|
SERIAL_ECHOPGM(", sy=");
|
|
|
@ -529,9 +532,9 @@
|
|
|
|
SERIAL_ECHOPGM(", ey=");
|
|
|
|
SERIAL_ECHOPGM(", ey=");
|
|
|
|
SERIAL_ECHO(ey);
|
|
|
|
SERIAL_ECHO(ey);
|
|
|
|
SERIAL_ECHOLNPGM(")");
|
|
|
|
SERIAL_ECHOLNPGM(")");
|
|
|
|
debug_current_and_destination((char *)"Connecting vertical line.");
|
|
|
|
debug_current_and_destination((char*)"Connecting vertical line.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print_line_from_here_to_there(sx, sy, Layer_Height, ex, ey, Layer_Height);
|
|
|
|
print_line_from_here_to_there(sx, sy, layer_height, ex, ey, layer_height);
|
|
|
|
bit_set( vertical_mesh_line_flags, i, j); // Mark it as done so we don't do it again
|
|
|
|
bit_set( vertical_mesh_line_flags, i, j); // Mark it as done so we don't do it again
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -545,8 +548,8 @@
|
|
|
|
float dx, dy, de, xy_dist, fpmm;
|
|
|
|
float dx, dy, de, xy_dist, fpmm;
|
|
|
|
|
|
|
|
|
|
|
|
// if the title message starts with a '!' it is so important, we are going to
|
|
|
|
// if the title message starts with a '!' it is so important, we are going to
|
|
|
|
// ignore the status of the G26_Debug_Flag
|
|
|
|
// ignore the status of the g26_debug_flag
|
|
|
|
if (*title != '!' && !G26_Debug_flag) return;
|
|
|
|
if (*title != '!' && !g26_debug_flag) return;
|
|
|
|
|
|
|
|
|
|
|
|
dx = current_position[X_AXIS] - destination[X_AXIS];
|
|
|
|
dx = current_position[X_AXIS] - destination[X_AXIS];
|
|
|
|
dy = current_position[Y_AXIS] - destination[Y_AXIS];
|
|
|
|
dy = current_position[Y_AXIS] - destination[Y_AXIS];
|
|
|
@ -563,43 +566,43 @@
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
SERIAL_ECHOPGM(" fpmm=");
|
|
|
|
SERIAL_ECHOPGM(" fpmm=");
|
|
|
|
fpmm = de / xy_dist;
|
|
|
|
fpmm = de / xy_dist;
|
|
|
|
SERIAL_PROTOCOL_F(fpmm, 6);
|
|
|
|
SERIAL_ECHO_F(fpmm, 6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM(" current=( ");
|
|
|
|
SERIAL_ECHOPGM(" current=( ");
|
|
|
|
SERIAL_PROTOCOL_F(current_position[X_AXIS], 6);
|
|
|
|
SERIAL_ECHO_F(current_position[X_AXIS], 6);
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
SERIAL_PROTOCOL_F(current_position[Y_AXIS], 6);
|
|
|
|
SERIAL_ECHO_F(current_position[Y_AXIS], 6);
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
|
|
|
|
SERIAL_ECHO_F(current_position[Z_AXIS], 6);
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
SERIAL_PROTOCOL_F(current_position[E_AXIS], 6);
|
|
|
|
SERIAL_ECHO_F(current_position[E_AXIS], 6);
|
|
|
|
SERIAL_ECHOPGM(" ) destination=( ");
|
|
|
|
SERIAL_ECHOPGM(" ) destination=( ");
|
|
|
|
if (current_position[X_AXIS] == destination[X_AXIS])
|
|
|
|
if (current_position[X_AXIS] == destination[X_AXIS])
|
|
|
|
SERIAL_ECHOPGM("-------------");
|
|
|
|
SERIAL_ECHOPGM("-------------");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
SERIAL_PROTOCOL_F(destination[X_AXIS], 6);
|
|
|
|
SERIAL_ECHO_F(destination[X_AXIS], 6);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
|
|
|
|
|
|
|
|
if (current_position[Y_AXIS] == destination[Y_AXIS])
|
|
|
|
if (current_position[Y_AXIS] == destination[Y_AXIS])
|
|
|
|
SERIAL_ECHOPGM("-------------");
|
|
|
|
SERIAL_ECHOPGM("-------------");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
SERIAL_PROTOCOL_F(destination[Y_AXIS], 6);
|
|
|
|
SERIAL_ECHO_F(destination[Y_AXIS], 6);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
|
|
|
|
|
|
|
|
if (current_position[Z_AXIS] == destination[Z_AXIS])
|
|
|
|
if (current_position[Z_AXIS] == destination[Z_AXIS])
|
|
|
|
SERIAL_ECHOPGM("-------------");
|
|
|
|
SERIAL_ECHOPGM("-------------");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
SERIAL_PROTOCOL_F(destination[Z_AXIS], 6);
|
|
|
|
SERIAL_ECHO_F(destination[Z_AXIS], 6);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
|
|
|
|
|
|
|
|
if (current_position[E_AXIS] == destination[E_AXIS])
|
|
|
|
if (current_position[E_AXIS] == destination[E_AXIS])
|
|
|
|
SERIAL_ECHOPGM("-------------");
|
|
|
|
SERIAL_ECHOPGM("-------------");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
SERIAL_PROTOCOL_F(destination[E_AXIS], 6);
|
|
|
|
SERIAL_ECHO_F(destination[E_AXIS], 6);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM(" ) ");
|
|
|
|
SERIAL_ECHOPGM(" ) ");
|
|
|
|
SERIAL_ECHO(title);
|
|
|
|
SERIAL_ECHO(title);
|
|
|
@ -617,16 +620,16 @@
|
|
|
|
float feed_value;
|
|
|
|
float feed_value;
|
|
|
|
static float last_z = -999.99;
|
|
|
|
static float last_z = -999.99;
|
|
|
|
|
|
|
|
|
|
|
|
bool has_XY_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
|
|
|
|
bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
|
|
|
|
|
|
|
|
|
|
|
|
if (G26_Debug_flag) {
|
|
|
|
if (g26_debug_flag) {
|
|
|
|
SERIAL_ECHOPAIR("in move_to() has_XY_component:", (int)has_XY_component);
|
|
|
|
SERIAL_ECHOPAIR("in move_to() has_xy_component:", (int)has_xy_component);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (z != last_z) {
|
|
|
|
if (z != last_z) {
|
|
|
|
|
|
|
|
|
|
|
|
if (G26_Debug_flag) {
|
|
|
|
if (g26_debug_flag) {
|
|
|
|
SERIAL_ECHOPAIR("in move_to() changing Z to ", (int)z);
|
|
|
|
SERIAL_ECHOPAIR("in move_to() changing Z to ", (int)z);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -638,20 +641,20 @@
|
|
|
|
destination[Z_AXIS] = z; // We know the last_z==z or we wouldn't be in this block of code.
|
|
|
|
destination[Z_AXIS] = z; // We know the last_z==z or we wouldn't be in this block of code.
|
|
|
|
destination[E_AXIS] = current_position[E_AXIS];
|
|
|
|
destination[E_AXIS] = current_position[E_AXIS];
|
|
|
|
|
|
|
|
|
|
|
|
UBL_line_to_destination(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feed_value, 0);
|
|
|
|
ubl_line_to_destination(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feed_value, 0);
|
|
|
|
|
|
|
|
|
|
|
|
stepper.synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
set_destination_to_current();
|
|
|
|
set_destination_to_current();
|
|
|
|
|
|
|
|
|
|
|
|
if (G26_Debug_flag)
|
|
|
|
if (g26_debug_flag)
|
|
|
|
debug_current_and_destination((char *)" in move_to() done with Z move");
|
|
|
|
debug_current_and_destination((char*)" in move_to() done with Z move");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check if X or Y is involved in the movement.
|
|
|
|
// Check if X or Y is involved in the movement.
|
|
|
|
// Yes: a 'normal' movement. No: a retract() or un_retract()
|
|
|
|
// Yes: a 'normal' movement. No: a retract() or un_retract()
|
|
|
|
feed_value = has_XY_component ? PLANNER_XY_FEEDRATE() / 10.0 : planner.max_feedrate_mm_s[E_AXIS] / 1.5;
|
|
|
|
feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 10.0 : planner.max_feedrate_mm_s[E_AXIS] / 1.5;
|
|
|
|
|
|
|
|
|
|
|
|
if (G26_Debug_flag) {
|
|
|
|
if (g26_debug_flag) {
|
|
|
|
SERIAL_ECHOPAIR("in move_to() feed_value for XY:", feed_value);
|
|
|
|
SERIAL_ECHOPAIR("in move_to() feed_value for XY:", feed_value);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -660,32 +663,32 @@
|
|
|
|
destination[Y_AXIS] = y;
|
|
|
|
destination[Y_AXIS] = y;
|
|
|
|
destination[E_AXIS] += e_delta;
|
|
|
|
destination[E_AXIS] += e_delta;
|
|
|
|
|
|
|
|
|
|
|
|
if (G26_Debug_flag)
|
|
|
|
if (g26_debug_flag)
|
|
|
|
debug_current_and_destination((char *)" in move_to() doing last move");
|
|
|
|
debug_current_and_destination((char*)" in move_to() doing last move");
|
|
|
|
|
|
|
|
|
|
|
|
UBL_line_to_destination(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feed_value, 0);
|
|
|
|
ubl_line_to_destination(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feed_value, 0);
|
|
|
|
|
|
|
|
|
|
|
|
if (G26_Debug_flag)
|
|
|
|
if (g26_debug_flag)
|
|
|
|
debug_current_and_destination((char *)" in move_to() after last move");
|
|
|
|
debug_current_and_destination((char*)" in move_to() after last move");
|
|
|
|
|
|
|
|
|
|
|
|
stepper.synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
set_destination_to_current();
|
|
|
|
set_destination_to_current();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void retract_filament() {
|
|
|
|
void retract_filament() {
|
|
|
|
if (!G26_retracted) { // Only retract if we are not already retracted!
|
|
|
|
if (!g26_retracted) { // Only retract if we are not already retracted!
|
|
|
|
G26_retracted = true;
|
|
|
|
g26_retracted = true;
|
|
|
|
if (G26_Debug_flag) SERIAL_ECHOLNPGM(" Decided to do retract.");
|
|
|
|
if (g26_debug_flag) SERIAL_ECHOLNPGM(" Decided to do retract.");
|
|
|
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], -1.0 * Retraction_Multiplier);
|
|
|
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], -1.0 * retraction_multiplier);
|
|
|
|
if (G26_Debug_flag) SERIAL_ECHOLNPGM(" Retraction done.");
|
|
|
|
if (g26_debug_flag) SERIAL_ECHOLNPGM(" Retraction done.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void un_retract_filament() {
|
|
|
|
void un_retract_filament() {
|
|
|
|
if (G26_retracted) { // Only un-retract if we are retracted.
|
|
|
|
if (g26_retracted) { // Only un-retract if we are retracted.
|
|
|
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 1.2 * Retraction_Multiplier);
|
|
|
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 1.2 * retraction_multiplier);
|
|
|
|
G26_retracted = false;
|
|
|
|
g26_retracted = false;
|
|
|
|
if (G26_Debug_flag) SERIAL_ECHOLNPGM(" unretract done.");
|
|
|
|
if (g26_debug_flag) SERIAL_ECHOLNPGM(" unretract done.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -724,7 +727,7 @@
|
|
|
|
// On very small lines we don't do the optimization because it just isn't worth it.
|
|
|
|
// On very small lines we don't do the optimization because it just isn't worth it.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < abs(Line_Length)) {
|
|
|
|
if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < abs(Line_Length)) {
|
|
|
|
if (G26_Debug_flag)
|
|
|
|
if (g26_debug_flag)
|
|
|
|
SERIAL_ECHOLNPGM(" Reversing start and end of print_line_from_here_to_there()");
|
|
|
|
SERIAL_ECHOLNPGM(" Reversing start and end of print_line_from_here_to_there()");
|
|
|
|
print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
|
|
|
|
print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -734,19 +737,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
if (dist_start > 2.0) {
|
|
|
|
if (dist_start > 2.0) {
|
|
|
|
retract_filament();
|
|
|
|
retract_filament();
|
|
|
|
if (G26_Debug_flag)
|
|
|
|
if (g26_debug_flag)
|
|
|
|
SERIAL_ECHOLNPGM(" filament retracted.");
|
|
|
|
SERIAL_ECHOLNPGM(" filament retracted.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
move_to(sx, sy, sz, 0.0); // Get to the starting point with no extrusion
|
|
|
|
move_to(sx, sy, sz, 0.0); // Get to the starting point with no extrusion
|
|
|
|
|
|
|
|
|
|
|
|
E_Pos_Delta = Line_Length * G26_E_AXIS_feedrate * Extrusion_Multiplier;
|
|
|
|
float e_pos_delta = Line_Length * g26_e_axis_feedrate * extrusion_multiplier;
|
|
|
|
|
|
|
|
|
|
|
|
un_retract_filament();
|
|
|
|
un_retract_filament();
|
|
|
|
if (G26_Debug_flag) {
|
|
|
|
if (g26_debug_flag) {
|
|
|
|
SERIAL_ECHOLNPGM(" doing printing move.");
|
|
|
|
SERIAL_ECHOLNPGM(" doing printing move.");
|
|
|
|
debug_current_and_destination((char *)"doing final move_to() inside print_line_from_here_to_there()");
|
|
|
|
debug_current_and_destination((char*)"doing final move_to() inside print_line_from_here_to_there()");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
move_to(ex, ey, ez, E_Pos_Delta); // Get to the ending point with an appropriate amount of extrusion
|
|
|
|
move_to(ex, ey, ez, e_pos_delta); // Get to the ending point with an appropriate amount of extrusion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -756,17 +759,17 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool parse_G26_parameters() {
|
|
|
|
bool parse_G26_parameters() {
|
|
|
|
|
|
|
|
|
|
|
|
Extrusion_Multiplier = EXTRUSION_MULTIPLIER;
|
|
|
|
extrusion_multiplier = EXTRUSION_MULTIPLIER;
|
|
|
|
Retraction_Multiplier = RETRACTION_MULTIPLIER;
|
|
|
|
retraction_multiplier = RETRACTION_MULTIPLIER;
|
|
|
|
Nozzle = NOZZLE;
|
|
|
|
nozzle = NOZZLE;
|
|
|
|
Filament = FILAMENT;
|
|
|
|
filament_diameter = FILAMENT;
|
|
|
|
Layer_Height = LAYER_HEIGHT;
|
|
|
|
layer_height = LAYER_HEIGHT;
|
|
|
|
Prime_Length = PRIME_LENGTH;
|
|
|
|
prime_length = PRIME_LENGTH;
|
|
|
|
bed_temp = BED_TEMP;
|
|
|
|
bed_temp = BED_TEMP;
|
|
|
|
hotend_temp = HOTEND_TEMP;
|
|
|
|
hotend_temp = HOTEND_TEMP;
|
|
|
|
Ooooze_Amount = OOOOZE_AMOUNT;
|
|
|
|
ooze_amount = OOZE_AMOUNT;
|
|
|
|
Prime_Flag = 0;
|
|
|
|
prime_flag = 0;
|
|
|
|
Keep_Heaters_On = false;
|
|
|
|
keep_heaters_on = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('B')) {
|
|
|
|
if (code_seen('B')) {
|
|
|
|
bed_temp = code_value_float();
|
|
|
|
bed_temp = code_value_float();
|
|
|
@ -776,11 +779,11 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('C')) Continue_with_closest++;
|
|
|
|
if (code_seen('C')) continue_with_closest++;
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('L')) {
|
|
|
|
if (code_seen('L')) {
|
|
|
|
Layer_Height = code_value_float();
|
|
|
|
layer_height = code_value_float();
|
|
|
|
if (Layer_Height<0.0 || Layer_Height>2.0) {
|
|
|
|
if (layer_height < 0.0 || layer_height > 2.0) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible.");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible.");
|
|
|
|
return UBL_ERR;
|
|
|
|
return UBL_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -788,8 +791,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('Q')) {
|
|
|
|
if (code_seen('Q')) {
|
|
|
|
if (code_has_value()) {
|
|
|
|
if (code_has_value()) {
|
|
|
|
Retraction_Multiplier = code_value_float();
|
|
|
|
retraction_multiplier = code_value_float();
|
|
|
|
if (Retraction_Multiplier<.05 || Retraction_Multiplier>15.0) {
|
|
|
|
if (retraction_multiplier < 0.05 || retraction_multiplier > 15.0) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible.");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible.");
|
|
|
|
return UBL_ERR;
|
|
|
|
return UBL_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -801,25 +804,25 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('N')) {
|
|
|
|
if (code_seen('N')) {
|
|
|
|
Nozzle = code_value_float();
|
|
|
|
nozzle = code_value_float();
|
|
|
|
if (Nozzle < 0.1 || Nozzle > 1.0) {
|
|
|
|
if (nozzle < 0.1 || nozzle > 1.0) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible.");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible.");
|
|
|
|
return UBL_ERR;
|
|
|
|
return UBL_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('K')) Keep_Heaters_On++;
|
|
|
|
if (code_seen('K')) keep_heaters_on++;
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('O') && code_has_value())
|
|
|
|
if (code_seen('O') && code_has_value())
|
|
|
|
Ooooze_Amount = code_value_float();
|
|
|
|
ooze_amount = code_value_float();
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('P')) {
|
|
|
|
if (code_seen('P')) {
|
|
|
|
if (!code_has_value())
|
|
|
|
if (!code_has_value())
|
|
|
|
Prime_Flag = -1;
|
|
|
|
prime_flag = -1;
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
Prime_Flag++;
|
|
|
|
prime_flag++;
|
|
|
|
Prime_Length = code_value_float();
|
|
|
|
prime_length = code_value_float();
|
|
|
|
if (Prime_Length < 0.0 || Prime_Length > 25.0) {
|
|
|
|
if (prime_length < 0.0 || prime_length > 25.0) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible.");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible.");
|
|
|
|
return UBL_ERR;
|
|
|
|
return UBL_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -827,16 +830,17 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('F')) {
|
|
|
|
if (code_seen('F')) {
|
|
|
|
Filament = code_value_float();
|
|
|
|
filament_diameter = code_value_float();
|
|
|
|
if (Filament < 1.0 || Filament > 4.0) {
|
|
|
|
if (filament_diameter < 1.0 || filament_diameter > 4.0) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible.");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible.");
|
|
|
|
return UBL_ERR;
|
|
|
|
return UBL_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Extrusion_Multiplier *= sq(1.75) / sq(Filament); // If we aren't using 1.75mm filament, we need to
|
|
|
|
extrusion_multiplier *= sq(1.75) / sq(filament_diameter); // If we aren't using 1.75mm filament, we need to
|
|
|
|
// scale up or down the length needed to get the
|
|
|
|
// scale up or down the length needed to get the
|
|
|
|
// same volume of filament
|
|
|
|
// same volume of filament
|
|
|
|
Extrusion_Multiplier *= Filament * sq(Nozzle) / sq(0.3); // Scale up by nozzle size
|
|
|
|
|
|
|
|
|
|
|
|
extrusion_multiplier *= filament_diameter * sq(nozzle) / sq(0.3); // Scale up by nozzle size
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('H')) {
|
|
|
|
if (code_seen('H')) {
|
|
|
|
hotend_temp = code_value_float();
|
|
|
|
hotend_temp = code_value_float();
|
|
|
@ -848,15 +852,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('R')) {
|
|
|
|
if (code_seen('R')) {
|
|
|
|
randomSeed(millis());
|
|
|
|
randomSeed(millis());
|
|
|
|
Random_Deviation = code_has_value() ? code_value_float() : 50.0;
|
|
|
|
random_deviation = code_has_value() ? code_value_float() : 50.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
X_Pos = current_position[X_AXIS];
|
|
|
|
x_pos = current_position[X_AXIS];
|
|
|
|
Y_Pos = current_position[Y_AXIS];
|
|
|
|
y_pos = current_position[Y_AXIS];
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('X')) {
|
|
|
|
if (code_seen('X')) {
|
|
|
|
X_Pos = code_value_float();
|
|
|
|
x_pos = code_value_float();
|
|
|
|
if (X_Pos < X_MIN_POS || X_Pos > X_MAX_POS) {
|
|
|
|
if (x_pos < X_MIN_POS || x_pos > X_MAX_POS) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified X coordinate not plausible.");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified X coordinate not plausible.");
|
|
|
|
return UBL_ERR;
|
|
|
|
return UBL_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -864,8 +868,8 @@
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('Y')) {
|
|
|
|
if (code_seen('Y')) {
|
|
|
|
Y_Pos = code_value_float();
|
|
|
|
y_pos = code_value_float();
|
|
|
|
if (Y_Pos < Y_MIN_POS || Y_Pos > Y_MAX_POS) {
|
|
|
|
if (y_pos < Y_MIN_POS || y_pos > Y_MAX_POS) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified Y coordinate not plausible.");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Specified Y coordinate not plausible.");
|
|
|
|
return UBL_ERR;
|
|
|
|
return UBL_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -877,7 +881,7 @@
|
|
|
|
* alter the system's status. We wait until we know everything is correct before altering the state
|
|
|
|
* alter the system's status. We wait until we know everything is correct before altering the state
|
|
|
|
* of the system.
|
|
|
|
* of the system.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
blm.state.active = !code_seen('D');
|
|
|
|
ubl.state.active = !code_seen('D');
|
|
|
|
|
|
|
|
|
|
|
|
return UBL_OK;
|
|
|
|
return UBL_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -893,17 +897,18 @@
|
|
|
|
lcd_setstatus("G26 Heating Bed.", true);
|
|
|
|
lcd_setstatus("G26 Heating Bed.", true);
|
|
|
|
lcd_quick_feedback();
|
|
|
|
lcd_quick_feedback();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
UBL_has_control_of_LCD_Panel++;
|
|
|
|
ubl_has_control_of_lcd_panel++;
|
|
|
|
thermalManager.setTargetBed(bed_temp);
|
|
|
|
thermalManager.setTargetBed(bed_temp);
|
|
|
|
|
|
|
|
wait_for_user = true;
|
|
|
|
while (abs(thermalManager.degBed() - bed_temp) > 3) {
|
|
|
|
while (abs(thermalManager.degBed() - bed_temp) > 3) {
|
|
|
|
if (G29_lcd_clicked()) {
|
|
|
|
if (!wait_for_user) {
|
|
|
|
strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatus() without having it continue;
|
|
|
|
strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatus() without having it continue;
|
|
|
|
while (G29_lcd_clicked()) idle(); // Debounce the switch
|
|
|
|
|
|
|
|
lcd_setstatus("Leaving G26", true); // Now we do it right.
|
|
|
|
lcd_setstatus("Leaving G26", true); // Now we do it right.
|
|
|
|
return UBL_ERR;
|
|
|
|
return UBL_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
idle();
|
|
|
|
idle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wait_for_user = false;
|
|
|
|
#if ENABLED(ULTRA_LCD)
|
|
|
|
#if ENABLED(ULTRA_LCD)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lcd_setstatus("G26 Heating Nozzle.", true);
|
|
|
|
lcd_setstatus("G26 Heating Nozzle.", true);
|
|
|
@ -913,15 +918,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
// Start heating the nozzle and wait for it to reach temperature.
|
|
|
|
// Start heating the nozzle and wait for it to reach temperature.
|
|
|
|
thermalManager.setTargetHotend(hotend_temp, 0);
|
|
|
|
thermalManager.setTargetHotend(hotend_temp, 0);
|
|
|
|
|
|
|
|
wait_for_user = true;
|
|
|
|
while (abs(thermalManager.degHotend(0) - hotend_temp) > 3) {
|
|
|
|
while (abs(thermalManager.degHotend(0) - hotend_temp) > 3) {
|
|
|
|
if (G29_lcd_clicked()) {
|
|
|
|
if (!wait_for_user) {
|
|
|
|
strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatus() without having it continue;
|
|
|
|
strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatus() without having it continue;
|
|
|
|
while (G29_lcd_clicked()) idle(); // Debounce the switch
|
|
|
|
|
|
|
|
lcd_setstatus("Leaving G26", true); // Now we do it right.
|
|
|
|
lcd_setstatus("Leaving G26", true); // Now we do it right.
|
|
|
|
return UBL_ERR;
|
|
|
|
return UBL_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
idle();
|
|
|
|
idle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wait_for_user = false;
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(ULTRA_LCD)
|
|
|
|
#if ENABLED(ULTRA_LCD)
|
|
|
|
lcd_setstatus("", true);
|
|
|
|
lcd_setstatus("", true);
|
|
|
@ -936,8 +942,8 @@
|
|
|
|
bool prime_nozzle() {
|
|
|
|
bool prime_nozzle() {
|
|
|
|
float Total_Prime = 0.0;
|
|
|
|
float Total_Prime = 0.0;
|
|
|
|
|
|
|
|
|
|
|
|
if (Prime_Flag == -1) { // The user wants to control how much filament gets purged
|
|
|
|
if (prime_flag == -1) { // The user wants to control how much filament gets purged
|
|
|
|
lcd_setstatus("User Controled Prime", true);
|
|
|
|
lcd_setstatus("User-Controlled Prime", true);
|
|
|
|
chirp_at_user();
|
|
|
|
chirp_at_user();
|
|
|
|
|
|
|
|
|
|
|
|
set_destination_to_current();
|
|
|
|
set_destination_to_current();
|
|
|
@ -946,15 +952,15 @@
|
|
|
|
// retracted(). We are here because we want to prime the nozzle.
|
|
|
|
// retracted(). We are here because we want to prime the nozzle.
|
|
|
|
// So let's just unretract just to be sure.
|
|
|
|
// So let's just unretract just to be sure.
|
|
|
|
|
|
|
|
|
|
|
|
UBL_has_control_of_LCD_Panel++;
|
|
|
|
wait_for_user = true;
|
|
|
|
while (!G29_lcd_clicked()) {
|
|
|
|
while (wait_for_user) {
|
|
|
|
chirp_at_user();
|
|
|
|
chirp_at_user();
|
|
|
|
destination[E_AXIS] += 0.25;
|
|
|
|
destination[E_AXIS] += 0.25;
|
|
|
|
#ifdef PREVENT_LENGTHY_EXTRUDE
|
|
|
|
#ifdef PREVENT_LENGTHY_EXTRUDE
|
|
|
|
Total_Prime += 0.25;
|
|
|
|
Total_Prime += 0.25;
|
|
|
|
if (Total_Prime >= EXTRUDE_MAXLENGTH) return UBL_ERR;
|
|
|
|
if (Total_Prime >= EXTRUDE_MAXLENGTH) return UBL_ERR;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
UBL_line_to_destination(
|
|
|
|
ubl_line_to_destination(
|
|
|
|
destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS],
|
|
|
|
destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS],
|
|
|
|
//planner.max_feedrate_mm_s[E_AXIS] / 15.0, 0, 0xFFFF, 0xFFFF);
|
|
|
|
//planner.max_feedrate_mm_s[E_AXIS] / 15.0, 0, 0xFFFF, 0xFFFF);
|
|
|
|
planner.max_feedrate_mm_s[E_AXIS] / 15.0, 0
|
|
|
|
planner.max_feedrate_mm_s[E_AXIS] / 15.0, 0
|
|
|
@ -971,10 +977,8 @@
|
|
|
|
strcpy(lcd_status_message, "Done Priming"); // We can't do lcd_setstatus() without having it continue;
|
|
|
|
strcpy(lcd_status_message, "Done Priming"); // We can't do lcd_setstatus() without having it continue;
|
|
|
|
// So... We cheat to get a message up.
|
|
|
|
// So... We cheat to get a message up.
|
|
|
|
|
|
|
|
|
|
|
|
while (G29_lcd_clicked()) idle(); // Debounce the switch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(ULTRA_LCD)
|
|
|
|
#if ENABLED(ULTRA_LCD)
|
|
|
|
UBL_has_control_of_LCD_Panel = 0;
|
|
|
|
ubl_has_control_of_lcd_panel = false;
|
|
|
|
lcd_setstatus("Done Priming", true); // Now we do it right.
|
|
|
|
lcd_setstatus("Done Priming", true); // Now we do it right.
|
|
|
|
lcd_quick_feedback();
|
|
|
|
lcd_quick_feedback();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -985,8 +989,8 @@
|
|
|
|
lcd_quick_feedback();
|
|
|
|
lcd_quick_feedback();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
set_destination_to_current();
|
|
|
|
set_destination_to_current();
|
|
|
|
destination[E_AXIS] += Prime_Length;
|
|
|
|
destination[E_AXIS] += prime_length;
|
|
|
|
UBL_line_to_destination(
|
|
|
|
ubl_line_to_destination(
|
|
|
|
destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS],
|
|
|
|
destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS],
|
|
|
|
//planner.max_feedrate_mm_s[E_AXIS] / 15.0, 0, 0xFFFF, 0xFFFF);
|
|
|
|
//planner.max_feedrate_mm_s[E_AXIS] / 15.0, 0, 0xFFFF, 0xFFFF);
|
|
|
|
planner.max_feedrate_mm_s[E_AXIS] / 15.0, 0
|
|
|
|
planner.max_feedrate_mm_s[E_AXIS] / 15.0, 0
|
|
|
|