Marlin/stepper.cpp
float Stepper::get_axis_position_mm(AxisEnum axis) {
  float axis_steps;
  #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
    // Requesting one of the "core" axes?
    if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
      CRITICAL_SECTION_START;
      long pos1 = count_position[CORE_AXIS_1],
           pos2 = count_position[CORE_AXIS_2];
      CRITICAL_SECTION_END;
      // ((a1+a2)+(a1-a2))/2 -> (a1+a2+a1-a2)/2 -> (a1+a1)/2 -> a1
      // ((a1+a2)-(a1-a2))/2 -> (a1+a2-a1+a2)/2 -> (a2+a2)/2 -> a2
      axis_steps = (pos1 + ((axis == CORE_AXIS_1) ? pos2 : -pos2)) * 0.5f;
    }
    else
      axis_steps = position(axis);
  #else
    axis_steps = position(axis);
  #endif
  return axis_steps * planner.steps_to_mm[axis];
}
/**
 * Get an axis position according to stepper position(s)
 * For CORE machines apply translation from ABC to XYZ.
 */
Get an axis position according to stepper position(s)
For CORE machines apply translation from ABC to XYZ.
Get an axis position according to stepper position ( s ) For CORE machines apply translation from ABC to XYZ .
float Stepper::get_axis_position_mm(AxisEnum axis) {
  float axis_steps;
  #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
    if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
      CRITICAL_SECTION_START;
      long pos1 = count_position[CORE_AXIS_1],
           pos2 = count_position[CORE_AXIS_2];
      CRITICAL_SECTION_END;
      axis_steps = (pos1 + ((axis == CORE_AXIS_1) ? pos2 : -pos2)) * 0.5f;
    }
    else
      axis_steps = position(axis);
  #else
    axis_steps = position(axis);
  #endif
  return axis_steps * planner.steps_to_mm[axis];
}
float Stepper :: get_axis_position_mm ( AxisEnum axis ) { float axis_steps ; #if ENABLED ( COREXY ) || ENABLED ( COREXZ ) || ENABLED ( COREYZ ) if ( axis == CORE_AXIS_1 || axis == CORE_AXIS_2 ) { CRITICAL_SECTION_START ; long pos1 = count_position [ CORE_AXIS_1 ] , pos2 = count_position [ CORE_AXIS_2 ] ; CRITICAL_SECTION_END ; axis_steps = ( pos1 + ( ( axis == CORE_AXIS_1 ) ? pos2 : - pos2 ) ) * 0.5f ; } else axis_steps = position ( axis ) ; #else axis_steps = position ( axis ) ; #endif return axis_steps * planner . steps_to_mm [ axis ] ; }
Get an axis position according to stepper position(s)
 For CORE machines apply translation from ABC to XYZ.
Get an axis position according to stepper position ( s ) For CORE machines apply translation from ABC to XYZ .
// Requesting one of the "core" axes? // ((a1+a2)+(a1-a2))/2 -> (a1+a2+a1-a2)/2 -> (a1+a1)/2 -> a1 // ((a1+a2)-(a1-a2))/2 -> (a1+a2-a1+a2)/2 -> (a2+a2)/2 -> a2