|
@@ -331,10 +331,6 @@ float position_shift[3] = { 0 };
|
331
|
331
|
// Set by M206, M428, or menu item. Saved to EEPROM.
|
332
|
332
|
float home_offset[3] = { 0 };
|
333
|
333
|
|
334
|
|
-#define LOGICAL_POSITION(POS, AXIS) (POS + home_offset[AXIS] + position_shift[AXIS])
|
335
|
|
-#define RAW_POSITION(POS, AXIS) (POS - home_offset[AXIS] - position_shift[AXIS])
|
336
|
|
-#define RAW_CURRENT_POSITION(AXIS) (RAW_POSITION(current_position[AXIS], AXIS))
|
337
|
|
-
|
338
|
334
|
// Software Endstops. Default to configured limits.
|
339
|
335
|
float sw_endstop_min[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
|
340
|
336
|
float sw_endstop_max[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
|
|
@@ -1408,7 +1404,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
|
1408
|
1404
|
|
1409
|
1405
|
static float x_home_pos(int extruder) {
|
1410
|
1406
|
if (extruder == 0)
|
1411
|
|
- return LOGICAL_POSITION(base_home_pos(X_AXIS), X_AXIS);
|
|
1407
|
+ return LOGICAL_X_POSITION(base_home_pos(X_AXIS));
|
1412
|
1408
|
else
|
1413
|
1409
|
/**
|
1414
|
1410
|
* In dual carriage mode the extruder offset provides an override of the
|
|
@@ -1513,7 +1509,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
1513
|
1509
|
if (active_extruder != 0)
|
1514
|
1510
|
current_position[X_AXIS] = x_home_pos(active_extruder);
|
1515
|
1511
|
else
|
1516
|
|
- current_position[X_AXIS] = LOGICAL_POSITION(base_home_pos(X_AXIS), X_AXIS);
|
|
1512
|
+ current_position[X_AXIS] = LOGICAL_X_POSITION(base_home_pos(X_AXIS));
|
1517
|
1513
|
update_software_endstops(X_AXIS);
|
1518
|
1514
|
return;
|
1519
|
1515
|
}
|
|
@@ -1803,7 +1799,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
1803
|
1799
|
SERIAL_ECHOLNPGM(")");
|
1804
|
1800
|
}
|
1805
|
1801
|
#endif
|
1806
|
|
- float z_dest = LOGICAL_POSITION(z_raise, Z_AXIS);
|
|
1802
|
+ float z_dest = LOGICAL_Z_POSITION(z_raise);
|
1807
|
1803
|
|
1808
|
1804
|
if (zprobe_zoffset < 0)
|
1809
|
1805
|
z_dest -= zprobe_zoffset;
|
|
@@ -2964,7 +2960,7 @@ inline void gcode_G28() {
|
2964
|
2960
|
|
2965
|
2961
|
if (home_all_axis || homeX || homeY) {
|
2966
|
2962
|
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
2967
|
|
- destination[Z_AXIS] = LOGICAL_POSITION(MIN_Z_HEIGHT_FOR_HOMING, Z_AXIS);
|
|
2963
|
+ destination[Z_AXIS] = LOGICAL_Z_POSITION(MIN_Z_HEIGHT_FOR_HOMING);
|
2968
|
2964
|
if (destination[Z_AXIS] > current_position[Z_AXIS]) {
|
2969
|
2965
|
|
2970
|
2966
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
@@ -3218,12 +3214,12 @@ inline void gcode_G28() {
|
3218
|
3214
|
;
|
3219
|
3215
|
line_to_current_position();
|
3220
|
3216
|
|
3221
|
|
- current_position[X_AXIS] = LOGICAL_POSITION(x, X_AXIS);
|
3222
|
|
- current_position[Y_AXIS] = LOGICAL_POSITION(y, Y_AXIS);
|
|
3217
|
+ current_position[X_AXIS] = LOGICAL_X_POSITION(x);
|
|
3218
|
+ current_position[Y_AXIS] = LOGICAL_Y_POSITION(y);
|
3223
|
3219
|
line_to_current_position();
|
3224
|
3220
|
|
3225
|
3221
|
#if Z_RAISE_BETWEEN_PROBINGS > 0 || MIN_Z_HEIGHT_FOR_HOMING > 0
|
3226
|
|
- current_position[Z_AXIS] = LOGICAL_POSITION(MESH_HOME_SEARCH_Z, Z_AXIS);
|
|
3222
|
+ current_position[Z_AXIS] = LOGICAL_Z_POSITION(MESH_HOME_SEARCH_Z);
|
3227
|
3223
|
line_to_current_position();
|
3228
|
3224
|
#endif
|
3229
|
3225
|
|
|
@@ -3641,14 +3637,14 @@ inline void gcode_G28() {
|
3641
|
3637
|
#endif
|
3642
|
3638
|
|
3643
|
3639
|
// Probe at 3 arbitrary points
|
3644
|
|
- float z_at_pt_1 = probe_pt( LOGICAL_POSITION(ABL_PROBE_PT_1_X, X_AXIS),
|
3645
|
|
- LOGICAL_POSITION(ABL_PROBE_PT_1_Y, Y_AXIS),
|
|
3640
|
+ float z_at_pt_1 = probe_pt( LOGICAL_X_POSITION(ABL_PROBE_PT_1_X, X_AXIS),
|
|
3641
|
+ LOGICAL_Y_POSITION(ABL_PROBE_PT_1_Y, Y_AXIS),
|
3646
|
3642
|
stow_probe_after_each, verbose_level),
|
3647
|
|
- z_at_pt_2 = probe_pt( LOGICAL_POSITION(ABL_PROBE_PT_2_X, X_AXIS),
|
3648
|
|
- LOGICAL_POSITION(ABL_PROBE_PT_2_Y, Y_AXIS),
|
|
3643
|
+ z_at_pt_2 = probe_pt( LOGICAL_X_POSITION(ABL_PROBE_PT_2_X, X_AXIS),
|
|
3644
|
+ LOGICAL_Y_POSITION(ABL_PROBE_PT_2_Y, Y_AXIS),
|
3649
|
3645
|
stow_probe_after_each, verbose_level),
|
3650
|
|
- z_at_pt_3 = probe_pt( LOGICAL_POSITION(ABL_PROBE_PT_3_X, X_AXIS),
|
3651
|
|
- LOGICAL_POSITION(ABL_PROBE_PT_3_Y, Y_AXIS),
|
|
3646
|
+ z_at_pt_3 = probe_pt( LOGICAL_X_POSITION(ABL_PROBE_PT_3_X, X_AXIS),
|
|
3647
|
+ LOGICAL_Y_POSITION(ABL_PROBE_PT_3_Y, Y_AXIS),
|
3652
|
3648
|
stow_probe_after_each, verbose_level);
|
3653
|
3649
|
|
3654
|
3650
|
if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
|
@@ -7748,9 +7744,9 @@ void clamp_to_software_endstops(float target[3]) {
|
7748
|
7744
|
void inverse_kinematics(const float in_cartesian[3]) {
|
7749
|
7745
|
|
7750
|
7746
|
const float cartesian[3] = {
|
7751
|
|
- RAW_POSITION(in_cartesian[X_AXIS], X_AXIS),
|
7752
|
|
- RAW_POSITION(in_cartesian[Y_AXIS], Y_AXIS),
|
7753
|
|
- RAW_POSITION(in_cartesian[Z_AXIS], Z_AXIS)
|
|
7747
|
+ RAW_X_POSITION(in_cartesian[X_AXIS]),
|
|
7748
|
+ RAW_Y_POSITION(in_cartesian[Y_AXIS]),
|
|
7749
|
+ RAW_Z_POSITION(in_cartesian[Z_AXIS])
|
7754
|
7750
|
};
|
7755
|
7751
|
|
7756
|
7752
|
delta[TOWER_1] = sqrt(delta_diagonal_rod_2_tower_1
|
|
@@ -7778,13 +7774,13 @@ void clamp_to_software_endstops(float target[3]) {
|
7778
|
7774
|
|
7779
|
7775
|
float delta_safe_distance_from_top() {
|
7780
|
7776
|
float cartesian[3] = {
|
7781
|
|
- LOGICAL_POSITION(0, X_AXIS),
|
7782
|
|
- LOGICAL_POSITION(0, Y_AXIS),
|
7783
|
|
- LOGICAL_POSITION(0, Z_AXIS)
|
|
7777
|
+ LOGICAL_X_POSITION(0),
|
|
7778
|
+ LOGICAL_Y_POSITION(0),
|
|
7779
|
+ LOGICAL_Z_POSITION(0)
|
7784
|
7780
|
};
|
7785
|
7781
|
inverse_kinematics(cartesian);
|
7786
|
7782
|
float distance = delta[TOWER_3];
|
7787
|
|
- cartesian[Y_AXIS] = LOGICAL_POSITION(DELTA_PRINTABLE_RADIUS, Y_AXIS);
|
|
7783
|
+ cartesian[Y_AXIS] = LOGICAL_Y_POSITION(DELTA_PRINTABLE_RADIUS);
|
7788
|
7784
|
inverse_kinematics(cartesian);
|
7789
|
7785
|
return abs(distance - delta[TOWER_3]);
|
7790
|
7786
|
}
|
|
@@ -7876,8 +7872,8 @@ void clamp_to_software_endstops(float target[3]) {
|
7876
|
7872
|
|
7877
|
7873
|
int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2;
|
7878
|
7874
|
float h1 = 0.001 - half, h2 = half - 0.001,
|
7879
|
|
- grid_x = max(h1, min(h2, RAW_POSITION(cartesian[X_AXIS], X_AXIS) / delta_grid_spacing[0])),
|
7880
|
|
- grid_y = max(h1, min(h2, RAW_POSITION(cartesian[Y_AXIS], Y_AXIS) / delta_grid_spacing[1]));
|
|
7875
|
+ grid_x = max(h1, min(h2, RAW_X_POSITION(cartesian[X_AXIS]) / delta_grid_spacing[0])),
|
|
7876
|
+ grid_y = max(h1, min(h2, RAW_Y_POSITION(cartesian[Y_AXIS]) / delta_grid_spacing[1]));
|
7881
|
7877
|
int floor_x = floor(grid_x), floor_y = floor(grid_y);
|
7882
|
7878
|
float ratio_x = grid_x - floor_x, ratio_y = grid_y - floor_y,
|
7883
|
7879
|
z1 = bed_level[floor_x + half][floor_y + half],
|
|
@@ -7918,9 +7914,9 @@ void set_current_from_steppers_for_axis(AxisEnum axis) {
|
7918
|
7914
|
current_position[axis] = LOGICAL_POSITION(cartesian_position[axis], axis);
|
7919
|
7915
|
#elif ENABLED(AUTO_BED_LEVELING_FEATURE)
|
7920
|
7916
|
vector_3 pos = planner.adjusted_position();
|
7921
|
|
- current_position[axis] = LOGICAL_POSITION(axis == X_AXIS ? pos.x : axis == Y_AXIS ? pos.y : pos.z, axis);
|
|
7917
|
+ current_position[axis] = axis == X_AXIS ? pos.x : axis == Y_AXIS ? pos.y : pos.z;
|
7922
|
7918
|
#else
|
7923
|
|
- current_position[axis] = LOGICAL_POSITION(stepper.get_axis_position_mm(axis), axis); // CORE handled transparently
|
|
7919
|
+ current_position[axis] = stepper.get_axis_position_mm(axis); // CORE handled transparently
|
7924
|
7920
|
#endif
|
7925
|
7921
|
}
|
7926
|
7922
|
|
|
@@ -7930,8 +7926,8 @@ void set_current_from_steppers_for_axis(AxisEnum axis) {
|
7930
|
7926
|
void mesh_line_to_destination(float fr_mm_m, uint8_t x_splits = 0xff, uint8_t y_splits = 0xff) {
|
7931
|
7927
|
int cx1 = mbl.cell_index_x(RAW_CURRENT_POSITION(X_AXIS)),
|
7932
|
7928
|
cy1 = mbl.cell_index_y(RAW_CURRENT_POSITION(Y_AXIS)),
|
7933
|
|
- cx2 = mbl.cell_index_x(RAW_POSITION(destination[X_AXIS], X_AXIS)),
|
7934
|
|
- cy2 = mbl.cell_index_y(RAW_POSITION(destination[Y_AXIS], Y_AXIS));
|
|
7929
|
+ cx2 = mbl.cell_index_x(RAW_X_POSITION(destination[X_AXIS])),
|
|
7930
|
+ cy2 = mbl.cell_index_y(RAW_Y_POSITION(destination[Y_AXIS]));
|
7935
|
7931
|
NOMORE(cx1, MESH_NUM_X_POINTS - 2);
|
7936
|
7932
|
NOMORE(cy1, MESH_NUM_Y_POINTS - 2);
|
7937
|
7933
|
NOMORE(cx2, MESH_NUM_X_POINTS - 2);
|
|
@@ -7952,14 +7948,14 @@ void mesh_line_to_destination(float fr_mm_m, uint8_t x_splits = 0xff, uint8_t y_
|
7952
|
7948
|
int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2);
|
7953
|
7949
|
if (cx2 != cx1 && TEST(x_splits, gcx)) {
|
7954
|
7950
|
memcpy(end, destination, sizeof(end));
|
7955
|
|
- destination[X_AXIS] = LOGICAL_POSITION(mbl.get_probe_x(gcx), X_AXIS);
|
|
7951
|
+ destination[X_AXIS] = LOGICAL_X_POSITION(mbl.get_probe_x(gcx));
|
7956
|
7952
|
normalized_dist = (destination[X_AXIS] - current_position[X_AXIS]) / (end[X_AXIS] - current_position[X_AXIS]);
|
7957
|
7953
|
destination[Y_AXIS] = MBL_SEGMENT_END(Y);
|
7958
|
7954
|
CBI(x_splits, gcx);
|
7959
|
7955
|
}
|
7960
|
7956
|
else if (cy2 != cy1 && TEST(y_splits, gcy)) {
|
7961
|
7957
|
memcpy(end, destination, sizeof(end));
|
7962
|
|
- destination[Y_AXIS] = LOGICAL_POSITION(mbl.get_probe_y(gcy), Y_AXIS);
|
|
7958
|
+ destination[Y_AXIS] = LOGICAL_Y_POSITION(mbl.get_probe_y(gcy));
|
7963
|
7959
|
normalized_dist = (destination[Y_AXIS] - current_position[Y_AXIS]) / (end[Y_AXIS] - current_position[Y_AXIS]);
|
7964
|
7960
|
destination[X_AXIS] = MBL_SEGMENT_END(X);
|
7965
|
7961
|
CBI(y_splits, gcy);
|
|
@@ -8374,8 +8370,8 @@ void prepare_move_to_destination() {
|
8374
|
8370
|
float SCARA_pos[2];
|
8375
|
8371
|
static float SCARA_C2, SCARA_S2, SCARA_K1, SCARA_K2, SCARA_theta, SCARA_psi;
|
8376
|
8372
|
|
8377
|
|
- SCARA_pos[X_AXIS] = RAW_POSITION(cartesian[X_AXIS], X_AXIS) * axis_scaling[X_AXIS] - SCARA_offset_x; //Translate SCARA to standard X Y
|
8378
|
|
- SCARA_pos[Y_AXIS] = RAW_POSITION(cartesian[Y_AXIS], Y_AXIS) * axis_scaling[Y_AXIS] - SCARA_offset_y; // With scaling factor.
|
|
8373
|
+ SCARA_pos[X_AXIS] = RAW_X_POSITION(cartesian[X_AXIS]) * axis_scaling[X_AXIS] - SCARA_offset_x; //Translate SCARA to standard X Y
|
|
8374
|
+ SCARA_pos[Y_AXIS] = RAW_Y_POSITION(cartesian[Y_AXIS]) * axis_scaling[Y_AXIS] - SCARA_offset_y; // With scaling factor.
|
8379
|
8375
|
|
8380
|
8376
|
#if (Linkage_1 == Linkage_2)
|
8381
|
8377
|
SCARA_C2 = ((sq(SCARA_pos[X_AXIS]) + sq(SCARA_pos[Y_AXIS])) / (2 * (float)L1_2)) - 1;
|
|
@@ -8393,7 +8389,7 @@ void prepare_move_to_destination() {
|
8393
|
8389
|
|
8394
|
8390
|
delta[X_AXIS] = SCARA_theta * SCARA_RAD2DEG; // Multiply by 180/Pi - theta is support arm angle
|
8395
|
8391
|
delta[Y_AXIS] = (SCARA_theta + SCARA_psi) * SCARA_RAD2DEG; // - equal to sub arm angle (inverted motor)
|
8396
|
|
- delta[Z_AXIS] = RAW_POSITION(cartesian[Z_AXIS], Z_AXIS);
|
|
8392
|
+ delta[Z_AXIS] = RAW_Z_POSITION(cartesian[Z_AXIS]);
|
8397
|
8393
|
|
8398
|
8394
|
/**
|
8399
|
8395
|
SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]);
|