Operate in Native Machine Space
This commit is contained in:
@@ -279,7 +279,7 @@
|
||||
|
||||
// If this mesh location is outside the printable_radius, skip it.
|
||||
|
||||
if (!position_is_reachable_raw_xy(circle_x, circle_y)) continue;
|
||||
if (!position_is_reachable(circle_x, circle_y)) continue;
|
||||
|
||||
xi = location.x_index; // Just to shrink the next few lines and make them easier to understand
|
||||
yi = location.y_index;
|
||||
@@ -328,16 +328,16 @@
|
||||
if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
|
||||
if (tmp_div_30 > 11) tmp_div_30 -= 360 / 30;
|
||||
|
||||
float x = circle_x + cos_table[tmp_div_30], // for speed, these are now a lookup table entry
|
||||
y = circle_y + sin_table[tmp_div_30],
|
||||
float rx = circle_x + cos_table[tmp_div_30], // for speed, these are now a lookup table entry
|
||||
ry = circle_y + sin_table[tmp_div_30],
|
||||
xe = circle_x + cos_table[tmp_div_30 + 1],
|
||||
ye = circle_y + sin_table[tmp_div_30 + 1];
|
||||
#if IS_KINEMATIC
|
||||
// Check to make sure this segment is entirely on the bed, skip if not.
|
||||
if (!position_is_reachable_raw_xy(x, y) || !position_is_reachable_raw_xy(xe, ye)) continue;
|
||||
#else // not, we need to skip
|
||||
x = constrain(x, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
|
||||
y = constrain(y, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||
if (!position_is_reachable(rx, ry) || !position_is_reachable(xe, ye)) continue;
|
||||
#else // not, we need to skip
|
||||
rx = constrain(rx, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
|
||||
ry = constrain(ry, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||
xe = constrain(xe, X_MIN_POS + 1, X_MAX_POS - 1);
|
||||
ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||
#endif
|
||||
@@ -353,7 +353,7 @@
|
||||
// debug_current_and_destination(seg_msg);
|
||||
//}
|
||||
|
||||
print_line_from_here_to_there(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y), g26_layer_height, LOGICAL_X_POSITION(xe), LOGICAL_Y_POSITION(ye), g26_layer_height);
|
||||
print_line_from_here_to_there(rx, ry, g26_layer_height, xe, ye, g26_layer_height);
|
||||
|
||||
}
|
||||
if (look_for_lines_to_connect())
|
||||
@@ -459,7 +459,7 @@
|
||||
sy = ey = constrain(mesh_index_to_ypos(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||
ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
|
||||
|
||||
if (position_is_reachable_raw_xy(sx, sy) && position_is_reachable_raw_xy(ex, ey)) {
|
||||
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
|
||||
|
||||
if (g26_debug_flag) {
|
||||
SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx);
|
||||
@@ -470,8 +470,7 @@
|
||||
SERIAL_EOL();
|
||||
//debug_current_and_destination(PSTR("Connecting horizontal line."));
|
||||
}
|
||||
|
||||
print_line_from_here_to_there(LOGICAL_X_POSITION(sx), LOGICAL_Y_POSITION(sy), g26_layer_height, LOGICAL_X_POSITION(ex), LOGICAL_Y_POSITION(ey), g26_layer_height);
|
||||
print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
|
||||
}
|
||||
bit_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if we skipped it
|
||||
}
|
||||
@@ -493,7 +492,7 @@
|
||||
sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||
ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||
|
||||
if (position_is_reachable_raw_xy(sx, sy) && position_is_reachable_raw_xy(ex, ey)) {
|
||||
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
|
||||
|
||||
if (g26_debug_flag) {
|
||||
SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx);
|
||||
@@ -504,7 +503,7 @@
|
||||
SERIAL_EOL();
|
||||
debug_current_and_destination(PSTR("Connecting vertical line."));
|
||||
}
|
||||
print_line_from_here_to_there(LOGICAL_X_POSITION(sx), LOGICAL_Y_POSITION(sy), g26_layer_height, LOGICAL_X_POSITION(ex), LOGICAL_Y_POSITION(ey), g26_layer_height);
|
||||
print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
|
||||
}
|
||||
bit_set(vertical_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if skipped
|
||||
}
|
||||
@@ -596,9 +595,8 @@
|
||||
|
||||
// If the end point of the line is closer to the nozzle, flip the direction,
|
||||
// moving from the end to the start. On very small lines the optimization isn't worth it.
|
||||
if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length)) {
|
||||
if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length))
|
||||
return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
|
||||
}
|
||||
|
||||
// Decide whether to retract & bump
|
||||
|
||||
@@ -737,9 +735,9 @@
|
||||
return UBL_ERR;
|
||||
}
|
||||
|
||||
g26_x_pos = parser.linearval('X', current_position[X_AXIS]);
|
||||
g26_y_pos = parser.linearval('Y', current_position[Y_AXIS]);
|
||||
if (!position_is_reachable_xy(g26_x_pos, g26_y_pos)) {
|
||||
g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS];
|
||||
g26_y_pos = parser.seenval('Y') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[Y_AXIS];
|
||||
if (!position_is_reachable(g26_x_pos, g26_y_pos)) {
|
||||
SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
|
||||
return UBL_ERR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user