WPos report bug fix when MPos disabled.

This commit is contained in:
Sonny Jeon 2014-08-22 08:31:24 -06:00
parent 359e6a89e3
commit ec48571cbe
2 changed files with 6 additions and 3 deletions

View File

@ -36,8 +36,6 @@ OBJECTS = main.o motion_control.o gcode.o spindle_control.o coolant_control.o
print.o probe.o report.o system.o print.o probe.o report.o system.o
# FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m # FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m
FUSES = -U hfuse:w:0xd2:m -U lfuse:w:0xff:m FUSES = -U hfuse:w:0xd2:m -U lfuse:w:0xff:m
# update that line with this when programmer is back up:
# FUSES = -U hfuse:w:0xd7:m -U lfuse:w:0xff:m
# Tune the lines below only if you know what you are doing: # Tune the lines below only if you know what you are doing:

View File

@ -379,6 +379,11 @@ void report_realtime_status()
case STATE_CHECK_MODE: printPgmString(PSTR("<Check")); break; case STATE_CHECK_MODE: printPgmString(PSTR("<Check")); break;
} }
// If reporting a position, convert the current step count (current_position) to millimeters.
if (bit_istrue(settings.status_report_mask,(BITFLAG_RT_STATUS_MACHINE_POSITION | BITFLAG_RT_STATUS_WORK_POSITION)) {
for (i=0; i< N_AXIS; i++) { print_position[i] = current_position[i]/settings.steps_per_mm[i]; }
}
// Report machine position // Report machine position
if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_MACHINE_POSITION)) { if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_MACHINE_POSITION)) {
printPgmString(PSTR(",MPos:")); printPgmString(PSTR(",MPos:"));
@ -388,7 +393,6 @@ void report_realtime_status()
// print_position[X_AXIS] -= print_position[Z_AXIS]; // print_position[X_AXIS] -= print_position[Z_AXIS];
// print_position[Z_AXIS] = current_position[Z_AXIS]/settings.steps_per_mm[Z_AXIS]; // print_position[Z_AXIS] = current_position[Z_AXIS]/settings.steps_per_mm[Z_AXIS];
for (i=0; i< N_AXIS; i++) { for (i=0; i< N_AXIS; i++) {
print_position[i] = current_position[i]/settings.steps_per_mm[i];
printFloat_CoordValue(print_position[i]); printFloat_CoordValue(print_position[i]);
if (i < (N_AXIS-1)) { printPgmString(PSTR(",")); } if (i < (N_AXIS-1)) { printPgmString(PSTR(",")); }
} }
@ -398,6 +402,7 @@ void report_realtime_status()
if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_WORK_POSITION)) { if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_WORK_POSITION)) {
printPgmString(PSTR(",WPos:")); printPgmString(PSTR(",WPos:"));
for (i=0; i< N_AXIS; i++) { for (i=0; i< N_AXIS; i++) {
// Apply work coordinate offsets and tool length offset to current position.
print_position[i] -= gc_state.coord_system[i]+gc_state.coord_offset[i]; print_position[i] -= gc_state.coord_system[i]+gc_state.coord_offset[i];
if (i == TOOL_LENGTH_OFFSET_AXIS) { print_position[i] -= gc_state.tool_length_offset; } if (i == TOOL_LENGTH_OFFSET_AXIS) { print_position[i] -= gc_state.tool_length_offset; }
printFloat_CoordValue(print_position[i]); printFloat_CoordValue(print_position[i]);