|
@@ -596,7 +596,7 @@ void process_next_command();
|
596
|
596
|
void prepare_move_to_destination();
|
597
|
597
|
|
598
|
598
|
void get_cartesian_from_steppers();
|
599
|
|
-void set_current_from_steppers_for_axis(AxisEnum axis);
|
|
599
|
+void set_current_from_steppers_for_axis(const AxisEnum axis);
|
600
|
600
|
|
601
|
601
|
#if ENABLED(ARC_SUPPORT)
|
602
|
602
|
void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise);
|
|
@@ -645,9 +645,9 @@ static void report_current_position();
|
645
|
645
|
|
646
|
646
|
/**
|
647
|
647
|
* sync_plan_position
|
648
|
|
- * Set planner / stepper positions to the cartesian current_position.
|
649
|
|
- * The stepper code translates these coordinates into step units.
|
650
|
|
- * Allows translation between steps and millimeters for cartesian & core robots
|
|
648
|
+ *
|
|
649
|
+ * Set the planner/stepper positions directly from current_position with
|
|
650
|
+ * no kinematic translation. Used for homing axes and cartesian/core syncing.
|
651
|
651
|
*/
|
652
|
652
|
inline void sync_plan_position() {
|
653
|
653
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
@@ -1323,6 +1323,23 @@ static void set_home_offset(AxisEnum axis, float v) {
|
1323
|
1323
|
update_software_endstops(axis);
|
1324
|
1324
|
}
|
1325
|
1325
|
|
|
1326
|
+/**
|
|
1327
|
+ * Set an axis' current position to its home position (after homing).
|
|
1328
|
+ *
|
|
1329
|
+ * For Core and Cartesian robots this applies one-to-one when an
|
|
1330
|
+ * individual axis has been homed.
|
|
1331
|
+ *
|
|
1332
|
+ * DELTA should wait until all homing is done before setting the XYZ
|
|
1333
|
+ * current_position to home, because homing is a single operation.
|
|
1334
|
+ * In the case where the axis positions are already known and previously
|
|
1335
|
+ * homed, DELTA could home to X or Y individually by moving either one
|
|
1336
|
+ * to the center. However, homing Z always homes XY and Z.
|
|
1337
|
+ *
|
|
1338
|
+ * SCARA should wait until all XY homing is done before setting the XY
|
|
1339
|
+ * current_position to home, because neither X nor Y is at home until
|
|
1340
|
+ * both are at home. Z can however be homed individually.
|
|
1341
|
+ *
|
|
1342
|
+ */
|
1326
|
1343
|
static void set_axis_is_at_home(AxisEnum axis) {
|
1327
|
1344
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1328
|
1345
|
if (DEBUGGING(LEVELING)) {
|
|
@@ -1355,8 +1372,8 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
1355
|
1372
|
// SERIAL_ECHOLNPAIR(" Y:", homeposition[Y_AXIS]);
|
1356
|
1373
|
|
1357
|
1374
|
/**
|
1358
|
|
- * Works out real Homeposition angles using inverse kinematics,
|
1359
|
|
- * and calculates homing offset using forward kinematics
|
|
1375
|
+ * Get Home position SCARA arm angles using inverse kinematics,
|
|
1376
|
+ * and calculate homing offset using forward kinematics
|
1360
|
1377
|
*/
|
1361
|
1378
|
inverse_kinematics(homeposition);
|
1362
|
1379
|
forward_kinematics_SCARA(delta[A_AXIS], delta[B_AXIS]);
|
|
@@ -1989,7 +2006,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
1989
|
2006
|
// - Raise to the BETWEEN height
|
1990
|
2007
|
// - Return the probed Z position
|
1991
|
2008
|
//
|
1992
|
|
- static float probe_pt(float x, float y, bool stow = true, int verbose_level = 1) {
|
|
2009
|
+ static float probe_pt(const float &x, const float &y, bool stow = true, int verbose_level = 1) {
|
1993
|
2010
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1994
|
2011
|
if (DEBUGGING(LEVELING)) {
|
1995
|
2012
|
SERIAL_ECHOPAIR(">>> probe_pt(", x);
|
|
@@ -2013,7 +2030,10 @@ static void clean_up_after_endstop_or_probe_move() {
|
2013
|
2030
|
SERIAL_ECHOLNPGM(")");
|
2014
|
2031
|
}
|
2015
|
2032
|
#endif
|
|
2033
|
+
|
2016
|
2034
|
feedrate_mm_s = XY_PROBE_FEEDRATE_MM_S;
|
|
2035
|
+
|
|
2036
|
+ // Move the probe to the given XY
|
2017
|
2037
|
do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
|
2018
|
2038
|
|
2019
|
2039
|
if (DEPLOY_PROBE()) return NAN;
|
|
@@ -2105,9 +2125,9 @@ static void clean_up_after_endstop_or_probe_move() {
|
2105
|
2125
|
#elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
|
2106
|
2126
|
|
2107
|
2127
|
/**
|
2108
|
|
- * All DELTA leveling in the Marlin uses NONLINEAR_BED_LEVELING
|
|
2128
|
+ * Extrapolate a single point from its neighbors
|
2109
|
2129
|
*/
|
2110
|
|
- static void extrapolate_one_point(uint8_t x, uint8_t y, int xdir, int ydir) {
|
|
2130
|
+ static void extrapolate_one_point(uint8_t x, uint8_t y, int8_t xdir, int8_t ydir) {
|
2111
|
2131
|
if (bed_level_grid[x][y]) return; // Don't overwrite good values.
|
2112
|
2132
|
float a = 2 * bed_level_grid[x + xdir][y] - bed_level_grid[x + xdir * 2][y], // Left to right.
|
2113
|
2133
|
b = 2 * bed_level_grid[x][y + ydir] - bed_level_grid[x][y + ydir * 2], // Front to back.
|
|
@@ -2151,7 +2171,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2151
|
2171
|
#endif // AUTO_BED_LEVELING_NONLINEAR
|
2152
|
2172
|
|
2153
|
2173
|
/**
|
2154
|
|
- * Home an individual axis
|
|
2174
|
+ * Home an individual linear axis
|
2155
|
2175
|
*/
|
2156
|
2176
|
|
2157
|
2177
|
static void do_homing_move(AxisEnum axis, float where, float fr_mm_s = 0.0) {
|
|
@@ -2163,6 +2183,17 @@ static void do_homing_move(AxisEnum axis, float where, float fr_mm_s = 0.0) {
|
2163
|
2183
|
endstops.hit_on_purpose();
|
2164
|
2184
|
}
|
2165
|
2185
|
|
|
2186
|
+/**
|
|
2187
|
+ * Home an individual "raw axis" to its endstop.
|
|
2188
|
+ * This applies to XYZ on Cartesian and Core robots, and
|
|
2189
|
+ * to the individual ABC steppers on DELTA and SCARA.
|
|
2190
|
+ *
|
|
2191
|
+ * At the end of the procedure the axis is marked as
|
|
2192
|
+ * homed and the current position of that axis is updated.
|
|
2193
|
+ * Kinematic robots should wait till all axes are homed
|
|
2194
|
+ * before updating the current position.
|
|
2195
|
+ */
|
|
2196
|
+
|
2166
|
2197
|
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
|
2167
|
2198
|
|
2168
|
2199
|
static void homeaxis(AxisEnum axis) {
|
|
@@ -2678,11 +2709,17 @@ inline void gcode_G4() {
|
2678
|
2709
|
SERIAL_ECHOPGM(" (Right");
|
2679
|
2710
|
#elif (X_PROBE_OFFSET_FROM_EXTRUDER < 0)
|
2680
|
2711
|
SERIAL_ECHOPGM(" (Left");
|
|
2712
|
+ #elif (Y_PROBE_OFFSET_FROM_EXTRUDER != 0)
|
|
2713
|
+ SERIAL_ECHOPGM(" (Middle");
|
|
2714
|
+ #else
|
|
2715
|
+ SERIAL_ECHOPGM(" (Aligned With");
|
2681
|
2716
|
#endif
|
2682
|
2717
|
#if (Y_PROBE_OFFSET_FROM_EXTRUDER > 0)
|
2683
|
2718
|
SERIAL_ECHOPGM("-Back");
|
2684
|
2719
|
#elif (Y_PROBE_OFFSET_FROM_EXTRUDER < 0)
|
2685
|
2720
|
SERIAL_ECHOPGM("-Front");
|
|
2721
|
+ #elif (X_PROBE_OFFSET_FROM_EXTRUDER != 0)
|
|
2722
|
+ SERIAL_ECHOPGM("-Center");
|
2686
|
2723
|
#endif
|
2687
|
2724
|
if (zprobe_zoffset < 0)
|
2688
|
2725
|
SERIAL_ECHOPGM(" & Below");
|
|
@@ -3295,8 +3332,8 @@ inline void gcode_G28() {
|
3295
|
3332
|
return;
|
3296
|
3333
|
}
|
3297
|
3334
|
|
3298
|
|
- bool dryrun = code_seen('D');
|
3299
|
|
- bool stow_probe_after_each = code_seen('E');
|
|
3335
|
+ bool dryrun = code_seen('D'),
|
|
3336
|
+ stow_probe_after_each = code_seen('E');
|
3300
|
3337
|
|
3301
|
3338
|
#if ENABLED(AUTO_BED_LEVELING_GRID)
|
3302
|
3339
|
|
|
@@ -3386,7 +3423,6 @@ inline void gcode_G28() {
|
3386
|
3423
|
#endif // !DELTA
|
3387
|
3424
|
|
3388
|
3425
|
// Inform the planner about the new coordinates
|
3389
|
|
- // (This is probably not needed here)
|
3390
|
3426
|
SYNC_PLAN_POSITION_KINEMATIC();
|
3391
|
3427
|
}
|
3392
|
3428
|
|
|
@@ -3759,11 +3795,11 @@ inline void gcode_G28() {
|
3759
|
3795
|
* G92: Set current position to given X Y Z E
|
3760
|
3796
|
*/
|
3761
|
3797
|
inline void gcode_G92() {
|
3762
|
|
- bool didE = code_seen('E');
|
|
3798
|
+ bool didXYZ = false,
|
|
3799
|
+ didE = code_seen('E');
|
3763
|
3800
|
|
3764
|
3801
|
if (!didE) stepper.synchronize();
|
3765
|
3802
|
|
3766
|
|
- bool didXYZ = false;
|
3767
|
3803
|
LOOP_XYZE(i) {
|
3768
|
3804
|
if (code_seen(axis_codes[i])) {
|
3769
|
3805
|
float p = current_position[i],
|
|
@@ -4148,7 +4184,7 @@ inline void gcode_M42() {
|
4148
|
4184
|
if (verbose_level > 2)
|
4149
|
4185
|
SERIAL_PROTOCOLLNPGM("Positioning the probe...");
|
4150
|
4186
|
|
4151
|
|
- // we don't do bed level correction in M48 because we want the raw data when we probe
|
|
4187
|
+ // Disable bed level correction in M48 because we want the raw data when we probe
|
4152
|
4188
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
4153
|
4189
|
reset_bed_level();
|
4154
|
4190
|
#endif
|
|
@@ -5745,9 +5781,8 @@ inline void gcode_M303() {
|
5745
|
5781
|
}
|
5746
|
5782
|
|
5747
|
5783
|
#if ENABLED(MORGAN_SCARA)
|
|
5784
|
+
|
5748
|
5785
|
bool SCARA_move_to_cal(uint8_t delta_a, uint8_t delta_b) {
|
5749
|
|
- //SoftEndsEnabled = false; // Ignore soft endstops during calibration
|
5750
|
|
- //SERIAL_ECHOLNPGM(" Soft endstops disabled");
|
5751
|
5786
|
if (IsRunning()) {
|
5752
|
5787
|
//gcode_get_destination(); // For X Y Z E F
|
5753
|
5788
|
forward_kinematics_SCARA(delta_a, delta_b);
|
|
@@ -5755,7 +5790,6 @@ inline void gcode_M303() {
|
5755
|
5790
|
destination[Y_AXIS] = cartes[Y_AXIS];
|
5756
|
5791
|
destination[Z_AXIS] = current_position[Z_AXIS];
|
5757
|
5792
|
prepare_move_to_destination();
|
5758
|
|
- //ok_to_send();
|
5759
|
5793
|
return true;
|
5760
|
5794
|
}
|
5761
|
5795
|
return false;
|
|
@@ -7875,7 +7909,7 @@ void get_cartesian_from_steppers() {
|
7875
|
7909
|
*
|
7876
|
7910
|
* << INCOMPLETE! Still needs to unapply leveling! >>
|
7877
|
7911
|
*/
|
7878
|
|
-void set_current_from_steppers_for_axis(AxisEnum axis) {
|
|
7912
|
+void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
7879
|
7913
|
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
7880
|
7914
|
vector_3 pos = untilted_stepper_position();
|
7881
|
7915
|
current_position[axis] = axis == X_AXIS ? pos.x : axis == Y_AXIS ? pos.y : pos.z;
|
|
@@ -7948,7 +7982,7 @@ void set_current_from_steppers_for_axis(AxisEnum axis) {
|
7948
|
7982
|
mesh_line_to_destination(fr_mm_s, x_splits, y_splits);
|
7949
|
7983
|
}
|
7950
|
7984
|
|
7951
|
|
-#endif // MESH_BED_LEVELING
|
|
7985
|
+#endif // MESH_BED_LEVELING
|
7952
|
7986
|
|
7953
|
7987
|
#if IS_KINEMATIC
|
7954
|
7988
|
|