Adding tool length offset code

This commit is contained in:
Alden Hart
2016-09-12 06:45:46 -04:00
parent 41c82c0405
commit 5046c00711
10 changed files with 325 additions and 156 deletions

View File

@@ -473,7 +473,15 @@ static stat_t _parse_gcode_block(char *buf, char *active_comment)
break;
}
case 40: break; // ignore cancel cutter radius compensation
case 49: break; // ignore cancel tool length offset comp.
case 43: {
switch (_point(value)) {
case 0: SET_NON_MODAL (next_action, NEXT_ACTION_SET_TL_OFFSET);
case 2: SET_NON_MODAL (next_action, NEXT_ACTION_SET_ADDITIONAL_TL_OFFSET);
default: status = STAT_GCODE_COMMAND_UNSUPPORTED;
}
break;
}
case 49: SET_NON_MODAL (next_action, NEXT_ACTION_CANCEL_TL_OFFSET);
case 53: SET_NON_MODAL (absolute_override, true);
case 54: SET_MODAL (MODAL_GROUP_G12, coord_system, G54);
case 55: SET_MODAL (MODAL_GROUP_G12, coord_system, G55);
@@ -561,6 +569,7 @@ static stat_t _parse_gcode_block(char *buf, char *active_comment)
// case 'U': SET_NON_MODAL (target[AXIS_U], value); // reserved
// case 'V': SET_NON_MODAL (target[AXIS_V], value); // reserved
// case 'W': SET_NON_MODAL (target[AXIS_W], value); // reserved
case 'H': SET_NON_MODAL (H_word, value);
case 'I': SET_NON_MODAL (arc_offset[0], value);
case 'J': SET_NON_MODAL (arc_offset[1], value);
case 'K': SET_NON_MODAL (arc_offset[2], value);
@@ -648,9 +657,24 @@ static stat_t _execute_gcode_block(char *active_comment)
EXEC_FUNC(cm_select_plane, select_plane); // G17, G18, G19
EXEC_FUNC(cm_set_units_mode, units_mode); // G20, G21
//--> cutter radius compensation goes here
//--> cutter length compensation goes here
switch (cm.gn.next_action) { // Tool length offsets
case NEXT_ACTION_SET_TL_OFFSET: { // G43
ritorno(cm_set_tl_offset(cm.gn.H_word, false));
break;
}
case NEXT_ACTION_SET_ADDITIONAL_TL_OFFSET: { // G43.2
ritorno(cm_set_tl_offset(cm.gn.H_word, true));
break;
}
case NEXT_ACTION_CANCEL_TL_OFFSET: { // G49
ritorno(cm_cancel_tl_offset());
break;
}
}
EXEC_FUNC(cm_set_coord_system, coord_system); // G54, G55, G56, G57, G58, G59
// EXEC_FUNC(cm_set_path_control, path_control); // G61, G61.1, G64
// EXEC_FUNC(cm_set_path_control, path_control); // G61, G61.1, G64
if(cm.gf.path_control) { status = cm_set_path_control(MODEL, cm.gn.path_control); }
EXEC_FUNC(cm_set_distance_mode, distance_mode); // G90, G91