|
|
@ -396,6 +396,8 @@ bool axis_relative_modes[] = AXIS_RELATIVE_MODES, |
|
|
|
float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA), |
|
|
|
volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0); |
|
|
|
|
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) |
|
|
|
|
|
|
|
// The distance that XYZ has been offset by G92. Reset by G28.
|
|
|
|
float position_shift[XYZ] = { 0 }; |
|
|
|
|
|
|
@ -403,6 +405,8 @@ float position_shift[XYZ] = { 0 }; |
|
|
|
// Set by M206, M428, or menu item. Saved to EEPROM.
|
|
|
|
float home_offset[XYZ] = { 0 }; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
// Software Endstops are based on the configured limits.
|
|
|
|
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) |
|
|
|
bool soft_endstops_enabled = true; |
|
|
@ -1333,6 +1337,8 @@ bool get_target_extruder_from_command(int code) { |
|
|
|
|
|
|
|
#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 |
|
|
@ -1342,8 +1348,8 @@ bool get_target_extruder_from_command(int code) { |
|
|
|
* 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); |
|
|
|
void update_software_endstops(const AxisEnum axis) { |
|
|
|
const float offs = LOGICAL_POSITION(0, axis); |
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE) |
|
|
|
if (axis == X_AXIS) { |
|
|
@ -1376,8 +1382,10 @@ void update_software_endstops(AxisEnum axis) { |
|
|
|
#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]); |
|
|
|
} |
|
|
@ -1387,9 +1395,11 @@ void update_software_endstops(AxisEnum axis) { |
|
|
|
if (axis == Z_AXIS) |
|
|
|
delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top(); |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif // NO_WORKSPACE_OFFSETS
|
|
|
|
|
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) |
|
|
|
/**
|
|
|
|
* Change the home offset for an axis, update the current |
|
|
|
* position and the software endstops to retain the same |
|
|
@ -1403,6 +1413,7 @@ static void set_home_offset(AxisEnum axis, float v) { |
|
|
|
home_offset[axis] = v; |
|
|
|
update_software_endstops(axis); |
|
|
|
} |
|
|
|
#endif // NO_WORKSPACE_OFFSETS
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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; |
|
|
|
|
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) |
|
|
|
position_shift[axis] = 0; |
|
|
|
update_software_endstops(axis); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE) |
|
|
|
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 (DEBUGGING(LEVELING)) { |
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) |
|
|
|
SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]); |
|
|
|
SERIAL_ECHOLNPAIR("] = ", home_offset[axis]); |
|
|
|
#endif |
|
|
|
DEBUG_POS("", current_position); |
|
|
|
SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis_codes[axis]); |
|
|
|
SERIAL_CHAR(')'); |
|
|
@ -4603,8 +4618,10 @@ inline void gcode_G92() { |
|
|
|
|
|
|
|
if (i != E_AXIS) { |
|
|
|
didXYZ = true; |
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) |
|
|
|
position_shift[i] += v - p; // Offset the coordinate space
|
|
|
|
update_software_endstops((AxisEnum)i); |
|
|
|
#endif |
|
|
|
} |
|
|
|
#endif |
|
|
|
} |
|
|
@ -6334,6 +6351,8 @@ inline void gcode_M205() { |
|
|
|
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 |
|
|
|
*/ |
|
|
@ -6351,6 +6370,8 @@ inline void gcode_M206() { |
|
|
|
report_current_position(); |
|
|
|
} |
|
|
|
|
|
|
|
#endif // NO_WORKSPACE_OFFSETS
|
|
|
|
|
|
|
|
#if ENABLED(DELTA) |
|
|
|
/**
|
|
|
|
* M665: Set delta configurations |
|
|
@ -7173,6 +7194,8 @@ void quickstop_stepper() { |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) |
|
|
|
|
|
|
|
/**
|
|
|
|
* M428: Set home_offset based on the distance between the |
|
|
|
* current_position and the nearest "reference point." |
|
|
@ -7213,6 +7236,8 @@ inline void gcode_M428() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif // NO_WORKSPACE_OFFSETS
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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...
|
|
|
|
current_position[X_AXIS] += xydiff[X_AXIS]; |
|
|
|
current_position[Y_AXIS] += xydiff[Y_AXIS]; |
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE) |
|
|
|
for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) { |
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) |
|
|
|
position_shift[i] += xydiff[i]; |
|
|
|
#endif |
|
|
|
update_software_endstops((AxisEnum)i); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
// Set the new active extruder
|
|
|
|
active_extruder = tmp_extruder; |
|
|
@ -8639,9 +8668,12 @@ void process_next_command() { |
|
|
|
case 205: //M205: Set advanced settings
|
|
|
|
gcode_M205(); |
|
|
|
break; |
|
|
|
|
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) |
|
|
|
case 206: // M206: Set home offsets
|
|
|
|
gcode_M206(); |
|
|
|
break; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLED(DELTA) |
|
|
|
case 665: // M665: Set delta configurations
|
|
|
@ -8805,9 +8837,11 @@ void process_next_command() { |
|
|
|
break; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) |
|
|
|
case 428: // M428: Apply current_position to home_offset
|
|
|
|
gcode_M428(); |
|
|
|
break; |
|
|
|
#endif |
|
|
|
|
|
|
|
case 500: // M500: Store settings in EEPROM
|
|
|
|
gcode_M500(); |
|
|
@ -10488,8 +10522,12 @@ void setup() { |
|
|
|
// This also updates variables in the planner, elsewhere
|
|
|
|
Config_RetrieveSettings(); |
|
|
|
|
|
|
|
#if DISABLED(NO_WORKSPACE_OFFSETS) |
|
|
|
// 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
|
|
|
|
SYNC_PLAN_POSITION_KINEMATIC(); |
|
|
|