Skip to content

Commit

Permalink
WPos report bug fix when MPos disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
chamnit committed Aug 22, 2014
1 parent 359e6a8 commit ec48571
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
# FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24: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:

Expand Down
7 changes: 6 additions & 1 deletion report.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,11 @@ void report_realtime_status()
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
if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_MACHINE_POSITION)) {
printPgmString(PSTR(",MPos:"));
Expand All @@ -388,7 +393,6 @@ void report_realtime_status()
// print_position[X_AXIS] -= print_position[Z_AXIS];
// print_position[Z_AXIS] = current_position[Z_AXIS]/settings.steps_per_mm[Z_AXIS];
for (i=0; i< N_AXIS; i++) {
print_position[i] = current_position[i]/settings.steps_per_mm[i];
printFloat_CoordValue(print_position[i]);
if (i < (N_AXIS-1)) { printPgmString(PSTR(",")); }
}
Expand All @@ -398,6 +402,7 @@ void report_realtime_status()
if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_WORK_POSITION)) {
printPgmString(PSTR(",WPos:"));
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];
if (i == TOOL_LENGTH_OFFSET_AXIS) { print_position[i] -= gc_state.tool_length_offset; }
printFloat_CoordValue(print_position[i]);
Expand Down

0 comments on commit ec48571

Please sign in to comment.