| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -3653,7 +3653,7 @@ inline void gcode_G4() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#if ENABLED(CNC_COORDINATE_SYSTEMS)
 | 
					 | 
					 | 
					 | 
					#if ENABLED(CNC_COORDINATE_SYSTEMS)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  /**
 | 
					 | 
					 | 
					 | 
					  /**
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   * Select a coordinate system and update the current position.
 | 
					 | 
					 | 
					 | 
					   * Select a coordinate system and update the workspace offset.
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   * System index -1 is used to specify machine-native.
 | 
					 | 
					 | 
					 | 
					   * System index -1 is used to specify machine-native.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   */
 | 
					 | 
					 | 
					 | 
					   */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  bool select_coordinate_system(const int8_t _new) {
 | 
					 | 
					 | 
					 | 
					  bool select_coordinate_system(const int8_t _new) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -3664,16 +3664,13 @@ inline void gcode_G4() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
 | 
					 | 
					 | 
					 | 
					    if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      COPY(new_offset, coordinate_system[_new]);
 | 
					 | 
					 | 
					 | 
					      COPY(new_offset, coordinate_system[_new]);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    active_coordinate_system = _new;
 | 
					 | 
					 | 
					 | 
					    active_coordinate_system = _new;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    bool didXYZ = false;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    LOOP_XYZ(i) {
 | 
					 | 
					 | 
					 | 
					    LOOP_XYZ(i) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      const float diff = new_offset[i] - old_offset[i];
 | 
					 | 
					 | 
					 | 
					      const float diff = new_offset[i] - old_offset[i];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (diff) {
 | 
					 | 
					 | 
					 | 
					      if (diff) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        position_shift[i] += diff;
 | 
					 | 
					 | 
					 | 
					        position_shift[i] += diff;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        update_software_endstops((AxisEnum)i);
 | 
					 | 
					 | 
					 | 
					        update_software_endstops((AxisEnum)i);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        didXYZ = true;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      }
 | 
					 | 
					 | 
					 | 
					      }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (didXYZ) SYNC_PLAN_POSITION_KINEMATIC();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return true;
 | 
					 | 
					 | 
					 | 
					    return true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -6257,7 +6254,12 @@ inline void gcode_G92() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    #define IS_G92_0 true
 | 
					 | 
					 | 
					 | 
					    #define IS_G92_0 true
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  #endif
 | 
					 | 
					 | 
					 | 
					  #endif
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  bool didXYZ = false, didE = false;
 | 
					 | 
					 | 
					 | 
					  bool didE = false;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  #if IS_SCARA || !HAS_POSITION_SHIFT
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    bool didXYZ = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  #else
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    constexpr bool didXYZ = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  #endif
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if (IS_G92_0) LOOP_XYZE(i) {
 | 
					 | 
					 | 
					 | 
					  if (IS_G92_0) LOOP_XYZE(i) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (parser.seenval(axis_codes[i])) {
 | 
					 | 
					 | 
					 | 
					    if (parser.seenval(axis_codes[i])) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -6265,18 +6267,18 @@ inline void gcode_G92() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                  v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
 | 
					 | 
					 | 
					 | 
					                  v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                  d = v - current_position[i];
 | 
					 | 
					 | 
					 | 
					                  d = v - current_position[i];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (!NEAR_ZERO(d)) {
 | 
					 | 
					 | 
					 | 
					      if (!NEAR_ZERO(d)) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (i == E_AXIS) didE = true; else didXYZ = true;
 | 
					 | 
					 | 
					 | 
					        #if IS_SCARA || !HAS_POSITION_SHIFT
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        #if IS_SCARA
 | 
					 | 
					 | 
					 | 
					          if (i == E_AXIS) didE = true; else didXYZ = true;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          current_position[i] = v;        // For SCARA just set the position directly
 | 
					 | 
					 | 
					 | 
					          current_position[i] = v;        // Without workspaces revert to Marlin 1.0 behavior
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        #elif HAS_POSITION_SHIFT
 | 
					 | 
					 | 
					 | 
					        #elif HAS_POSITION_SHIFT
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          if (i == E_AXIS)
 | 
					 | 
					 | 
					 | 
					          if (i == E_AXIS) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            didE = true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
 | 
					 | 
					 | 
					 | 
					            current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          else {
 | 
					 | 
					 | 
					 | 
					          else {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            position_shift[i] += d;       // Other axes simply offset the coordinate space
 | 
					 | 
					 | 
					 | 
					            position_shift[i] += d;       // Other axes simply offset the coordinate space
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            update_software_endstops((AxisEnum)i);
 | 
					 | 
					 | 
					 | 
					            update_software_endstops((AxisEnum)i);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          }
 | 
					 | 
					 | 
					 | 
					          }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        #else
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          current_position[i] = v;        // Without workspaces revert to Marlin 1.0 behavior
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        #endif
 | 
					 | 
					 | 
					 | 
					        #endif
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      }
 | 
					 | 
					 | 
					 | 
					      }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -9958,31 +9960,27 @@ void quickstop_stepper() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   *       Use M206 to set these values directly.
 | 
					 | 
					 | 
					 | 
					   *       Use M206 to set these values directly.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   */
 | 
					 | 
					 | 
					 | 
					   */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  inline void gcode_M428() {
 | 
					 | 
					 | 
					 | 
					  inline void gcode_M428() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    bool err = false;
 | 
					 | 
					 | 
					 | 
					    if (axis_unhomed_error()) return;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    float diff[XYZ];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    LOOP_XYZ(i) {
 | 
					 | 
					 | 
					 | 
					    LOOP_XYZ(i) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (axis_homed[i]) {
 | 
					 | 
					 | 
					 | 
					      diff[i] = base_home_pos((AxisEnum)i) - current_position[i];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        const float base = (current_position[i] > (soft_endstop_min[i] + soft_endstop_max[i]) * 0.5) ? base_home_pos((AxisEnum)i) : 0,
 | 
					 | 
					 | 
					 | 
					      if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    diff = base - current_position[i];
 | 
					 | 
					 | 
					 | 
					        diff[i] = -current_position[i];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (WITHIN(diff, -20, 20)) {
 | 
					 | 
					 | 
					 | 
					      if (!WITHIN(diff[i], -20, 20)) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          set_home_offset((AxisEnum)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);
 | 
					 | 
					 | 
					 | 
					        return;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          LCD_ALERTMESSAGEPGM("Err: Too far!");
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          BUZZ(200, 40);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          err = true;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          break;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      }
 | 
					 | 
					 | 
					 | 
					      }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (!err) {
 | 
					 | 
					 | 
					 | 
					    LOOP_XYZ(i) set_home_offset((AxisEnum)i, diff[i]);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      report_current_position();
 | 
					 | 
					 | 
					 | 
					    report_current_position();
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
 | 
					 | 
					 | 
					 | 
					    LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      BUZZ(100, 659);
 | 
					 | 
					 | 
					 | 
					    BUZZ(100, 659);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      BUZZ(100, 698);
 | 
					 | 
					 | 
					 | 
					    BUZZ(100, 698);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#endif // HAS_M206_COMMAND
 | 
					 | 
					 | 
					 | 
					#endif // HAS_M206_COMMAND
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |