🏗️ Support for up to 6 linear axes (#19112)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
committed by
Scott Lahteine
parent
d3c56a76e7
commit
c1fca91103
@@ -113,20 +113,22 @@
|
||||
const xy_float_t ad = sign * dist;
|
||||
const bool use_x_dist = ad.x > ad.y;
|
||||
|
||||
float on_axis_distance = use_x_dist ? dist.x : dist.y,
|
||||
e_position = end.e - start.e,
|
||||
z_position = end.z - start.z;
|
||||
float on_axis_distance = use_x_dist ? dist.x : dist.y;
|
||||
|
||||
const float e_normalized_dist = e_position / on_axis_distance, // Allow divide by zero
|
||||
z_normalized_dist = z_position / on_axis_distance;
|
||||
const float z_normalized_dist = (end.z - start.z) / on_axis_distance; // Allow divide by zero
|
||||
#if HAS_EXTRUDERS
|
||||
const float e_normalized_dist = (end.e - start.e) / on_axis_distance;
|
||||
const bool inf_normalized_flag = isinf(e_normalized_dist);
|
||||
#endif
|
||||
|
||||
xy_int8_t icell = istart;
|
||||
|
||||
const float ratio = dist.y / dist.x, // Allow divide by zero
|
||||
c = start.y - ratio * start.x;
|
||||
|
||||
const bool inf_normalized_flag = isinf(e_normalized_dist),
|
||||
inf_ratio_flag = isinf(ratio);
|
||||
const bool inf_ratio_flag = isinf(ratio);
|
||||
|
||||
xyze_pos_t dest; // Stores XYZE for segmented moves
|
||||
|
||||
/**
|
||||
* Handle vertical lines that stay within one column.
|
||||
@@ -143,34 +145,36 @@
|
||||
* For others the next X is the same so this can continue.
|
||||
* Calculate X at the next Y mesh line.
|
||||
*/
|
||||
const float rx = inf_ratio_flag ? start.x : (next_mesh_line_y - c) / ratio;
|
||||
dest.x = inf_ratio_flag ? start.x : (next_mesh_line_y - c) / ratio;
|
||||
|
||||
float z0 = z_correction_for_x_on_horizontal_mesh_line(rx, icell.x, icell.y)
|
||||
float z0 = z_correction_for_x_on_horizontal_mesh_line(dest.x, icell.x, icell.y)
|
||||
* planner.fade_scaling_factor_for_z(end.z);
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
|
||||
const float ry = mesh_index_to_ypos(icell.y);
|
||||
dest.y = mesh_index_to_ypos(icell.y);
|
||||
|
||||
/**
|
||||
* Without this check, it's possible to generate a zero length move, as in the case where
|
||||
* the line is heading down, starting exactly on a mesh line boundary. Since this is rare
|
||||
* it might be fine to remove this check and let planner.buffer_segment() filter it out.
|
||||
*/
|
||||
if (ry != start.y) {
|
||||
if (dest.y != start.y) {
|
||||
if (!inf_normalized_flag) { // fall-through faster than branch
|
||||
on_axis_distance = use_x_dist ? rx - start.x : ry - start.y;
|
||||
e_position = start.e + on_axis_distance * e_normalized_dist;
|
||||
z_position = start.z + on_axis_distance * z_normalized_dist;
|
||||
on_axis_distance = use_x_dist ? dest.x - start.x : dest.y - start.y;
|
||||
TERN_(HAS_EXTRUDERS, dest.e = start.e + on_axis_distance * e_normalized_dist);
|
||||
dest.z = start.z + on_axis_distance * z_normalized_dist;
|
||||
}
|
||||
else {
|
||||
e_position = end.e;
|
||||
z_position = end.z;
|
||||
TERN_(HAS_EXTRUDERS, dest.e = end.e);
|
||||
dest.z = end.z;
|
||||
}
|
||||
|
||||
planner.buffer_segment(rx, ry, z_position + z0, e_position, scaled_fr_mm_s, extruder);
|
||||
dest.z += z0;
|
||||
planner.buffer_segment(dest, scaled_fr_mm_s, extruder);
|
||||
|
||||
} //else printf("FIRST MOVE PRUNED ");
|
||||
}
|
||||
|
||||
@@ -188,12 +192,13 @@
|
||||
*/
|
||||
if (iadd.y == 0) { // Horizontal line?
|
||||
icell.x += ineg.x; // Heading left? Just go to the left edge of the cell for the first move.
|
||||
|
||||
while (icell.x != iend.x + ineg.x) {
|
||||
icell.x += iadd.x;
|
||||
const float rx = mesh_index_to_xpos(icell.x);
|
||||
const float ry = ratio * rx + c; // Calculate Y at the next X mesh line
|
||||
dest.x = mesh_index_to_xpos(icell.x);
|
||||
dest.y = ratio * dest.x + c; // Calculate Y at the next X mesh line
|
||||
|
||||
float z0 = z_correction_for_y_on_vertical_mesh_line(ry, icell.x, icell.y)
|
||||
float z0 = z_correction_for_y_on_vertical_mesh_line(dest.y, icell.x, icell.y)
|
||||
* planner.fade_scaling_factor_for_z(end.z);
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
@@ -205,19 +210,20 @@
|
||||
* the line is heading left, starting exactly on a mesh line boundary. Since this is rare
|
||||
* it might be fine to remove this check and let planner.buffer_segment() filter it out.
|
||||
*/
|
||||
if (rx != start.x) {
|
||||
if (dest.x != start.x) {
|
||||
if (!inf_normalized_flag) {
|
||||
on_axis_distance = use_x_dist ? rx - start.x : ry - start.y;
|
||||
e_position = start.e + on_axis_distance * e_normalized_dist; // is based on X or Y because this is a horizontal move
|
||||
z_position = start.z + on_axis_distance * z_normalized_dist;
|
||||
on_axis_distance = use_x_dist ? dest.x - start.x : dest.y - start.y;
|
||||
TERN_(HAS_EXTRUDERS, dest.e = start.e + on_axis_distance * e_normalized_dist); // Based on X or Y because the move is horizontal
|
||||
dest.z = start.z + on_axis_distance * z_normalized_dist;
|
||||
}
|
||||
else {
|
||||
e_position = end.e;
|
||||
z_position = end.z;
|
||||
TERN_(HAS_EXTRUDERS, dest.e = end.e);
|
||||
dest.z = end.z;
|
||||
}
|
||||
|
||||
if (!planner.buffer_segment(rx, ry, z_position + z0, e_position, scaled_fr_mm_s, extruder))
|
||||
break;
|
||||
dest.z += z0;
|
||||
if (!planner.buffer_segment(dest, scaled_fr_mm_s, extruder)) break;
|
||||
|
||||
} //else printf("FIRST MOVE PRUNED ");
|
||||
}
|
||||
|
||||
@@ -239,57 +245,65 @@
|
||||
while (cnt) {
|
||||
|
||||
const float next_mesh_line_x = mesh_index_to_xpos(icell.x + iadd.x),
|
||||
next_mesh_line_y = mesh_index_to_ypos(icell.y + iadd.y),
|
||||
ry = ratio * next_mesh_line_x + c, // Calculate Y at the next X mesh line
|
||||
rx = (next_mesh_line_y - c) / ratio; // Calculate X at the next Y mesh line
|
||||
// (No need to worry about ratio == 0.
|
||||
// In that case, it was already detected
|
||||
// as a vertical line move above.)
|
||||
next_mesh_line_y = mesh_index_to_ypos(icell.y + iadd.y);
|
||||
|
||||
if (neg.x == (rx > next_mesh_line_x)) { // Check if we hit the Y line first
|
||||
dest.y = ratio * next_mesh_line_x + c; // Calculate Y at the next X mesh line
|
||||
dest.x = (next_mesh_line_y - c) / ratio; // Calculate X at the next Y mesh line
|
||||
// (No need to worry about ratio == 0.
|
||||
// In that case, it was already detected
|
||||
// as a vertical line move above.)
|
||||
|
||||
if (neg.x == (dest.x > next_mesh_line_x)) { // Check if we hit the Y line first
|
||||
// Yes! Crossing a Y Mesh Line next
|
||||
float z0 = z_correction_for_x_on_horizontal_mesh_line(rx, icell.x - ineg.x, icell.y + iadd.y)
|
||||
float z0 = z_correction_for_x_on_horizontal_mesh_line(dest.x, icell.x - ineg.x, icell.y + iadd.y)
|
||||
* planner.fade_scaling_factor_for_z(end.z);
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
|
||||
dest.y = next_mesh_line_y;
|
||||
|
||||
if (!inf_normalized_flag) {
|
||||
on_axis_distance = use_x_dist ? rx - start.x : next_mesh_line_y - start.y;
|
||||
e_position = start.e + on_axis_distance * e_normalized_dist;
|
||||
z_position = start.z + on_axis_distance * z_normalized_dist;
|
||||
on_axis_distance = use_x_dist ? dest.x - start.x : dest.y - start.y;
|
||||
TERN_(HAS_EXTRUDERS, dest.e = start.e + on_axis_distance * e_normalized_dist);
|
||||
dest.z = start.z + on_axis_distance * z_normalized_dist;
|
||||
}
|
||||
else {
|
||||
e_position = end.e;
|
||||
z_position = end.z;
|
||||
TERN_(HAS_EXTRUDERS, dest.e = end.e);
|
||||
dest.z = end.z;
|
||||
}
|
||||
if (!planner.buffer_segment(rx, next_mesh_line_y, z_position + z0, e_position, scaled_fr_mm_s, extruder))
|
||||
break;
|
||||
|
||||
dest.z += z0;
|
||||
if (!planner.buffer_segment(dest, scaled_fr_mm_s, extruder)) break;
|
||||
|
||||
icell.y += iadd.y;
|
||||
cnt.y--;
|
||||
}
|
||||
else {
|
||||
// Yes! Crossing a X Mesh Line next
|
||||
float z0 = z_correction_for_y_on_vertical_mesh_line(ry, icell.x + iadd.x, icell.y - ineg.y)
|
||||
float z0 = z_correction_for_y_on_vertical_mesh_line(dest.y, icell.x + iadd.x, icell.y - ineg.y)
|
||||
* planner.fade_scaling_factor_for_z(end.z);
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
|
||||
dest.x = next_mesh_line_x;
|
||||
|
||||
if (!inf_normalized_flag) {
|
||||
on_axis_distance = use_x_dist ? next_mesh_line_x - start.x : ry - start.y;
|
||||
e_position = start.e + on_axis_distance * e_normalized_dist;
|
||||
z_position = start.z + on_axis_distance * z_normalized_dist;
|
||||
on_axis_distance = use_x_dist ? dest.x - start.x : dest.y - start.y;
|
||||
TERN_(HAS_EXTRUDERS, dest.e = start.e + on_axis_distance * e_normalized_dist);
|
||||
dest.z = start.z + on_axis_distance * z_normalized_dist;
|
||||
}
|
||||
else {
|
||||
e_position = end.e;
|
||||
z_position = end.z;
|
||||
TERN_(HAS_EXTRUDERS, dest.e = end.e);
|
||||
dest.z = end.z;
|
||||
}
|
||||
|
||||
if (!planner.buffer_segment(next_mesh_line_x, ry, z_position + z0, e_position, scaled_fr_mm_s, extruder))
|
||||
break;
|
||||
dest.z += z0;
|
||||
if (!planner.buffer_segment(dest, scaled_fr_mm_s, extruder)) break;
|
||||
|
||||
icell.x += iadd.x;
|
||||
cnt.x--;
|
||||
}
|
||||
@@ -438,11 +452,9 @@
|
||||
#endif
|
||||
;
|
||||
|
||||
planner.buffer_line(raw.x, raw.y, raw.z + z_cxcy, raw.e, scaled_fr_mm_s, active_extruder, segment_xyz_mm
|
||||
#if ENABLED(SCARA_FEEDRATE_SCALING)
|
||||
, inv_duration
|
||||
#endif
|
||||
);
|
||||
const float oldz = raw.z; raw.z += z_cxcy;
|
||||
planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, segment_xyz_mm OPTARG(SCARA_FEEDRATE_SCALING, inv_duration) );
|
||||
raw.z = oldz;
|
||||
|
||||
if (segments == 0) // done with last segment
|
||||
return false; // didn't set current from destination
|
||||
|
@@ -417,6 +417,21 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(I)
|
||||
if (monitor_tmc_driver(stepperI, need_update_error_counters, need_debug_reporting))
|
||||
step_current_down(stepperI);
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(J)
|
||||
if (monitor_tmc_driver(stepperJ, need_update_error_counters, need_debug_reporting))
|
||||
step_current_down(stepperJ);
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(K)
|
||||
if (monitor_tmc_driver(stepperK, need_update_error_counters, need_debug_reporting))
|
||||
step_current_down(stepperK);
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E0)
|
||||
(void)monitor_tmc_driver(stepperE0, need_update_error_counters, need_debug_reporting);
|
||||
#endif
|
||||
@@ -757,138 +772,148 @@
|
||||
}
|
||||
}
|
||||
|
||||
static void tmc_debug_loop(
|
||||
const TMC_debug_enum i,
|
||||
LOGICAL_AXIS_LIST(const bool print_e, const bool print_x, const bool print_y, const bool print_z)
|
||||
) {
|
||||
if (print_x) {
|
||||
static void tmc_debug_loop(const TMC_debug_enum n, LOGICAL_AXIS_ARGS(const bool)) {
|
||||
if (x) {
|
||||
#if AXIS_IS_TMC(X)
|
||||
tmc_status(stepperX, i);
|
||||
tmc_status(stepperX, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(X2)
|
||||
tmc_status(stepperX2, i);
|
||||
tmc_status(stepperX2, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LINEAR_AXES >= XY
|
||||
if (print_y) {
|
||||
#if AXIS_IS_TMC(Y)
|
||||
tmc_status(stepperY, i);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
tmc_status(stepperY2, i);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (TERN0(HAS_Y_AXIS, y)) {
|
||||
#if AXIS_IS_TMC(Y)
|
||||
tmc_status(stepperY, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
tmc_status(stepperY2, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (TERN0(HAS_Z_AXIS, print_z)) {
|
||||
if (TERN0(HAS_Z_AXIS, z)) {
|
||||
#if AXIS_IS_TMC(Z)
|
||||
tmc_status(stepperZ, i);
|
||||
tmc_status(stepperZ, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
tmc_status(stepperZ2, i);
|
||||
tmc_status(stepperZ2, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
tmc_status(stepperZ3, i);
|
||||
tmc_status(stepperZ3, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z4)
|
||||
tmc_status(stepperZ4, i);
|
||||
tmc_status(stepperZ4, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, print_e)) {
|
||||
#if AXIS_IS_TMC(I)
|
||||
if (i) tmc_status(stepperI, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(J)
|
||||
if (j) tmc_status(stepperJ, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(K)
|
||||
if (k) tmc_status(stepperK, n);
|
||||
#endif
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, e)) {
|
||||
#if AXIS_IS_TMC(E0)
|
||||
tmc_status(stepperE0, i);
|
||||
tmc_status(stepperE0, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E1)
|
||||
tmc_status(stepperE1, i);
|
||||
tmc_status(stepperE1, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E2)
|
||||
tmc_status(stepperE2, i);
|
||||
tmc_status(stepperE2, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E3)
|
||||
tmc_status(stepperE3, i);
|
||||
tmc_status(stepperE3, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E4)
|
||||
tmc_status(stepperE4, i);
|
||||
tmc_status(stepperE4, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E5)
|
||||
tmc_status(stepperE5, i);
|
||||
tmc_status(stepperE5, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E6)
|
||||
tmc_status(stepperE6, i);
|
||||
tmc_status(stepperE6, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E7)
|
||||
tmc_status(stepperE7, i);
|
||||
tmc_status(stepperE7, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
static void drv_status_loop(
|
||||
const TMC_drv_status_enum i,
|
||||
LOGICAL_AXIS_LIST(const bool print_e, const bool print_x, const bool print_y, const bool print_z)
|
||||
) {
|
||||
if (print_x) {
|
||||
static void drv_status_loop(const TMC_drv_status_enum n, LOGICAL_AXIS_ARGS(const bool)) {
|
||||
if (x) {
|
||||
#if AXIS_IS_TMC(X)
|
||||
tmc_parse_drv_status(stepperX, i);
|
||||
tmc_parse_drv_status(stepperX, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(X2)
|
||||
tmc_parse_drv_status(stepperX2, i);
|
||||
tmc_parse_drv_status(stepperX2, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LINEAR_AXES >= XY
|
||||
if (print_y) {
|
||||
#if AXIS_IS_TMC(Y)
|
||||
tmc_parse_drv_status(stepperY, i);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
tmc_parse_drv_status(stepperY2, i);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (TERN0(HAS_Y_AXIS, y)) {
|
||||
#if AXIS_IS_TMC(Y)
|
||||
tmc_parse_drv_status(stepperY, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
tmc_parse_drv_status(stepperY2, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (TERN0(HAS_Z_AXIS, print_z)) {
|
||||
if (TERN0(HAS_Z_AXIS, z)) {
|
||||
#if AXIS_IS_TMC(Z)
|
||||
tmc_parse_drv_status(stepperZ, i);
|
||||
tmc_parse_drv_status(stepperZ, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
tmc_parse_drv_status(stepperZ2, i);
|
||||
tmc_parse_drv_status(stepperZ2, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
tmc_parse_drv_status(stepperZ3, i);
|
||||
tmc_parse_drv_status(stepperZ3, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z4)
|
||||
tmc_parse_drv_status(stepperZ4, i);
|
||||
tmc_parse_drv_status(stepperZ4, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, print_e)) {
|
||||
#if AXIS_IS_TMC(I)
|
||||
if (i) tmc_parse_drv_status(stepperI, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(J)
|
||||
if (j) tmc_parse_drv_status(stepperJ, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(K)
|
||||
if (k) tmc_parse_drv_status(stepperK, n);
|
||||
#endif
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, e)) {
|
||||
#if AXIS_IS_TMC(E0)
|
||||
tmc_parse_drv_status(stepperE0, i);
|
||||
tmc_parse_drv_status(stepperE0, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E1)
|
||||
tmc_parse_drv_status(stepperE1, i);
|
||||
tmc_parse_drv_status(stepperE1, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E2)
|
||||
tmc_parse_drv_status(stepperE2, i);
|
||||
tmc_parse_drv_status(stepperE2, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E3)
|
||||
tmc_parse_drv_status(stepperE3, i);
|
||||
tmc_parse_drv_status(stepperE3, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E4)
|
||||
tmc_parse_drv_status(stepperE4, i);
|
||||
tmc_parse_drv_status(stepperE4, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E5)
|
||||
tmc_parse_drv_status(stepperE5, i);
|
||||
tmc_parse_drv_status(stepperE5, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E6)
|
||||
tmc_parse_drv_status(stepperE6, i);
|
||||
tmc_parse_drv_status(stepperE6, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E7)
|
||||
tmc_parse_drv_status(stepperE7, i);
|
||||
tmc_parse_drv_status(stepperE7, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -899,11 +924,9 @@
|
||||
* M122 report functions
|
||||
*/
|
||||
|
||||
void tmc_report_all(
|
||||
LOGICAL_AXIS_LIST(const bool print_e/*=true*/, const bool print_x/*=true*/, const bool print_y/*=true*/, const bool print_z/*=true*/)
|
||||
) {
|
||||
#define TMC_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); tmc_debug_loop(ITEM, LOGICAL_AXIS_LIST(print_e, print_x, print_y, print_z)); }while(0)
|
||||
#define DRV_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); drv_status_loop(ITEM, LOGICAL_AXIS_LIST(print_e, print_x, print_y, print_z)); }while(0)
|
||||
void tmc_report_all(LOGICAL_AXIS_ARGS(const bool)) {
|
||||
#define TMC_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); tmc_debug_loop(ITEM, LOGICAL_AXIS_ARGS()); }while(0)
|
||||
#define DRV_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); drv_status_loop(ITEM, LOGICAL_AXIS_ARGS()); }while(0)
|
||||
|
||||
TMC_REPORT("\t", TMC_CODES);
|
||||
#if HAS_DRIVER(TMC2209)
|
||||
@@ -1028,79 +1051,82 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
static void tmc_get_registers(
|
||||
TMC_get_registers_enum i,
|
||||
LOGICAL_AXIS_LIST(const bool print_e, const bool print_x, const bool print_y, const bool print_z)
|
||||
) {
|
||||
if (print_x) {
|
||||
static void tmc_get_registers(TMC_get_registers_enum n, LOGICAL_AXIS_ARGS(const bool)) {
|
||||
if (x) {
|
||||
#if AXIS_IS_TMC(X)
|
||||
tmc_get_registers(stepperX, i);
|
||||
tmc_get_registers(stepperX, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(X2)
|
||||
tmc_get_registers(stepperX2, i);
|
||||
tmc_get_registers(stepperX2, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LINEAR_AXES >= XY
|
||||
if (print_y) {
|
||||
#if AXIS_IS_TMC(Y)
|
||||
tmc_get_registers(stepperY, i);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
tmc_get_registers(stepperY2, i);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (TERN0(HAS_Y_AXIS, y)) {
|
||||
#if AXIS_IS_TMC(Y)
|
||||
tmc_get_registers(stepperY, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
tmc_get_registers(stepperY2, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (TERN0(HAS_Z_AXIS, print_z)) {
|
||||
if (TERN0(HAS_Z_AXIS, z)) {
|
||||
#if AXIS_IS_TMC(Z)
|
||||
tmc_get_registers(stepperZ, i);
|
||||
tmc_get_registers(stepperZ, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
tmc_get_registers(stepperZ2, i);
|
||||
tmc_get_registers(stepperZ2, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
tmc_get_registers(stepperZ3, i);
|
||||
tmc_get_registers(stepperZ3, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z4)
|
||||
tmc_get_registers(stepperZ4, i);
|
||||
tmc_get_registers(stepperZ4, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, print_e)) {
|
||||
#if AXIS_IS_TMC(I)
|
||||
if (i) tmc_get_registers(stepperI, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(J)
|
||||
if (j) tmc_get_registers(stepperJ, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(K)
|
||||
if (k) tmc_get_registers(stepperK, n);
|
||||
#endif
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, e)) {
|
||||
#if AXIS_IS_TMC(E0)
|
||||
tmc_get_registers(stepperE0, i);
|
||||
tmc_get_registers(stepperE0, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E1)
|
||||
tmc_get_registers(stepperE1, i);
|
||||
tmc_get_registers(stepperE1, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E2)
|
||||
tmc_get_registers(stepperE2, i);
|
||||
tmc_get_registers(stepperE2, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E3)
|
||||
tmc_get_registers(stepperE3, i);
|
||||
tmc_get_registers(stepperE3, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E4)
|
||||
tmc_get_registers(stepperE4, i);
|
||||
tmc_get_registers(stepperE4, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E5)
|
||||
tmc_get_registers(stepperE5, i);
|
||||
tmc_get_registers(stepperE5, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E6)
|
||||
tmc_get_registers(stepperE6, i);
|
||||
tmc_get_registers(stepperE6, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E7)
|
||||
tmc_get_registers(stepperE7, i);
|
||||
tmc_get_registers(stepperE7, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
void tmc_get_registers(
|
||||
LOGICAL_AXIS_LIST(bool print_e, bool print_x, bool print_y, bool print_z)
|
||||
) {
|
||||
#define _TMC_GET_REG(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); tmc_get_registers(ITEM, LOGICAL_AXIS_LIST(print_e, print_x, print_y, print_z)); }while(0)
|
||||
void tmc_get_registers(LOGICAL_AXIS_ARGS(bool)) {
|
||||
#define _TMC_GET_REG(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); tmc_get_registers(ITEM, LOGICAL_AXIS_ARGS()); }while(0)
|
||||
#define TMC_GET_REG(NAME, TABS) _TMC_GET_REG(STRINGIFY(NAME) TABS, TMC_GET_##NAME)
|
||||
_TMC_GET_REG("\t", TMC_AXIS_CODES);
|
||||
TMC_GET_REG(GCONF, "\t\t");
|
||||
@@ -1185,6 +1211,15 @@
|
||||
#if AXIS_HAS_SPI(Z4)
|
||||
SET_CS_PIN(Z4);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(I)
|
||||
SET_CS_PIN(I);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(J)
|
||||
SET_CS_PIN(J);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(K)
|
||||
SET_CS_PIN(K);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E0)
|
||||
SET_CS_PIN(E0);
|
||||
#endif
|
||||
@@ -1234,12 +1269,10 @@ static bool test_connection(TMC &st) {
|
||||
return test_result;
|
||||
}
|
||||
|
||||
void test_tmc_connection(
|
||||
LOGICAL_AXIS_LIST(const bool test_e/*=true*/, const bool test_x/*=true*/, const bool test_y/*=true*/, const bool test_z/*=true*/)
|
||||
) {
|
||||
void test_tmc_connection(LOGICAL_AXIS_ARGS(const bool)) {
|
||||
uint8_t axis_connection = 0;
|
||||
|
||||
if (test_x) {
|
||||
if (x) {
|
||||
#if AXIS_IS_TMC(X)
|
||||
axis_connection += test_connection(stepperX);
|
||||
#endif
|
||||
@@ -1248,18 +1281,16 @@ void test_tmc_connection(
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LINEAR_AXES >= XY
|
||||
if (test_y) {
|
||||
#if AXIS_IS_TMC(Y)
|
||||
axis_connection += test_connection(stepperY);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
axis_connection += test_connection(stepperY2);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (TERN0(HAS_Y_AXIS, y)) {
|
||||
#if AXIS_IS_TMC(Y)
|
||||
axis_connection += test_connection(stepperY);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
axis_connection += test_connection(stepperY2);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (TERN0(HAS_Z_AXIS, test_z)) {
|
||||
if (TERN0(HAS_Z_AXIS, z)) {
|
||||
#if AXIS_IS_TMC(Z)
|
||||
axis_connection += test_connection(stepperZ);
|
||||
#endif
|
||||
@@ -1274,7 +1305,17 @@ void test_tmc_connection(
|
||||
#endif
|
||||
}
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, test_e)) {
|
||||
#if AXIS_IS_TMC(I)
|
||||
if (i) axis_connection += test_connection(stepperI);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(J)
|
||||
if (j) axis_connection += test_connection(stepperJ);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(K)
|
||||
if (k) axis_connection += test_connection(stepperK);
|
||||
#endif
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, e)) {
|
||||
#if AXIS_IS_TMC(E0)
|
||||
axis_connection += test_connection(stepperE0);
|
||||
#endif
|
||||
|
@@ -335,20 +335,14 @@ void tmc_print_current(TMC &st) {
|
||||
#endif
|
||||
|
||||
void monitor_tmc_drivers();
|
||||
void test_tmc_connection(
|
||||
LOGICAL_AXIS_LIST(const bool test_e=true, const bool test_x=true, const bool test_y=true, const bool test_z=true)
|
||||
);
|
||||
void test_tmc_connection(LOGICAL_AXIS_DECL(const bool, true));
|
||||
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
void tmc_set_report_interval(const uint16_t update_interval);
|
||||
#endif
|
||||
void tmc_report_all(
|
||||
LOGICAL_AXIS_LIST(const bool print_e=true, const bool print_x=true, const bool print_y=true, const bool print_z=true)
|
||||
);
|
||||
void tmc_get_registers(
|
||||
LOGICAL_AXIS_LIST(const bool print_e, const bool print_x, const bool print_y, const bool print_z)
|
||||
);
|
||||
void tmc_report_all(LOGICAL_AXIS_DECL(const bool, true));
|
||||
void tmc_get_registers(LOGICAL_AXIS_ARGS(const bool));
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -361,7 +355,7 @@ void test_tmc_connection(
|
||||
#if USE_SENSORLESS
|
||||
|
||||
// Track enabled status of stealthChop and only re-enable where applicable
|
||||
struct sensorless_t { bool LINEAR_AXIS_LIST(x, y, z), x2, y2, z2, z3, z4; };
|
||||
struct sensorless_t { bool LINEAR_AXIS_ARGS(), x2, y2, z2, z3, z4; };
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
extern millis_t sg_guard_period;
|
||||
|
Reference in New Issue
Block a user