Implement NO_WORKSPACE_OFFSETS
This commit is contained in:
parent
05abe853f9
commit
5f7e85398b
@ -275,27 +275,18 @@ extern volatile bool wait_for_heatup;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern float current_position[NUM_AXIS];
|
extern float current_position[NUM_AXIS];
|
||||||
extern float position_shift[XYZ];
|
|
||||||
extern float home_offset[XYZ];
|
|
||||||
|
|
||||||
#if HOTENDS > 1
|
// Workspace offsets
|
||||||
extern float hotend_offset[XYZ][HOTENDS];
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
#endif
|
extern float position_shift[XYZ];
|
||||||
|
extern float home_offset[XYZ];
|
||||||
// Software Endstops
|
#define LOGICAL_POSITION(POS, AXIS) ((POS) + home_offset[AXIS] + position_shift[AXIS])
|
||||||
void update_software_endstops(AxisEnum axis);
|
#define RAW_POSITION(POS, AXIS) ((POS) - home_offset[AXIS] - position_shift[AXIS])
|
||||||
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
|
|
||||||
extern bool soft_endstops_enabled;
|
|
||||||
void clamp_to_software_endstops(float target[XYZ]);
|
|
||||||
#else
|
#else
|
||||||
#define soft_endstops_enabled false
|
#define LOGICAL_POSITION(POS, AXIS) (POS)
|
||||||
#define clamp_to_software_endstops(x) NOOP
|
#define RAW_POSITION(POS, AXIS) (POS)
|
||||||
#endif
|
#endif
|
||||||
extern float soft_endstop_min[XYZ];
|
|
||||||
extern float soft_endstop_max[XYZ];
|
|
||||||
|
|
||||||
#define LOGICAL_POSITION(POS, AXIS) ((POS) + home_offset[AXIS] + position_shift[AXIS])
|
|
||||||
#define RAW_POSITION(POS, AXIS) ((POS) - home_offset[AXIS] - position_shift[AXIS])
|
|
||||||
#define LOGICAL_X_POSITION(POS) LOGICAL_POSITION(POS, X_AXIS)
|
#define LOGICAL_X_POSITION(POS) LOGICAL_POSITION(POS, X_AXIS)
|
||||||
#define LOGICAL_Y_POSITION(POS) LOGICAL_POSITION(POS, Y_AXIS)
|
#define LOGICAL_Y_POSITION(POS) LOGICAL_POSITION(POS, Y_AXIS)
|
||||||
#define LOGICAL_Z_POSITION(POS) LOGICAL_POSITION(POS, Z_AXIS)
|
#define LOGICAL_Z_POSITION(POS) LOGICAL_POSITION(POS, Z_AXIS)
|
||||||
@ -304,6 +295,26 @@ extern float soft_endstop_max[XYZ];
|
|||||||
#define RAW_Z_POSITION(POS) RAW_POSITION(POS, Z_AXIS)
|
#define RAW_Z_POSITION(POS) RAW_POSITION(POS, Z_AXIS)
|
||||||
#define RAW_CURRENT_POSITION(AXIS) RAW_POSITION(current_position[AXIS], AXIS)
|
#define RAW_CURRENT_POSITION(AXIS) RAW_POSITION(current_position[AXIS], AXIS)
|
||||||
|
|
||||||
|
#if HOTENDS > 1
|
||||||
|
extern float hotend_offset[XYZ][HOTENDS];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Software Endstops
|
||||||
|
extern float soft_endstop_min[XYZ];
|
||||||
|
extern float soft_endstop_max[XYZ];
|
||||||
|
|
||||||
|
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
|
||||||
|
extern bool soft_endstops_enabled;
|
||||||
|
void clamp_to_software_endstops(float target[XYZ]);
|
||||||
|
#else
|
||||||
|
#define soft_endstops_enabled false
|
||||||
|
#define clamp_to_software_endstops(x) NOOP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
|
||||||
|
void update_software_endstops(const AxisEnum axis);
|
||||||
|
#endif
|
||||||
|
|
||||||
// GCode support for external objects
|
// GCode support for external objects
|
||||||
bool code_seen(char);
|
bool code_seen(char);
|
||||||
int code_value_int();
|
int code_value_int();
|
||||||
|
@ -396,12 +396,16 @@ bool axis_relative_modes[] = AXIS_RELATIVE_MODES,
|
|||||||
float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA),
|
float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA),
|
||||||
volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
|
volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
|
||||||
|
|
||||||
// The distance that XYZ has been offset by G92. Reset by G28.
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
float position_shift[XYZ] = { 0 };
|
|
||||||
|
|
||||||
// This offset is added to the configured home position.
|
// The distance that XYZ has been offset by G92. Reset by G28.
|
||||||
// Set by M206, M428, or menu item. Saved to EEPROM.
|
float position_shift[XYZ] = { 0 };
|
||||||
float home_offset[XYZ] = { 0 };
|
|
||||||
|
// This offset is added to the configured home position.
|
||||||
|
// Set by M206, M428, or menu item. Saved to EEPROM.
|
||||||
|
float home_offset[XYZ] = { 0 };
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// Software Endstops are based on the configured limits.
|
// Software Endstops are based on the configured limits.
|
||||||
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
|
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
|
||||||
@ -1333,76 +1337,83 @@ bool get_target_extruder_from_command(int code) {
|
|||||||
|
|
||||||
#endif // DUAL_X_CARRIAGE
|
#endif // DUAL_X_CARRIAGE
|
||||||
|
|
||||||
/**
|
#if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
|
||||||
* Software endstops can be used to monitor the open end of
|
|
||||||
* an axis that has a hardware endstop on the other end. Or
|
|
||||||
* they can prevent axes from moving past endstops and grinding.
|
|
||||||
*
|
|
||||||
* To keep doing their job as the coordinate system changes,
|
|
||||||
* the software endstop positions must be refreshed to remain
|
|
||||||
* at the same positions relative to the machine.
|
|
||||||
*/
|
|
||||||
void update_software_endstops(AxisEnum axis) {
|
|
||||||
float offs = LOGICAL_POSITION(0, axis);
|
|
||||||
|
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
/**
|
||||||
if (axis == X_AXIS) {
|
* Software endstops can be used to monitor the open end of
|
||||||
|
* an axis that has a hardware endstop on the other end. Or
|
||||||
|
* they can prevent axes from moving past endstops and grinding.
|
||||||
|
*
|
||||||
|
* To keep doing their job as the coordinate system changes,
|
||||||
|
* the software endstop positions must be refreshed to remain
|
||||||
|
* at the same positions relative to the machine.
|
||||||
|
*/
|
||||||
|
void update_software_endstops(const AxisEnum axis) {
|
||||||
|
const float offs = LOGICAL_POSITION(0, axis);
|
||||||
|
|
||||||
// In Dual X mode hotend_offset[X] is T1's home position
|
#if ENABLED(DUAL_X_CARRIAGE)
|
||||||
float dual_max_x = max(hotend_offset[X_AXIS][1], X2_MAX_POS);
|
if (axis == X_AXIS) {
|
||||||
|
|
||||||
if (active_extruder != 0) {
|
// In Dual X mode hotend_offset[X] is T1's home position
|
||||||
// T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger)
|
float dual_max_x = max(hotend_offset[X_AXIS][1], X2_MAX_POS);
|
||||||
soft_endstop_min[X_AXIS] = X2_MIN_POS + offs;
|
|
||||||
soft_endstop_max[X_AXIS] = dual_max_x + offs;
|
if (active_extruder != 0) {
|
||||||
|
// T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger)
|
||||||
|
soft_endstop_min[X_AXIS] = X2_MIN_POS + offs;
|
||||||
|
soft_endstop_max[X_AXIS] = dual_max_x + offs;
|
||||||
|
}
|
||||||
|
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
|
||||||
|
// In Duplication Mode, T0 can move as far left as X_MIN_POS
|
||||||
|
// but not so far to the right that T1 would move past the end
|
||||||
|
soft_endstop_min[X_AXIS] = base_min_pos(X_AXIS) + offs;
|
||||||
|
soft_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// In other modes, T0 can move from X_MIN_POS to X_MAX_POS
|
||||||
|
soft_endstop_min[axis] = base_min_pos(axis) + offs;
|
||||||
|
soft_endstop_max[axis] = base_max_pos(axis) + offs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
|
#else
|
||||||
// In Duplication Mode, T0 can move as far left as X_MIN_POS
|
soft_endstop_min[axis] = base_min_pos(axis) + offs;
|
||||||
// but not so far to the right that T1 would move past the end
|
soft_endstop_max[axis] = base_max_pos(axis) + offs;
|
||||||
soft_endstop_min[X_AXIS] = base_min_pos(X_AXIS) + offs;
|
#endif
|
||||||
soft_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs;
|
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) {
|
||||||
|
SERIAL_ECHOPAIR("For ", axis_codes[axis]);
|
||||||
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
|
SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]);
|
||||||
|
SERIAL_ECHOPAIR("\n position_shift = ", position_shift[axis]);
|
||||||
|
#endif
|
||||||
|
SERIAL_ECHOPAIR("\n soft_endstop_min = ", soft_endstop_min[axis]);
|
||||||
|
SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]);
|
||||||
}
|
}
|
||||||
else {
|
#endif
|
||||||
// In other modes, T0 can move from X_MIN_POS to X_MAX_POS
|
|
||||||
soft_endstop_min[axis] = base_min_pos(axis) + offs;
|
|
||||||
soft_endstop_max[axis] = base_max_pos(axis) + offs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
soft_endstop_min[axis] = base_min_pos(axis) + offs;
|
|
||||||
soft_endstop_max[axis] = base_max_pos(axis) + offs;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DELTA)
|
||||||
if (DEBUGGING(LEVELING)) {
|
if (axis == Z_AXIS)
|
||||||
SERIAL_ECHOPAIR("For ", axis_codes[axis]);
|
delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top();
|
||||||
SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]);
|
#endif
|
||||||
SERIAL_ECHOPAIR("\n position_shift = ", position_shift[axis]);
|
}
|
||||||
SERIAL_ECHOPAIR("\n soft_endstop_min = ", soft_endstop_min[axis]);
|
|
||||||
SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(DELTA)
|
#endif // NO_WORKSPACE_OFFSETS
|
||||||
if (axis == Z_AXIS)
|
|
||||||
delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
|
/**
|
||||||
/**
|
* Change the home offset for an axis, update the current
|
||||||
* Change the home offset for an axis, update the current
|
* position and the software endstops to retain the same
|
||||||
* position and the software endstops to retain the same
|
* relative distance to the new home.
|
||||||
* relative distance to the new home.
|
*
|
||||||
*
|
* Since this changes the current_position, code should
|
||||||
* Since this changes the current_position, code should
|
* call sync_plan_position soon after this.
|
||||||
* call sync_plan_position soon after this.
|
*/
|
||||||
*/
|
static void set_home_offset(AxisEnum axis, float v) {
|
||||||
static void set_home_offset(AxisEnum axis, float v) {
|
current_position[axis] += v - home_offset[axis];
|
||||||
current_position[axis] += v - home_offset[axis];
|
home_offset[axis] = v;
|
||||||
home_offset[axis] = v;
|
update_software_endstops(axis);
|
||||||
update_software_endstops(axis);
|
}
|
||||||
}
|
#endif // NO_WORKSPACE_OFFSETS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an axis' current position to its home position (after homing).
|
* Set an axis' current position to its home position (after homing).
|
||||||
@ -1433,8 +1444,10 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
|||||||
|
|
||||||
axis_known_position[axis] = axis_homed[axis] = true;
|
axis_known_position[axis] = axis_homed[axis] = true;
|
||||||
|
|
||||||
position_shift[axis] = 0;
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
update_software_endstops(axis);
|
position_shift[axis] = 0;
|
||||||
|
update_software_endstops(axis);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
#if ENABLED(DUAL_X_CARRIAGE)
|
||||||
if (axis == X_AXIS && (active_extruder == 1 || dual_x_carriage_mode == DXC_DUPLICATION_MODE)) {
|
if (axis == X_AXIS && (active_extruder == 1 || dual_x_carriage_mode == DXC_DUPLICATION_MODE)) {
|
||||||
@ -1507,8 +1520,10 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
|||||||
|
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) {
|
if (DEBUGGING(LEVELING)) {
|
||||||
SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]);
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
SERIAL_ECHOLNPAIR("] = ", home_offset[axis]);
|
SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]);
|
||||||
|
SERIAL_ECHOLNPAIR("] = ", home_offset[axis]);
|
||||||
|
#endif
|
||||||
DEBUG_POS("", current_position);
|
DEBUG_POS("", current_position);
|
||||||
SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis_codes[axis]);
|
SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis_codes[axis]);
|
||||||
SERIAL_CHAR(')');
|
SERIAL_CHAR(')');
|
||||||
@ -4603,8 +4618,10 @@ inline void gcode_G92() {
|
|||||||
|
|
||||||
if (i != E_AXIS) {
|
if (i != E_AXIS) {
|
||||||
didXYZ = true;
|
didXYZ = true;
|
||||||
position_shift[i] += v - p; // Offset the coordinate space
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
update_software_endstops((AxisEnum)i);
|
position_shift[i] += v - p; // Offset the coordinate space
|
||||||
|
update_software_endstops((AxisEnum)i);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -6334,22 +6351,26 @@ inline void gcode_M205() {
|
|||||||
if (code_seen('E')) planner.max_jerk[E_AXIS] = code_value_axis_units(E_AXIS);
|
if (code_seen('E')) planner.max_jerk[E_AXIS] = code_value_axis_units(E_AXIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
|
|
||||||
*/
|
|
||||||
inline void gcode_M206() {
|
|
||||||
LOOP_XYZ(i)
|
|
||||||
if (code_seen(axis_codes[i]))
|
|
||||||
set_home_offset((AxisEnum)i, code_value_axis_units(i));
|
|
||||||
|
|
||||||
#if ENABLED(MORGAN_SCARA)
|
/**
|
||||||
if (code_seen('T')) set_home_offset(A_AXIS, code_value_axis_units(A_AXIS)); // Theta
|
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
|
||||||
if (code_seen('P')) set_home_offset(B_AXIS, code_value_axis_units(B_AXIS)); // Psi
|
*/
|
||||||
#endif
|
inline void gcode_M206() {
|
||||||
|
LOOP_XYZ(i)
|
||||||
|
if (code_seen(axis_codes[i]))
|
||||||
|
set_home_offset((AxisEnum)i, code_value_axis_units(i));
|
||||||
|
|
||||||
SYNC_PLAN_POSITION_KINEMATIC();
|
#if ENABLED(MORGAN_SCARA)
|
||||||
report_current_position();
|
if (code_seen('T')) set_home_offset(A_AXIS, code_value_axis_units(A_AXIS)); // Theta
|
||||||
}
|
if (code_seen('P')) set_home_offset(B_AXIS, code_value_axis_units(B_AXIS)); // Psi
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SYNC_PLAN_POSITION_KINEMATIC();
|
||||||
|
report_current_position();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // NO_WORKSPACE_OFFSETS
|
||||||
|
|
||||||
#if ENABLED(DELTA)
|
#if ENABLED(DELTA)
|
||||||
/**
|
/**
|
||||||
@ -7173,45 +7194,49 @@ void quickstop_stepper() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
* M428: Set home_offset based on the distance between the
|
|
||||||
* current_position and the nearest "reference point."
|
/**
|
||||||
* If an axis is past center its endstop position
|
* M428: Set home_offset based on the distance between the
|
||||||
* is the reference-point. Otherwise it uses 0. This allows
|
* current_position and the nearest "reference point."
|
||||||
* the Z offset to be set near the bed when using a max endstop.
|
* If an axis is past center its endstop position
|
||||||
*
|
* is the reference-point. Otherwise it uses 0. This allows
|
||||||
* M428 can't be used more than 2cm away from 0 or an endstop.
|
* the Z offset to be set near the bed when using a max endstop.
|
||||||
*
|
*
|
||||||
* Use M206 to set these values directly.
|
* M428 can't be used more than 2cm away from 0 or an endstop.
|
||||||
*/
|
*
|
||||||
inline void gcode_M428() {
|
* Use M206 to set these values directly.
|
||||||
bool err = false;
|
*/
|
||||||
LOOP_XYZ(i) {
|
inline void gcode_M428() {
|
||||||
if (axis_homed[i]) {
|
bool err = false;
|
||||||
float base = (current_position[i] > (soft_endstop_min[i] + soft_endstop_max[i]) * 0.5) ? base_home_pos((AxisEnum)i) : 0,
|
LOOP_XYZ(i) {
|
||||||
diff = current_position[i] - LOGICAL_POSITION(base, i);
|
if (axis_homed[i]) {
|
||||||
if (diff > -20 && diff < 20) {
|
float base = (current_position[i] > (soft_endstop_min[i] + soft_endstop_max[i]) * 0.5) ? base_home_pos((AxisEnum)i) : 0,
|
||||||
set_home_offset((AxisEnum)i, home_offset[i] - diff);
|
diff = current_position[i] - LOGICAL_POSITION(base, i);
|
||||||
}
|
if (diff > -20 && diff < 20) {
|
||||||
else {
|
set_home_offset((AxisEnum)i, home_offset[i] - diff);
|
||||||
SERIAL_ERROR_START;
|
}
|
||||||
SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
|
else {
|
||||||
LCD_ALERTMESSAGEPGM("Err: Too far!");
|
SERIAL_ERROR_START;
|
||||||
BUZZ(200, 40);
|
SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
|
||||||
err = true;
|
LCD_ALERTMESSAGEPGM("Err: Too far!");
|
||||||
break;
|
BUZZ(200, 40);
|
||||||
|
err = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!err) {
|
||||||
|
SYNC_PLAN_POSITION_KINEMATIC();
|
||||||
|
report_current_position();
|
||||||
|
LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
|
||||||
|
BUZZ(200, 659);
|
||||||
|
BUZZ(200, 698);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err) {
|
#endif // NO_WORKSPACE_OFFSETS
|
||||||
SYNC_PLAN_POSITION_KINEMATIC();
|
|
||||||
report_current_position();
|
|
||||||
LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
|
|
||||||
BUZZ(200, 659);
|
|
||||||
BUZZ(200, 698);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M500: Store settings in EEPROM
|
* M500: Store settings in EEPROM
|
||||||
@ -8081,10 +8106,14 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
|
|||||||
// The newly-selected extruder XY is actually at...
|
// The newly-selected extruder XY is actually at...
|
||||||
current_position[X_AXIS] += xydiff[X_AXIS];
|
current_position[X_AXIS] += xydiff[X_AXIS];
|
||||||
current_position[Y_AXIS] += xydiff[Y_AXIS];
|
current_position[Y_AXIS] += xydiff[Y_AXIS];
|
||||||
for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
|
#if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE)
|
||||||
position_shift[i] += xydiff[i];
|
for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
|
||||||
update_software_endstops((AxisEnum)i);
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
}
|
position_shift[i] += xydiff[i];
|
||||||
|
#endif
|
||||||
|
update_software_endstops((AxisEnum)i);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set the new active extruder
|
// Set the new active extruder
|
||||||
active_extruder = tmp_extruder;
|
active_extruder = tmp_extruder;
|
||||||
@ -8639,9 +8668,12 @@ void process_next_command() {
|
|||||||
case 205: //M205: Set advanced settings
|
case 205: //M205: Set advanced settings
|
||||||
gcode_M205();
|
gcode_M205();
|
||||||
break;
|
break;
|
||||||
case 206: // M206: Set home offsets
|
|
||||||
gcode_M206();
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
break;
|
case 206: // M206: Set home offsets
|
||||||
|
gcode_M206();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DELTA)
|
#if ENABLED(DELTA)
|
||||||
case 665: // M665: Set delta configurations
|
case 665: // M665: Set delta configurations
|
||||||
@ -8805,9 +8837,11 @@ void process_next_command() {
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case 428: // M428: Apply current_position to home_offset
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
gcode_M428();
|
case 428: // M428: Apply current_position to home_offset
|
||||||
break;
|
gcode_M428();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case 500: // M500: Store settings in EEPROM
|
case 500: // M500: Store settings in EEPROM
|
||||||
gcode_M500();
|
gcode_M500();
|
||||||
@ -10488,8 +10522,12 @@ void setup() {
|
|||||||
// This also updates variables in the planner, elsewhere
|
// This also updates variables in the planner, elsewhere
|
||||||
Config_RetrieveSettings();
|
Config_RetrieveSettings();
|
||||||
|
|
||||||
// Initialize current position based on home_offset
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
memcpy(current_position, home_offset, sizeof(home_offset));
|
// Initialize current position based on home_offset
|
||||||
|
memcpy(current_position, home_offset, sizeof(home_offset));
|
||||||
|
#else
|
||||||
|
ZERO(current_position);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Vital to init stepper/planner equivalent for current_position
|
// Vital to init stepper/planner equivalent for current_position
|
||||||
SYNC_PLAN_POSITION_KINEMATIC();
|
SYNC_PLAN_POSITION_KINEMATIC();
|
||||||
|
@ -171,8 +171,10 @@ void Config_Postprocess() {
|
|||||||
|
|
||||||
calculate_volumetric_multipliers();
|
calculate_volumetric_multipliers();
|
||||||
|
|
||||||
// Software endstops depend on home_offset
|
#if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
|
||||||
LOOP_XYZ(i) update_software_endstops((AxisEnum)i);
|
// Software endstops depend on home_offset
|
||||||
|
LOOP_XYZ(i) update_software_endstops((AxisEnum)i);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(EEPROM_SETTINGS)
|
#if ENABLED(EEPROM_SETTINGS)
|
||||||
@ -251,6 +253,9 @@ void Config_Postprocess() {
|
|||||||
EEPROM_WRITE(planner.min_travel_feedrate_mm_s);
|
EEPROM_WRITE(planner.min_travel_feedrate_mm_s);
|
||||||
EEPROM_WRITE(planner.min_segment_time);
|
EEPROM_WRITE(planner.min_segment_time);
|
||||||
EEPROM_WRITE(planner.max_jerk);
|
EEPROM_WRITE(planner.max_jerk);
|
||||||
|
#if ENABLED(NO_WORKSPACE_OFFSETS)
|
||||||
|
float home_offset[XYZ] = { 0 };
|
||||||
|
#endif
|
||||||
EEPROM_WRITE(home_offset);
|
EEPROM_WRITE(home_offset);
|
||||||
|
|
||||||
#if HOTENDS > 1
|
#if HOTENDS > 1
|
||||||
@ -498,6 +503,10 @@ void Config_Postprocess() {
|
|||||||
EEPROM_READ(planner.min_travel_feedrate_mm_s);
|
EEPROM_READ(planner.min_travel_feedrate_mm_s);
|
||||||
EEPROM_READ(planner.min_segment_time);
|
EEPROM_READ(planner.min_segment_time);
|
||||||
EEPROM_READ(planner.max_jerk);
|
EEPROM_READ(planner.max_jerk);
|
||||||
|
|
||||||
|
#if ENABLED(NO_WORKSPACE_OFFSETS)
|
||||||
|
float home_offset[XYZ];
|
||||||
|
#endif
|
||||||
EEPROM_READ(home_offset);
|
EEPROM_READ(home_offset);
|
||||||
|
|
||||||
#if HOTENDS > 1
|
#if HOTENDS > 1
|
||||||
@ -726,7 +735,9 @@ void Config_ResetDefault() {
|
|||||||
planner.max_jerk[Y_AXIS] = DEFAULT_YJERK;
|
planner.max_jerk[Y_AXIS] = DEFAULT_YJERK;
|
||||||
planner.max_jerk[Z_AXIS] = DEFAULT_ZJERK;
|
planner.max_jerk[Z_AXIS] = DEFAULT_ZJERK;
|
||||||
planner.max_jerk[E_AXIS] = DEFAULT_EJERK;
|
planner.max_jerk[E_AXIS] = DEFAULT_EJERK;
|
||||||
home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0;
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
|
ZERO(home_offset);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HOTENDS > 1
|
#if HOTENDS > 1
|
||||||
constexpr float tmp4[XYZ][HOTENDS] = {
|
constexpr float tmp4[XYZ][HOTENDS] = {
|
||||||
@ -937,15 +948,17 @@ void Config_ResetDefault() {
|
|||||||
SERIAL_ECHOPAIR(" E", planner.max_jerk[E_AXIS]);
|
SERIAL_ECHOPAIR(" E", planner.max_jerk[E_AXIS]);
|
||||||
SERIAL_EOL;
|
SERIAL_EOL;
|
||||||
|
|
||||||
CONFIG_ECHO_START;
|
#if DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
if (!forReplay) {
|
|
||||||
SERIAL_ECHOLNPGM("Home offset (mm)");
|
|
||||||
CONFIG_ECHO_START;
|
CONFIG_ECHO_START;
|
||||||
}
|
if (!forReplay) {
|
||||||
SERIAL_ECHOPAIR(" M206 X", home_offset[X_AXIS]);
|
SERIAL_ECHOLNPGM("Home offset (mm)");
|
||||||
SERIAL_ECHOPAIR(" Y", home_offset[Y_AXIS]);
|
CONFIG_ECHO_START;
|
||||||
SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS]);
|
}
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR(" M206 X", home_offset[X_AXIS]);
|
||||||
|
SERIAL_ECHOPAIR(" Y", home_offset[Y_AXIS]);
|
||||||
|
SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS]);
|
||||||
|
SERIAL_EOL;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HOTENDS > 1
|
#if HOTENDS > 1
|
||||||
CONFIG_ECHO_START;
|
CONFIG_ECHO_START;
|
||||||
|
Loading…
Reference in New Issue
Block a user