Add conditionals for kinematics, leveling

This commit is contained in:
Scott Lahteine 2016-09-11 20:11:30 -05:00
parent 21514568fd
commit 6ab54c60b1
8 changed files with 114 additions and 81 deletions

View file

@ -61,12 +61,16 @@
#define NORMAL_AXIS X_AXIS #define NORMAL_AXIS X_AXIS
#endif #endif
#define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))
#define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA)
#define IS_CARTESIAN !IS_KINEMATIC
/** /**
* SCARA * SCARA cannot use SLOWDOWN and requires QUICKHOME
*/ */
#if ENABLED(SCARA) #if IS_SCARA
#undef SLOWDOWN #undef SLOWDOWN
#define QUICK_HOME //SCARA needs Quickhome #define QUICK_HOME
#endif #endif
/** /**
@ -132,12 +136,6 @@
#define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)) #define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))
// Boundaries for probing based on set limits
#define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0) #define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
/** /**
@ -657,17 +655,27 @@
#ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3 #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3
#define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0 #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_GRID)
#define DELTA_BED_LEVELING_GRID
#endif
#endif #endif
/** /**
* When not using other bed leveling... * Specify the exact style of auto bed leveling
*
* 3POINT - 3 Point Probing with the least-squares solution.
* LINEAR - Grid Probing with the least-squares solution.
* NONLINEAR - Grid Probing with a mesh solution. Best for large beds.
*/ */
#if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(AUTO_BED_LEVELING_GRID) && DISABLED(DELTA_BED_LEVELING_GRID) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#if DISABLED(AUTO_BED_LEVELING_GRID)
#define AUTO_BED_LEVELING_LINEAR
#define AUTO_BED_LEVELING_3POINT #define AUTO_BED_LEVELING_3POINT
#elif IS_KINEMATIC
#define AUTO_BED_LEVELING_NONLINEAR
#else
#define AUTO_BED_LEVELING_LINEAR
#endif #endif
#endif
#define PLANNER_LEVELING (ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_LINEAR))
/** /**
* Buzzer/Speaker * Buzzer/Speaker
@ -702,4 +710,18 @@
#define Z_PROBE_TRAVEL_HEIGHT Z_HOMING_HEIGHT #define Z_PROBE_TRAVEL_HEIGHT Z_HOMING_HEIGHT
#endif #endif
#if IS_KINEMATIC
// Check for this in the code instead
#define MIN_PROBE_X X_MIN_POS
#define MAX_PROBE_X X_MAX_POS
#define MIN_PROBE_Y Y_MIN_POS
#define MAX_PROBE_Y Y_MAX_POS
#else
// Boundaries for probing based on set limits
#define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#endif
#endif // CONDITIONALS_POST_H #endif // CONDITIONALS_POST_H

View file

@ -313,7 +313,7 @@ float code_value_temp_diff();
extern int delta_grid_spacing[2]; extern int delta_grid_spacing[2];
void adjust_delta(float cartesian[XYZ]); void adjust_delta(float cartesian[XYZ]);
#endif #endif
#elif ENABLED(SCARA) #elif IS_SCARA
extern float delta[ABC]; extern float delta[ABC];
extern float axis_scaling[ABC]; // Build size scaling extern float axis_scaling[ABC]; // Build size scaling
void inverse_kinematics(const float cartesian[XYZ]); void inverse_kinematics(const float cartesian[XYZ]);

View file

@ -36,12 +36,11 @@
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h" #include "vector_3.h"
#if ENABLED(AUTO_BED_LEVELING_GRID) #endif
#include "qr_solve.h"
#endif
#endif // AUTO_BED_LEVELING_FEATURE
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
#include "qr_solve.h"
#elif ENABLED(MESH_BED_LEVELING)
#include "mesh_bed_leveling.h" #include "mesh_bed_leveling.h"
#endif #endif
@ -497,7 +496,12 @@ static uint8_t target_extruder;
#endif #endif
#if ENABLED(SCARA) #if IS_SCARA
// Float constants for SCARA calculations
const float L1 = SCARA_LINKAGE_1, L2 = SCARA_LINKAGE_2,
L1_2 = sq(float(L1)), L1_2_2 = 2.0 * L1_2,
L2_2 = sq(float(L2));
float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND, float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND,
delta[ABC], delta[ABC],
axis_scaling[ABC] = { 1, 1, 1 }, // Build size scaling, default to 1 axis_scaling[ABC] = { 1, 1, 1 }, // Build size scaling, default to 1
@ -651,7 +655,7 @@ inline void sync_plan_position() {
} }
inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); } inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
#if ENABLED(DELTA) || ENABLED(SCARA) #if IS_KINEMATIC
inline void sync_plan_position_delta() { inline void sync_plan_position_delta() {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position);
@ -2161,7 +2165,7 @@ static void clean_up_after_endstop_or_probe_move() {
// Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding // Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding
refresh_cmd_timeout(); refresh_cmd_timeout();
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
planner.bed_level_matrix.set_to_identity(); planner.bed_level_matrix.set_to_identity();
#endif #endif
@ -2272,7 +2276,7 @@ static void clean_up_after_endstop_or_probe_move() {
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#if DISABLED(DELTA) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
/** /**
* Get the stepper positions, apply the rotation matrix * Get the stepper positions, apply the rotation matrix
@ -2302,9 +2306,7 @@ static void clean_up_after_endstop_or_probe_move() {
return pos; return pos;
} }
#endif // !DELTA #elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
#if ENABLED(DELTA)
/** /**
* All DELTA leveling in the Marlin uses NONLINEAR_BED_LEVELING * All DELTA leveling in the Marlin uses NONLINEAR_BED_LEVELING
@ -2870,7 +2872,7 @@ inline void gcode_G4() {
SERIAL_ECHOPGM("Machine Type: "); SERIAL_ECHOPGM("Machine Type: ");
#if ENABLED(DELTA) #if ENABLED(DELTA)
SERIAL_ECHOLNPGM("Delta"); SERIAL_ECHOLNPGM("Delta");
#elif ENABLED(SCARA) #elif IS_SCARA
SERIAL_ECHOLNPGM("SCARA"); SERIAL_ECHOLNPGM("SCARA");
#elif ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ) #elif ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
SERIAL_ECHOLNPGM("Core"); SERIAL_ECHOLNPGM("Core");
@ -2947,11 +2949,12 @@ inline void gcode_G28() {
stepper.synchronize(); stepper.synchronize();
// For auto bed leveling, clear the level matrix // For auto bed leveling, clear the level matrix
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
planner.bed_level_matrix.set_to_identity(); planner.bed_level_matrix.set_to_identity();
#if ENABLED(DELTA)
reset_bed_level();
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
reset_bed_level();
#endif #endif
// Always home with tool 0 active // Always home with tool 0 active
@ -3533,7 +3536,7 @@ inline void gcode_G28() {
#if ENABLED(AUTO_BED_LEVELING_GRID) #if ENABLED(AUTO_BED_LEVELING_GRID)
#if DISABLED(DELTA) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
bool do_topography_map = verbose_level > 2 || code_seen('T'); bool do_topography_map = verbose_level > 2 || code_seen('T');
#endif #endif
@ -3544,7 +3547,7 @@ inline void gcode_G28() {
int auto_bed_leveling_grid_points = AUTO_BED_LEVELING_GRID_POINTS; int auto_bed_leveling_grid_points = AUTO_BED_LEVELING_GRID_POINTS;
#if DISABLED(DELTA) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
if (code_seen('P')) auto_bed_leveling_grid_points = code_value_int(); if (code_seen('P')) auto_bed_leveling_grid_points = code_value_int();
if (auto_bed_leveling_grid_points < 2) { if (auto_bed_leveling_grid_points < 2) {
SERIAL_PROTOCOLLNPGM("?Number of probed (P)oints is implausible (2 minimum)."); SERIAL_PROTOCOLLNPGM("?Number of probed (P)oints is implausible (2 minimum).");
@ -3594,17 +3597,19 @@ inline void gcode_G28() {
if (!dryrun) { if (!dryrun) {
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
// Reset the bed_level_matrix because leveling // Reset the bed_level_matrix because leveling
// needs to be done without leveling enabled. // needs to be done without leveling enabled.
planner.bed_level_matrix.set_to_identity(); planner.bed_level_matrix.set_to_identity();
#endif
// //
// Re-orient the current position without leveling // Re-orient the current position without leveling
// based on where the steppers are positioned. // based on where the steppers are positioned.
// //
#if ENABLED(DELTA) || ENABLED(SCARA) #if IS_KINEMATIC
#if ENABLED(DELTA) #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
reset_bed_level(); reset_bed_level();
#endif #endif
@ -3639,12 +3644,14 @@ inline void gcode_G28() {
const float xGridSpacing = (right_probe_bed_position - left_probe_bed_position) / (auto_bed_leveling_grid_points - 1), const float xGridSpacing = (right_probe_bed_position - left_probe_bed_position) / (auto_bed_leveling_grid_points - 1),
yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1); yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1);
#if ENABLED(DELTA) #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
delta_grid_spacing[X_AXIS] = xGridSpacing; delta_grid_spacing[X_AXIS] = xGridSpacing;
delta_grid_spacing[Y_AXIS] = yGridSpacing; delta_grid_spacing[Y_AXIS] = yGridSpacing;
float zoffset = zprobe_zoffset; float zoffset = zprobe_zoffset;
if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS); if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS);
#else // !DELTA
#elif ENABLED(AUTO_BED_LEVELING_LINEAR)
/** /**
* solve the plane equation ax + by + d = z * solve the plane equation ax + by + d = z
* A is the matrix with rows [x y 1] for all the probed points * A is the matrix with rows [x y 1] for all the probed points
@ -3660,7 +3667,8 @@ inline void gcode_G28() {
eqnBVector[abl2], // "B" vector of Z points eqnBVector[abl2], // "B" vector of Z points
mean = 0.0; mean = 0.0;
int8_t indexIntoAB[auto_bed_leveling_grid_points][auto_bed_leveling_grid_points]; int8_t indexIntoAB[auto_bed_leveling_grid_points][auto_bed_leveling_grid_points];
#endif // !DELTA
#endif // AUTO_BED_LEVELING_LINEAR
int probePointCounter = 0; int probePointCounter = 0;
bool zig = auto_bed_leveling_grid_points & 1; //always end at [RIGHT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION] bool zig = auto_bed_leveling_grid_points & 1; //always end at [RIGHT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION]
@ -3694,16 +3702,19 @@ inline void gcode_G28() {
float measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level); float measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
#if DISABLED(DELTA) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
mean += measured_z;
mean += measured_z;
eqnBVector[probePointCounter] = measured_z; eqnBVector[probePointCounter] = measured_z;
eqnAMatrix[probePointCounter + 0 * abl2] = xProbe; eqnAMatrix[probePointCounter + 0 * abl2] = xProbe;
eqnAMatrix[probePointCounter + 1 * abl2] = yProbe; eqnAMatrix[probePointCounter + 1 * abl2] = yProbe;
eqnAMatrix[probePointCounter + 2 * abl2] = 1; eqnAMatrix[probePointCounter + 2 * abl2] = 1;
indexIntoAB[xCount][yCount] = probePointCounter; indexIntoAB[xCount][yCount] = probePointCounter;
#else
#elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
bed_level[xCount][yCount] = measured_z + zoffset; bed_level[xCount][yCount] = measured_z + zoffset;
#endif #endif
probePointCounter++; probePointCounter++;
@ -3713,7 +3724,7 @@ inline void gcode_G28() {
} //xProbe } //xProbe
} //yProbe } //yProbe
#else // !AUTO_BED_LEVELING_GRID #elif ENABLED(AUTO_BED_LEVELING_3POINT)
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling"); if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling");
@ -3759,12 +3770,12 @@ inline void gcode_G28() {
// Calculate leveling, print reports, correct the position // Calculate leveling, print reports, correct the position
#if ENABLED(AUTO_BED_LEVELING_GRID) #if ENABLED(AUTO_BED_LEVELING_GRID)
#if ENABLED(DELTA) #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
if (!dryrun) extrapolate_unprobed_bed_level(); if (!dryrun) extrapolate_unprobed_bed_level();
print_bed_level(); print_bed_level();
#else // !DELTA #elif ENABLED(AUTO_BED_LEVELING_LINEAR)
// solve lsq problem // solve lsq problem
double plane_equation_coefficients[3]; double plane_equation_coefficients[3];
@ -3860,11 +3871,11 @@ inline void gcode_G28() {
} }
} //do_topography_map } //do_topography_map
#endif //!DELTA #endif // AUTO_BED_LEVELING_LINEAR
#endif // AUTO_BED_LEVELING_GRID #endif // AUTO_BED_LEVELING_GRID
#if DISABLED(DELTA) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
if (verbose_level > 0) if (verbose_level > 0)
planner.bed_level_matrix.debug("\n\nBed Level Correction Matrix:"); planner.bed_level_matrix.debug("\n\nBed Level Correction Matrix:");
@ -4358,10 +4369,10 @@ inline void gcode_M42() {
if (verbose_level > 2) if (verbose_level > 2)
SERIAL_PROTOCOLLNPGM("Positioning the probe..."); SERIAL_PROTOCOLLNPGM("Positioning the probe...");
#if ENABLED(DELTA) #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
// we don't do bed level correction in M48 because we want the raw data when we probe // we don't do bed level correction in M48 because we want the raw data when we probe
reset_bed_level(); reset_bed_level();
#elif ENABLED(AUTO_BED_LEVELING_FEATURE) #elif ENABLED(AUTO_BED_LEVELING_LINEAR)
// we don't do bed level correction in M48 because we want the raw data when we probe // we don't do bed level correction in M48 because we want the raw data when we probe
planner.bed_level_matrix.set_to_identity(); planner.bed_level_matrix.set_to_identity();
#endif #endif
@ -6361,7 +6372,7 @@ inline void gcode_M503() {
lastpos[i] = destination[i] = current_position[i]; lastpos[i] = destination[i] = current_position[i];
// Define runplan for move axes // Define runplan for move axes
#if ENABLED(DELTA) #if IS_KINEMATIC
#define RUNPLAN(RATE_MM_S) inverse_kinematics(destination); \ #define RUNPLAN(RATE_MM_S) inverse_kinematics(destination); \
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], RATE_MM_S, active_extruder); planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], RATE_MM_S, active_extruder);
#else #else
@ -6482,7 +6493,7 @@ inline void gcode_M503() {
destination[E_AXIS] = lastpos[E_AXIS]; destination[E_AXIS] = lastpos[E_AXIS];
planner.set_e_position_mm(current_position[E_AXIS]); planner.set_e_position_mm(current_position[E_AXIS]);
#if ENABLED(DELTA) #if IS_KINEMATIC
// Move XYZ to starting position, then E // Move XYZ to starting position, then E
inverse_kinematics(lastpos); inverse_kinematics(lastpos);
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], FILAMENT_CHANGE_XY_FEEDRATE, active_extruder); planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], FILAMENT_CHANGE_XY_FEEDRATE, active_extruder);
@ -6925,7 +6936,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
* Z software endstop. But this is technically correct (and * Z software endstop. But this is technically correct (and
* there is no viable alternative). * there is no viable alternative).
*/ */
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
// Offset extruder, make sure to apply the bed level rotation matrix // Offset extruder, make sure to apply the bed level rotation matrix
vector_3 tmp_offset_vec = vector_3(hotend_offset[X_AXIS][tmp_extruder], vector_3 tmp_offset_vec = vector_3(hotend_offset[X_AXIS][tmp_extruder],
hotend_offset[Y_AXIS][tmp_extruder], hotend_offset[Y_AXIS][tmp_extruder],
@ -7961,7 +7972,7 @@ void ok_to_send() {
stepper.get_axis_position_mm(C_AXIS)); stepper.get_axis_position_mm(C_AXIS));
} }
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
// Adjust print surface height by linear interpolation over the bed_level array. // Adjust print surface height by linear interpolation over the bed_level array.
void adjust_delta(float cartesian[XYZ]) { void adjust_delta(float cartesian[XYZ]) {
@ -8001,7 +8012,7 @@ void ok_to_send() {
SERIAL_ECHOPGM(" offset="); SERIAL_ECHOLN(offset); SERIAL_ECHOPGM(" offset="); SERIAL_ECHOLN(offset);
*/ */
} }
#endif // AUTO_BED_LEVELING_FEATURE #endif // AUTO_BED_LEVELING_NONLINEAR
#endif // DELTA #endif // DELTA
@ -8076,7 +8087,7 @@ void mesh_line_to_destination(float fr_mm_s, uint8_t x_splits = 0xff, uint8_t y_
} }
#endif // MESH_BED_LEVELING #endif // MESH_BED_LEVELING
#if ENABLED(DELTA) || ENABLED(SCARA) #if IS_KINEMATIC
inline bool prepare_kinematic_move_to(float target[NUM_AXIS]) { inline bool prepare_kinematic_move_to(float target[NUM_AXIS]) {
float difference[NUM_AXIS]; float difference[NUM_AXIS];
@ -8103,7 +8114,7 @@ void mesh_line_to_destination(float fr_mm_s, uint8_t x_splits = 0xff, uint8_t y_
inverse_kinematics(target); inverse_kinematics(target);
#if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_NONLINEAR)
if (!bed_leveling_in_progress) adjust_delta(target); if (!bed_leveling_in_progress) adjust_delta(target);
#endif #endif
@ -8115,7 +8126,7 @@ void mesh_line_to_destination(float fr_mm_s, uint8_t x_splits = 0xff, uint8_t y_
return true; return true;
} }
#endif // DELTA || SCARA #endif // IS_KINEMATIC
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
@ -8161,7 +8172,7 @@ void mesh_line_to_destination(float fr_mm_s, uint8_t x_splits = 0xff, uint8_t y_
#endif // DUAL_X_CARRIAGE #endif // DUAL_X_CARRIAGE
#if DISABLED(DELTA) && DISABLED(SCARA) #if !IS_KINEMATIC
inline bool prepare_move_to_destination_cartesian() { inline bool prepare_move_to_destination_cartesian() {
// Do not use feedrate_percentage for E or Z only moves // Do not use feedrate_percentage for E or Z only moves
@ -8181,7 +8192,7 @@ void mesh_line_to_destination(float fr_mm_s, uint8_t x_splits = 0xff, uint8_t y_
return true; return true;
} }
#endif // !DELTA && !SCARA #endif // !IS_KINEMATIC
#if ENABLED(PREVENT_COLD_EXTRUSION) #if ENABLED(PREVENT_COLD_EXTRUSION)
@ -8220,7 +8231,7 @@ void prepare_move_to_destination() {
prevent_dangerous_extrude(current_position[E_AXIS], destination[E_AXIS]); prevent_dangerous_extrude(current_position[E_AXIS], destination[E_AXIS]);
#endif #endif
#if ENABLED(DELTA) || ENABLED(SCARA) #if IS_KINEMATIC
if (!prepare_kinematic_move_to(destination)) return; if (!prepare_kinematic_move_to(destination)) return;
#else #else
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
@ -8356,9 +8367,9 @@ void prepare_move_to_destination() {
clamp_to_software_endstops(arc_target); clamp_to_software_endstops(arc_target);
#if ENABLED(DELTA) || ENABLED(SCARA) #if IS_KINEMATIC
inverse_kinematics(arc_target); inverse_kinematics(arc_target);
#if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_NONLINEAR)
adjust_delta(arc_target); adjust_delta(arc_target);
#endif #endif
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], fr_mm_s, active_extruder); planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], fr_mm_s, active_extruder);
@ -8368,9 +8379,9 @@ void prepare_move_to_destination() {
} }
// Ensure last segment arrives at target location. // Ensure last segment arrives at target location.
#if ENABLED(DELTA) || ENABLED(SCARA) #if IS_KINEMATIC
inverse_kinematics(target); inverse_kinematics(target);
#if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_NONLINEAR)
adjust_delta(target); adjust_delta(target);
#endif #endif
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], fr_mm_s, active_extruder); planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], fr_mm_s, active_extruder);

