Mute probing, and ensure that tool 0 is never selected in Marlin-flavor gcode.

This commit is contained in:
Rob Giseburt
2017-02-01 20:58:12 -06:00
parent b116b5c5d3
commit 1350523c37
2 changed files with 33 additions and 24 deletions

View File

@@ -353,29 +353,30 @@ static stat_t _probing_finish() {
cm.probe_results[0][axis] = cm_get_absolute_position(ACTIVE_MODEL, axis);
}
// If probe was successful the 'e' word == 1, otherwise e == 0 to signal an error
char buf[32];
char* bufp = buf;
bufp += sprintf(bufp, "{\"prb\":{\"e\":%i, \"", (int)cm.probe_state[0]);
if (pb.flags[AXIS_X]) {
sprintf(bufp, "x\":%0.3f}}\n", cm.probe_results[0][AXIS_X]);
}
if (pb.flags[AXIS_Y]) {
sprintf(bufp, "y\":%0.3f}}\n", cm.probe_results[0][AXIS_Y]);
}
if (pb.flags[AXIS_Z]) {
sprintf(bufp, "z\":%0.3f}}\n", cm.probe_results[0][AXIS_Z]);
}
if (pb.flags[AXIS_A]) {
sprintf(bufp, "a\":%0.3f}}\n", cm.probe_results[0][AXIS_A]);
}
if (pb.flags[AXIS_B]) {
sprintf(bufp, "b\":%0.3f}}\n", cm.probe_results[0][AXIS_B]);
}
if (pb.flags[AXIS_C]) {
sprintf(bufp, "c\":%0.3f}}\n", cm.probe_results[0][AXIS_C]);
}
xio_writeline(buf);
// // If probe was successful the 'e' word == 1, otherwise e == 0 to signal an error
// char buf[32];
// char* bufp = buf;
// bufp += sprintf(bufp, "{\"prb\":{\"e\":%i, \"", (int)cm.probe_state[0]);
// if (pb.flags[AXIS_X]) {
// sprintf(bufp, "x\":%0.3f}}\n", cm.probe_results[0][AXIS_X]);
// }
// if (pb.flags[AXIS_Y]) {
// sprintf(bufp, "y\":%0.3f}}\n", cm.probe_results[0][AXIS_Y]);
// }
// if (pb.flags[AXIS_Z]) {
// sprintf(bufp, "z\":%0.3f}}\n", cm.probe_results[0][AXIS_Z]);
// }
// if (pb.flags[AXIS_A]) {
// sprintf(bufp, "a\":%0.3f}}\n", cm.probe_results[0][AXIS_A]);
// }
// if (pb.flags[AXIS_B]) {
// sprintf(bufp, "b\":%0.3f}}\n", cm.probe_results[0][AXIS_B]);
// }
// if (pb.flags[AXIS_C]) {
// sprintf(bufp, "c\":%0.3f}}\n", cm.probe_results[0][AXIS_C]);
// }
// xio_writeline(buf);
sr_request_status_report(SR_REQUEST_TIMED);
return (_set_pb_func(_probing_finalize_exit));
}

View File

@@ -836,6 +836,8 @@ stat_t _execute_gcode_block(char *active_comment)
EXEC_FUNC(cm_set_feed_rate, F_word); // F
#if MARLIN_COMPAT_ENABLED == true
// Handle Marlin specifics
// adjust T real quick
if (cm.gmx.marlin_flavor && gf.tool_select) {
gv.tool_select += 1;
@@ -843,7 +845,10 @@ stat_t _execute_gcode_block(char *active_comment)
cm.gm.tool = cm.gm.tool_select; // Also, in Marlin, tool changes are effective immediately :facepalm:
gf.tool_select = false; // prevent a tool_select command from being buffered (planning to zero)
}
// Handle Marlin specifics
else if (cm.gm.tool_select == 0) {
cm.gm.tool_select = 1; // We need to ensure we have a valid tool selected, often Malin gcode won't have a T word at all
cm.gm.tool = cm.gm.tool_select; // Also, in Marlin, tool changes are effective immediately :facepalm:
}
// Deal with E
EXEC_FUNC(cm_marlin_set_extruder_mode, marlin_relative_extruder_mode); // M82, M83
@@ -861,6 +866,9 @@ stat_t _execute_gcode_block(char *active_comment)
gv.target[AXIS_B] = gv.E_word;
}
else {
#if IN_DEBUGGER == 1
__asm__("BKPT"); // mp_exec_move() buffer is not prepped
#endif
return STAT_INPUT_VALUE_RANGE_ERROR;
}
}