Merge pull request #2995 from thinkyhead/rcbugfix_corexy_corexz

Add CORE support to st_get_position_mm (and elsewhere)
This commit is contained in:
Scott Lahteine
2016-03-06 00:17:03 -08:00
4 changed files with 103 additions and 43 deletions

View File

@ -1332,7 +1332,7 @@ static void setup_for_endstop_move() {
st_synchronize();
// Tell the planner where we ended up - Get this from the stepper handler
zPosition = st_get_position_mm(Z_AXIS);
zPosition = st_get_axis_position_mm(Z_AXIS);
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS]);
// move up the retract distance
@ -1350,7 +1350,7 @@ static void setup_for_endstop_move() {
endstops_hit_on_purpose(); // clear endstop hit flags
// Get the current stepper position after bumping an endstop
current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
current_position[Z_AXIS] = st_get_axis_position_mm(Z_AXIS);
sync_plan_position();
#if ENABLED(DEBUG_LEVELING_FEATURE)
@ -3157,7 +3157,7 @@ inline void gcode_G28() {
float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
z_tmp = current_position[Z_AXIS],
real_z = st_get_position_mm(Z_AXIS); //get the real Z (since plan_get_position is now correcting the plane)
real_z = st_get_axis_position_mm(Z_AXIS); //get the real Z (since plan_get_position is now correcting the plane)
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (marlin_debug_flags & DEBUG_LEVELING) {
@ -3604,10 +3604,10 @@ inline void gcode_M42() {
}
}
double X_current = st_get_position_mm(X_AXIS),
Y_current = st_get_position_mm(Y_AXIS),
Z_current = st_get_position_mm(Z_AXIS),
E_current = st_get_position_mm(E_AXIS),
double X_current = st_get_axis_position_mm(X_AXIS),
Y_current = st_get_axis_position_mm(Y_AXIS),
Z_current = st_get_axis_position_mm(Z_AXIS),
E_current = st_get_axis_position_mm(E_AXIS),
X_probe_location = X_current, Y_probe_location = Y_current,
Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING;
@ -3661,10 +3661,10 @@ inline void gcode_M42() {
active_extruder);
st_synchronize();
current_position[X_AXIS] = X_current = st_get_position_mm(X_AXIS);
current_position[Y_AXIS] = Y_current = st_get_position_mm(Y_AXIS);
current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
current_position[E_AXIS] = E_current = st_get_position_mm(E_AXIS);
current_position[X_AXIS] = X_current = st_get_axis_position_mm(X_AXIS);
current_position[Y_AXIS] = Y_current = st_get_axis_position_mm(Y_AXIS);
current_position[Z_AXIS] = Z_current = st_get_axis_position_mm(Z_AXIS);
current_position[E_AXIS] = E_current = st_get_axis_position_mm(E_AXIS);
//
// OK, do the initial probe to get us close to the bed.
@ -3676,15 +3676,15 @@ inline void gcode_M42() {
setup_for_endstop_move();
run_z_probe();
current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING;
Z_current = current_position[Z_AXIS] = st_get_axis_position_mm(Z_AXIS);
Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING;
plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location,
E_current,
homing_feedrate[X_AXIS] / 60,
active_extruder);
st_synchronize();
current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
Z_current = current_position[Z_AXIS] = st_get_axis_position_mm(Z_AXIS);
if (deploy_probe_for_each_reading) stow_z_probe();
@ -4302,12 +4302,33 @@ inline void gcode_M114() {
SERIAL_PROTOCOLPGM(" E:");
SERIAL_PROTOCOL(current_position[E_AXIS]);
SERIAL_PROTOCOLPGM(MSG_COUNT_X);
SERIAL_PROTOCOL(st_get_position_mm(X_AXIS));
SERIAL_PROTOCOLPGM(" Y:");
SERIAL_PROTOCOL(st_get_position_mm(Y_AXIS));
SERIAL_PROTOCOLPGM(" Z:");
SERIAL_PROTOCOL(st_get_position_mm(Z_AXIS));
CRITICAL_SECTION_START;
extern volatile long count_position[NUM_AXIS];
long xpos = count_position[X_AXIS],
ypos = count_position[Y_AXIS],
zpos = count_position[Z_AXIS];
CRITICAL_SECTION_END;
#if ENABLED(COREXY) || ENABLED(COREXZ)
SERIAL_PROTOCOLPGM(MSG_COUNT_A);
#else
SERIAL_PROTOCOLPGM(MSG_COUNT_X);
#endif
SERIAL_PROTOCOL(xpos);
#if ENABLED(COREXY)
SERIAL_PROTOCOLPGM(" B:");
#else
SERIAL_PROTOCOLPGM(" Y:");
#endif
SERIAL_PROTOCOL(ypos);
#if ENABLED(COREXZ)
SERIAL_PROTOCOLPGM(" C:");
#else
SERIAL_PROTOCOLPGM(" Z:");
#endif
SERIAL_PROTOCOL(zpos);
SERIAL_EOL;