View file

@ -330,7 +330,7 @@ void Config_StoreSettings() {
#endif #endif
EEPROM_WRITE(lcd_contrast); EEPROM_WRITE(lcd_contrast);
#if ENABLED(SCARA) #if IS_SCARA
EEPROM_WRITE(axis_scaling); // 3 floats EEPROM_WRITE(axis_scaling); // 3 floats
#else #else
dummy = 1.0f; dummy = 1.0f;
@ -520,7 +520,7 @@ void Config_RetrieveSettings() {
#endif #endif
EEPROM_READ(lcd_contrast); EEPROM_READ(lcd_contrast);
#if ENABLED(SCARA) #if IS_SCARA
EEPROM_READ(axis_scaling); // 3 floats EEPROM_READ(axis_scaling); // 3 floats
#else #else
EEPROM_READ(dummy); EEPROM_READ(dummy);
@ -584,7 +584,7 @@ void Config_ResetDefault() {
planner.axis_steps_per_mm[i] = tmp1[i]; planner.axis_steps_per_mm[i] = tmp1[i];
planner.max_feedrate_mm_s[i] = tmp2[i]; planner.max_feedrate_mm_s[i] = tmp2[i];
planner.max_acceleration_mm_per_s2[i] = tmp3[i]; planner.max_acceleration_mm_per_s2[i] = tmp3[i];
#if ENABLED(SCARA) #if IS_SCARA
if (i < COUNT(axis_scaling)) if (i < COUNT(axis_scaling))
axis_scaling[i] = 1; axis_scaling[i] = 1;
#endif #endif
@ -716,7 +716,7 @@ void Config_PrintSettings(bool forReplay) {
CONFIG_ECHO_START; CONFIG_ECHO_START;
#if ENABLED(SCARA) #if IS_SCARA
if (!forReplay) { if (!forReplay) {
SERIAL_ECHOLNPGM("Scaling factors:"); SERIAL_ECHOLNPGM("Scaling factors:");
CONFIG_ECHO_START; CONFIG_ECHO_START;

View file

@ -98,7 +98,7 @@ float Planner::min_feedrate_mm_s,
Planner::max_e_jerk, Planner::max_e_jerk,
Planner::min_travel_feedrate_mm_s; Planner::min_travel_feedrate_mm_s;
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level
#endif #endif
@ -138,7 +138,7 @@ void Planner::init() {
memset(position, 0, sizeof(position)); // clear position memset(position, 0, sizeof(position)); // clear position
LOOP_XYZE(i) previous_speed[i] = 0.0; LOOP_XYZE(i) previous_speed[i] = 0.0;
previous_nominal_speed = 0.0; previous_nominal_speed = 0.0;
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
bed_level_matrix.set_to_identity(); bed_level_matrix.set_to_identity();
#endif #endif
} }
@ -521,7 +521,7 @@ void Planner::check_axes_activity() {
#endif #endif
} }
#if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING) #if PLANNER_LEVELING
void Planner::apply_leveling( void Planner::apply_leveling(
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
@ -551,7 +551,7 @@ void Planner::check_axes_activity() {
#endif #endif
} }
#endif #endif // PLANNER_LEVELING
/** /**
* Planner::buffer_line * Planner::buffer_line
@ -1193,7 +1193,7 @@ void Planner::reset_acceleration_rates() {
// Recalculate position, steps_to_mm if axis_steps_per_mm changes! // Recalculate position, steps_to_mm if axis_steps_per_mm changes!
void Planner::refresh_positioning() { void Planner::refresh_positioning() {
LOOP_XYZE(i) steps_to_mm[i] = 1.0 / axis_steps_per_mm[i]; LOOP_XYZE(i) steps_to_mm[i] = 1.0 / axis_steps_per_mm[i];
#if ENABLED(DELTA) || ENABLED(SCARA) #if IS_KINEMATIC
inverse_kinematics(current_position); inverse_kinematics(current_position);
set_position_mm(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); set_position_mm(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
#else #else

View file

@ -188,7 +188,7 @@ void cubic_b_spline(const float position[NUM_AXIS], const float target[NUM_AXIS]
bez_target[E_AXIS] = interp(position[E_AXIS], target[E_AXIS], t); bez_target[E_AXIS] = interp(position[E_AXIS], target[E_AXIS], t);
clamp_to_software_endstops(bez_target); clamp_to_software_endstops(bez_target);
#if ENABLED(DELTA) || ENABLED(SCARA) #if IS_KINEMATIC
inverse_kinematics(bez_target); inverse_kinematics(bez_target);
#if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE)
adjust_delta(bez_target); adjust_delta(bez_target);

View file

@ -22,7 +22,7 @@
#include "qr_solve.h" #include "qr_solve.h"
#if ENABLED(AUTO_BED_LEVELING_GRID) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>

View file

@ -1418,7 +1418,7 @@ void kill_screen(const char* lcd_msg) {
* *
*/ */
#if ENABLED(DELTA) || ENABLED(SCARA) #if IS_KINEMATIC
#define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
#else #else
#define _MOVE_XYZ_ALLOWED true #define _MOVE_XYZ_ALLOWED true
@ -1823,7 +1823,7 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit); MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
#endif #endif
#if ENABLED(SCARA) #if IS_SCARA
MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS], 0.5, 2); MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS], 0.5, 2);
MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS], 0.5, 2); MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS], 0.5, 2);
#endif #endif