Adding tool length offset code

This commit is contained in:
Alden Hart
2016-10-29 11:08:05 -04:00
parent 41c82c0405
commit 5046c00711
10 changed files with 325 additions and 156 deletions
+6 -5
View File
@@ -55,11 +55,12 @@ enum hwPlatform {
// Axes, motors & PWM channels must be defines (not enums) so expressions like this:
// #if (MOTORS >= 6) will work
#define AXES 6 // number of axes supported in this version
#define HOMING_AXES 4 // number of axes that can be homed (assumes Zxyabc sequence)
#define MOTORS 4 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define AXES 6 // number of axes supported in this version
#define HOMING_AXES 4 // number of axes that can be homed (assumes Zxyabc sequence)
#define MOTORS 4 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define TOOLS 6 // number of entries in tool table (1-6)
////////////////////////////
+6 -5
View File
@@ -55,11 +55,12 @@ enum hwPlatform {
// Axes, motors & PWM channels must be defines (not enums) so expressions like this:
// #if (MOTORS >= 6) will work
#define AXES 6 // number of axes supported in this version
#define HOMING_AXES 4 // number of axes that can be homed (assumes Zxyabc sequence)
#define MOTORS 4 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define AXES 6 // number of axes supported in this version
#define HOMING_AXES 4 // number of axes that can be homed (assumes Zxyabc sequence)
#define MOTORS 4 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define TOOLS 6 // number of entries in tool table (1-6)
////////////////////////////
+6 -5
View File
@@ -55,11 +55,12 @@ enum hwPlatform {
// Axes, motors & PWM channels must be defines (not enums) so expressions like this:
// #if (MOTORS >= 6) will work
#define AXES 6 // number of axes supported in this version
#define HOMING_AXES 4 // number of axes that can be homed (assumes Zxyabc sequence)
#define MOTORS 4 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define AXES 6 // number of axes supported in this version
#define HOMING_AXES 4 // number of axes that can be homed (assumes Zxyabc sequence)
#define MOTORS 4 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define TOOLS 6 // number of entries in tool table (1-6)
////////////////////////////
+6 -5
View File
@@ -56,11 +56,12 @@ enum hwPlatform {
// Axes, motors & PWM channels must be defines (not enums) so expressions like this:
// #if (MOTORS >= 6) will work
#define AXES 6 // number of axes supported in this version
#define HOMING_AXES 4 // number of axes that can be homed (assumes Zxyabc sequence)
#define MOTORS 2 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define AXES 6 // number of axes supported in this version
#define HOMING_AXES 4 // number of axes that can be homed (assumes Zxyabc sequence)
#define MOTORS 2 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define TOOLS 6 // number of entries in tool table (1-6)
////////////////////////////
+1
View File
@@ -61,6 +61,7 @@ enum hwPlatform {
#define MOTORS 5 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define TOOLS 6 // number of entries in tool table (1-6)
////////////////////////////
+1
View File
@@ -60,6 +60,7 @@ enum hwPlatform {
#define MOTORS 4 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define TOOLS 6 // number of entries in tool table (1-6)
////////////////////////////
+6 -5
View File
@@ -55,11 +55,12 @@ enum hwPlatform {
// Axes, motors & PWM channels must be defines (not enums) so expressions like this:
// #if (MOTORS >= 6) will work
#define AXES 6 // number of axes supported in this version
#define HOMING_AXES 4 // number of axes that can be homed (assumes Zxyabc sequence)
#define MOTORS 4 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define AXES 6 // number of axes supported in this version
#define HOMING_AXES 4 // number of axes that can be homed (assumes Zxyabc sequence)
#define MOTORS 4 // number of motors on the board
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
#define TOOLS 6 // number of entries in tool table (1-6)
////////////////////////////
+131 -4
View File
@@ -300,7 +300,7 @@ float cm_get_active_coord_offset(const uint8_t axis)
if (cm.gm.absolute_override == ABSOLUTE_OVERRIDE_ON) { // no offset if in absolute override mode
return (0.0);
}
float offset = cm.offset[cm.gm.coord_system][axis];
float offset = cm.offset[cm.gm.coord_system][axis] + cm.tl_offset[axis];
if (cm.gmx.origin_offset_enable == true) {
offset += cm.gmx.origin_offset[axis]; // includes G5x and G92 components
}
@@ -1042,7 +1042,7 @@ stat_t cm_set_arc_distance_mode(const uint8_t mode)
* It also does not reset the work_offsets which may be accomplished by calling
* cm_set_work_offsets() immediately afterwards.
*/
/*
stat_t cm_set_coord_offsets(const uint8_t coord_system,
const uint8_t L_word,
const float offset[], const bool flag[])
@@ -1068,14 +1068,128 @@ stat_t cm_set_coord_offsets(const uint8_t coord_system,
}
return (STAT_OK);
}
*/
stat_t cm_set_coord_offsets(const uint8_t coord_system,
const uint8_t L_word,
const float offset[], const bool flag[])
{
if (!cm.gf.L_word) {
return (STAT_L_WORD_IS_MISSING);
}
if ((L_word == 2) || (L_word == 20)) {
// coordinate system offset command
if ((coord_system < G54) || (coord_system > COORD_SYSTEM_MAX)) {
// you can't set G53
return (STAT_P_WORD_IS_INVALID);
}
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
if (flag[axis]) {
if (L_word == 2) {
cm.offset[coord_system][axis] = _to_millimeters(offset[axis]);
} else {
// Should L20 take into account G92 offsets?
cm.offset[coord_system][axis] =
cm.gmx.position[axis] - _to_millimeters(offset[axis]) -
cm.tl_offset[axis];
}
// persist offsets once machining cycle is over
cm.deferred_write_flag = true;
}
}
}
else if ((L_word == 1) || (L_word == 10)) {
// tool table offset command. L11 not supported atm.
if ((coord_system < 1) || (coord_system > TOOLS)) {
return (STAT_P_WORD_IS_INVALID);
}
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
if (flag[axis]) {
if (L_word == 1) {
cm.tt_offset[coord_system][axis] = _to_millimeters(offset[axis]);
} else {
// L10 should also take into account G92 offset
cm.tt_offset[coord_system][axis] =
cm.gmx.position[axis] - _to_millimeters(offset[axis]) -
cm.offset[cm.gm.coord_system][axis] -
(cm.gmx.origin_offset[axis] * cm.gmx.origin_offset_enable);
}
// persist offsets once machining cycle is over
cm.deferred_write_flag = true;
}
}
}
else {
return (STAT_L_WORD_IS_INVALID);
}
return (STAT_OK);
}
/******************************************************************************************
* Representation functions that affect gcode model and are queued to planner (synchronous)
*/
/*
* cm_set_tl_offset() - G43
* cm_cancel_tl_offset() - G49
* cm_set_coord_system() - G54-G59
* _exec_offset() - callback from planner
*/
stat_t cm_set_tl_offset(const uint8_t H_word, bool apply_additional)
{
uint8_t tool;
if (cm.gf.H_word)
{
if (cm.gn.H_word > TOOLS)
{
return (STAT_H_WORD_IS_INVALID);
}
if (cm.gn.H_word == 0)
{
// interpret H0 as "current tool", just like no H at all.
tool = cm.gm.tool;
}
else
{
tool = cm.gn.H_word;
}
}
else
{
tool = cm.gm.tool;
}
if (apply_additional)
{
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
cm.tl_offset[axis] += cm.tt_offset[tool][axis];
}
}
else
{
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
cm.tl_offset[axis] = cm.tt_offset[tool][axis];
}
}
float value[] = { (float)cm.gm.coord_system,0,0,0,0,0 };// pass coordinate system in value[0] element
bool flags[] = { 1,0,0,0,0,0 };
mp_queue_command(_exec_offset, value, flags); // second vector (flags) is not used, so fake it
return (STAT_OK);
}
stat_t cm_cancel_tl_offset()
{
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
cm.tl_offset[axis] = 0;
}
float value[] = { (float)cm.gm.coord_system,0,0,0,0,0 };// pass coordinate system in value[0] element
bool flags[] = { 1,0,0,0,0,0 };
mp_queue_command(_exec_offset, value, flags); // second vector (flags) is not used, so fake it
return (STAT_OK);
}
stat_t cm_set_coord_system(const uint8_t coord_system)
{
cm.gm.coord_system = (cmCoordSystem)coord_system;
@@ -1091,7 +1205,8 @@ static void _exec_offset(float *value, bool *flag)
uint8_t coord_system = ((uint8_t)value[0]); // coordinate system is passed in value[0] element
float offsets[AXES];
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
offsets[axis] = cm.offset[coord_system][axis] + (cm.gmx.origin_offset[axis] * cm.gmx.origin_offset_enable);
offsets[axis] = cm.offset[coord_system][axis] + cm.tl_offset[axis] +
(cm.gmx.origin_offset[axis] * cm.gmx.origin_offset_enable);
}
mp_set_runtime_work_offset(offsets);
cm_set_work_offsets(MODEL); // set work offsets in the Gcode model
@@ -1185,7 +1300,9 @@ stat_t cm_set_origin_offsets(const float offset[], const bool flag[])
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
if (flag[axis]) {
cm.gmx.origin_offset[axis] = cm.gmx.position[axis] -
cm.offset[cm.gm.coord_system][axis] - _to_millimeters(offset[axis]);
cm.offset[cm.gm.coord_system][axis] -
cm.tl_offset[axis] -
_to_millimeters(offset[axis]);
}
}
// now pass the offset to the callback - setting the coordinate system also applies the offsets
@@ -2237,6 +2354,14 @@ stat_t cm_get_ofs(nvObj_t *nv)
return (STAT_OK);
}
stat_t cm_get_tof(nvObj_t *nv)
{
nv->value = cm.tl_offset[_get_axis(nv->index)];
nv->precision = GET_TABLE_WORD(precision);
nv->valuetype = TYPE_FLOAT;
return (STAT_OK);
}
/*
* AXIS GET AND SET FUNCTIONS
*
@@ -2633,6 +2758,7 @@ static const char fmt_cpos[] = "[%s%s] %s %s position%18.3f%s\n";
static const char fmt_pos[] = "%c position:%15.3f%s\n";
static const char fmt_mpo[] = "%c machine posn:%11.3f%s\n";
static const char fmt_ofs[] = "%c work offset:%12.3f%s\n";
static const char fmt_tof[] = "%c tool length offset:%12.3f%s\n";
static const char fmt_hom[] = "%c axis homing state:%2.0f\n";
static void _print_axis_ui8(nvObj_t *nv, const char *format)
@@ -2710,6 +2836,7 @@ void cm_print_cpos(nvObj_t *nv) { _print_axis_coord_flt(nv, fmt_cpos);}
void cm_print_pos(nvObj_t *nv) { _print_pos(nv, fmt_pos, cm_get_units_mode(MODEL));}
void cm_print_mpo(nvObj_t *nv) { _print_pos(nv, fmt_mpo, MILLIMETERS);}
void cm_print_ofs(nvObj_t *nv) { _print_pos(nv, fmt_ofs, MILLIMETERS);}
void cm_print_tof(nvObj_t *nv) { _print_pos(nv, fmt_tof, MILLIMETERS);}
void cm_print_hom(nvObj_t *nv) { _print_hom(nv, fmt_hom);}
#endif // __TEXT_MODE
+135 -124
View File
@@ -152,26 +152,29 @@ typedef enum {
typedef enum { // these are in order to optimized CASE statement
NEXT_ACTION_DEFAULT = 0, // Must be zero (invokes motion modes)
NEXT_ACTION_DWELL, // G4
NEXT_ACTION_SET_COORD_DATA, // G10
NEXT_ACTION_GOTO_G28_POSITION, // G28 go to machine position
NEXT_ACTION_SET_G28_POSITION, // G28.1 set position in abs coordinates
NEXT_ACTION_SEARCH_HOME, // G28.2 homing cycle
NEXT_ACTION_SET_ABSOLUTE_ORIGIN, // G28.3 origin set
NEXT_ACTION_HOMING_NO_SET, // G28.4 homing cycle with no coordinate setting
NEXT_ACTION_SET_G28_POSITION, // G28.1 set position in abs coordinates
NEXT_ACTION_GOTO_G28_POSITION, // G28 go to machine position
NEXT_ACTION_SET_G30_POSITION, // G30.1
NEXT_ACTION_GOTO_G30_POSITION, // G30
NEXT_ACTION_SET_COORD_DATA, // G10
NEXT_ACTION_SET_ORIGIN_OFFSETS, // G92
NEXT_ACTION_RESET_ORIGIN_OFFSETS, // G92.1
NEXT_ACTION_SUSPEND_ORIGIN_OFFSETS, // G92.2
NEXT_ACTION_RESUME_ORIGIN_OFFSETS, // G92.3
NEXT_ACTION_DWELL, // G4
NEXT_ACTION_GOTO_G30_POSITION, // G30 go to machine position
NEXT_ACTION_SET_G30_POSITION, // G30.1 set position in abs coordinates
NEXT_ACTION_STRAIGHT_PROBE_ERR, // G38.2
NEXT_ACTION_STRAIGHT_PROBE, // G38.3
NEXT_ACTION_STRAIGHT_PROBE_AWAY_ERR,// G38.4
NEXT_ACTION_STRAIGHT_PROBE_AWAY, // G38.5
NEXT_ACTION_SET_TL_OFFSET, // G43
NEXT_ACTION_SET_ADDITIONAL_TL_OFFSET,// G43.2
NEXT_ACTION_CANCEL_TL_OFFSET, // G49
NEXT_ACTION_SET_ORIGIN_OFFSETS, // G92
NEXT_ACTION_RESET_ORIGIN_OFFSETS, // G92.1
NEXT_ACTION_SUSPEND_ORIGIN_OFFSETS, // G92.2
NEXT_ACTION_RESUME_ORIGIN_OFFSETS, // G92.3
NEXT_ACTION_JSON_COMMAND_SYNC, // M100
NEXT_ACTION_JSON_COMMAND_IMMEDIATE, // M101
NEXT_ACTION_JSON_WAIT // M102
NEXT_ACTION_JSON_WAIT // M101
// NEXT_ACTION_JSON_COMMAND_IMMEDIATE, // M102
} cmNextAction;
typedef enum { // G Modal Group 1
@@ -379,6 +382,7 @@ typedef struct GCodeInput { // Gcode model inputs - meaning depends
uint32_t linenum; // N word
float target[AXES]; // XYZABC where the move should go
uint8_t H_word; // H word - used by G43s
uint8_t L_word; // L word - used by G10s
float feed_rate; // F - normalized to millimeters/minute
@@ -425,6 +429,7 @@ typedef struct GCodeFlags { // Gcode model input flags
bool linenum;
bool target[AXES];
bool H_word;
bool L_word;
bool feed_rate;
bool feed_rate_mode;
@@ -506,6 +511,8 @@ typedef struct cmSingleton { // struct to manage cm globals and c
// coordinate systems and offsets
float offset[COORDS+1][AXES]; // persistent coordinate offsets: absolute (G53) + G54,G55,G56,G57,G58,G59
float tt_offset[TOOLS+1][AXES]; // persistent tool table offsets
float tl_offset[AXES]; // current tool length offset
// settings for axes X,Y,Z,A B,C
cfgAxis_t a[AXES];
@@ -641,6 +648,8 @@ stat_t cm_select_plane(const uint8_t plane); // G
stat_t cm_set_units_mode(const uint8_t mode); // G20, G21
stat_t cm_set_distance_mode(const uint8_t mode); // G90, G91
stat_t cm_set_arc_distance_mode(const uint8_t mode); // G90.1, G91.1
stat_t cm_set_tl_offset(const uint8_t H_word, bool apply_additional); // G43, G43.2
stat_t cm_cancel_tl_offset(void); // G49
stat_t cm_set_coord_offsets(const uint8_t coord_system, // G10
const uint8_t L_word,
const float offset[], const bool flag[]);
@@ -765,6 +774,7 @@ stat_t cm_get_feed(nvObj_t *nv); // get feed rate, converted to units
stat_t cm_get_pos(nvObj_t *nv); // get runtime work position...
stat_t cm_get_mpo(nvObj_t *nv); // get runtime machine position...
stat_t cm_get_ofs(nvObj_t *nv); // get runtime work offset...
stat_t cm_get_tof(nvObj_t *nv); // get runtime tool length offset...
stat_t cm_run_qf(nvObj_t *nv); // run queue flush
stat_t cm_run_home(nvObj_t *nv); // start homing cycle
@@ -796,135 +806,136 @@ stat_t cm_get_tram(nvObj_t *nv); // return if the rotation matrix is non-
#ifdef __TEXT_MODE
void cm_print_vel(nvObj_t *nv); // model state reporting
void cm_print_feed(nvObj_t *nv);
void cm_print_line(nvObj_t *nv);
void cm_print_stat(nvObj_t *nv);
void cm_print_macs(nvObj_t *nv);
void cm_print_cycs(nvObj_t *nv);
void cm_print_mots(nvObj_t *nv);
void cm_print_hold(nvObj_t *nv);
void cm_print_home(nvObj_t *nv);
void cm_print_hom(nvObj_t *nv);
void cm_print_unit(nvObj_t *nv);
void cm_print_coor(nvObj_t *nv);
void cm_print_momo(nvObj_t *nv);
void cm_print_plan(nvObj_t *nv);
void cm_print_path(nvObj_t *nv);
void cm_print_dist(nvObj_t *nv);
void cm_print_admo(nvObj_t *nv);
void cm_print_frmo(nvObj_t *nv);
void cm_print_tool(nvObj_t *nv);
void cm_print_g92e(nvObj_t *nv);
void cm_print_vel(nvObj_t *nv); // model state reporting
void cm_print_feed(nvObj_t *nv);
void cm_print_line(nvObj_t *nv);
void cm_print_stat(nvObj_t *nv);
void cm_print_macs(nvObj_t *nv);
void cm_print_cycs(nvObj_t *nv);
void cm_print_mots(nvObj_t *nv);
void cm_print_hold(nvObj_t *nv);
void cm_print_home(nvObj_t *nv);
void cm_print_hom(nvObj_t *nv);
void cm_print_unit(nvObj_t *nv);
void cm_print_coor(nvObj_t *nv);
void cm_print_momo(nvObj_t *nv);
void cm_print_plan(nvObj_t *nv);
void cm_print_path(nvObj_t *nv);
void cm_print_dist(nvObj_t *nv);
void cm_print_admo(nvObj_t *nv);
void cm_print_frmo(nvObj_t *nv);
void cm_print_tool(nvObj_t *nv);
void cm_print_g92e(nvObj_t *nv);
void cm_print_gpl(nvObj_t *nv); // Gcode defaults
void cm_print_gun(nvObj_t *nv);
void cm_print_gco(nvObj_t *nv);
void cm_print_gpa(nvObj_t *nv);
void cm_print_gdi(nvObj_t *nv);
void cm_print_gpl(nvObj_t *nv); // Gcode defaults
void cm_print_gun(nvObj_t *nv);
void cm_print_gco(nvObj_t *nv);
void cm_print_gpa(nvObj_t *nv);
void cm_print_gdi(nvObj_t *nv);
void cm_print_lin(nvObj_t *nv); // generic print for linear values
void cm_print_pos(nvObj_t *nv); // print runtime work position in prevailing units
void cm_print_mpo(nvObj_t *nv); // print runtime work position always in MM uints
void cm_print_ofs(nvObj_t *nv); // print runtime work offset always in MM uints
void cm_print_lin(nvObj_t *nv); // generic print for linear values
void cm_print_pos(nvObj_t *nv); // print runtime work position in prevailing units
void cm_print_mpo(nvObj_t *nv); // print runtime work position always in MM uints
void cm_print_ofs(nvObj_t *nv); // print runtime work offset always in MM uints
void cm_print_tof(nvObj_t *nv); // print tool length offset
void cm_print_jt(nvObj_t *nv); // global CM settings
void cm_print_ct(nvObj_t *nv);
void cm_print_sl(nvObj_t *nv);
void cm_print_lim(nvObj_t *nv);
void cm_print_saf(nvObj_t *nv);
void cm_print_jt(nvObj_t *nv); // global CM settings
void cm_print_ct(nvObj_t *nv);
void cm_print_sl(nvObj_t *nv);
void cm_print_lim(nvObj_t *nv);
void cm_print_saf(nvObj_t *nv);
void cm_print_m48e(nvObj_t *nv);
void cm_print_mfoe(nvObj_t *nv);
void cm_print_mfo(nvObj_t *nv);
void cm_print_mtoe(nvObj_t *nv);
void cm_print_mto(nvObj_t *nv);
void cm_print_m48e(nvObj_t *nv);
void cm_print_mfoe(nvObj_t *nv);
void cm_print_mfo(nvObj_t *nv);
void cm_print_mtoe(nvObj_t *nv);
void cm_print_mto(nvObj_t *nv);
void cm_print_tram(nvObj_t *nv); // print if the axis has been rotated
void cm_print_tram(nvObj_t *nv); // print if the axis has been rotated
void cm_print_am(nvObj_t *nv); // axis print functions
void cm_print_fr(nvObj_t *nv);
void cm_print_vm(nvObj_t *nv);
void cm_print_tm(nvObj_t *nv);
void cm_print_tn(nvObj_t *nv);
void cm_print_jm(nvObj_t *nv);
void cm_print_jh(nvObj_t *nv);
void cm_print_ra(nvObj_t *nv);
void cm_print_am(nvObj_t *nv); // axis print functions
void cm_print_fr(nvObj_t *nv);
void cm_print_vm(nvObj_t *nv);
void cm_print_tm(nvObj_t *nv);
void cm_print_tn(nvObj_t *nv);
void cm_print_jm(nvObj_t *nv);
void cm_print_jh(nvObj_t *nv);
void cm_print_ra(nvObj_t *nv);
void cm_print_hi(nvObj_t *nv);
void cm_print_hd(nvObj_t *nv);
void cm_print_sv(nvObj_t *nv);
void cm_print_lv(nvObj_t *nv);
void cm_print_lb(nvObj_t *nv);
void cm_print_zb(nvObj_t *nv);
void cm_print_cofs(nvObj_t *nv);
void cm_print_cpos(nvObj_t *nv);
void cm_print_hi(nvObj_t *nv);
void cm_print_hd(nvObj_t *nv);
void cm_print_sv(nvObj_t *nv);
void cm_print_lv(nvObj_t *nv);
void cm_print_lb(nvObj_t *nv);
void cm_print_zb(nvObj_t *nv);
void cm_print_cofs(nvObj_t *nv);
void cm_print_cpos(nvObj_t *nv);
#else // __TEXT_MODE
#define cm_print_vel tx_print_stub // model state reporting
#define cm_print_feed tx_print_stub
#define cm_print_line tx_print_stub
#define cm_print_stat tx_print_stub
#define cm_print_macs tx_print_stub
#define cm_print_cycs tx_print_stub
#define cm_print_mots tx_print_stub
#define cm_print_hold tx_print_stub
#define cm_print_home tx_print_stub
#define cm_print_hom tx_print_stub
#define cm_print_unit tx_print_stub
#define cm_print_coor tx_print_stub
#define cm_print_momo tx_print_stub
#define cm_print_plan tx_print_stub
#define cm_print_path tx_print_stub
#define cm_print_dist tx_print_stub
#define cm_print_admo tx_print_stub
#define cm_print_frmo tx_print_stub
#define cm_print_tool tx_print_stub
#define cm_print_g92e tx_print_stub
#define cm_print_vel tx_print_stub // model state reporting
#define cm_print_feed tx_print_stub
#define cm_print_line tx_print_stub
#define cm_print_stat tx_print_stub
#define cm_print_macs tx_print_stub
#define cm_print_cycs tx_print_stub
#define cm_print_mots tx_print_stub
#define cm_print_hold tx_print_stub
#define cm_print_home tx_print_stub
#define cm_print_hom tx_print_stub
#define cm_print_unit tx_print_stub
#define cm_print_coor tx_print_stub
#define cm_print_momo tx_print_stub
#define cm_print_plan tx_print_stub
#define cm_print_path tx_print_stub
#define cm_print_dist tx_print_stub
#define cm_print_admo tx_print_stub
#define cm_print_frmo tx_print_stub
#define cm_print_tool tx_print_stub
#define cm_print_g92e tx_print_stub
#define cm_print_gpl tx_print_stub // Gcode defaults
#define cm_print_gun tx_print_stub
#define cm_print_gco tx_print_stub
#define cm_print_gpa tx_print_stub
#define cm_print_gdi tx_print_stub
#define cm_print_gpl tx_print_stub // Gcode defaults
#define cm_print_gun tx_print_stub
#define cm_print_gco tx_print_stub
#define cm_print_gpa tx_print_stub
#define cm_print_gdi tx_print_stub
#define cm_print_lin tx_print_stub // generic print for linear values
#define cm_print_pos tx_print_stub // print runtime work position in prevailing units
#define cm_print_mpo tx_print_stub // print runtime work position always in MM units
#define cm_print_ofs tx_print_stub // print runtime work offset always in MM units
#define cm_print_lin tx_print_stub // generic print for linear values
#define cm_print_pos tx_print_stub // print runtime work position in prevailing units
#define cm_print_mpo tx_print_stub // print runtime work position always in MM units
#define cm_print_ofs tx_print_stub // print runtime work offset always in MM units
#define cm_print_jt tx_print_stub // global CM settings
#define cm_print_ct tx_print_stub
#define cm_print_sl tx_print_stub
#define cm_print_lim tx_print_stub
#define cm_print_saf tx_print_stub
#define cm_print_jt tx_print_stub // global CM settings
#define cm_print_ct tx_print_stub
#define cm_print_sl tx_print_stub
#define cm_print_lim tx_print_stub
#define cm_print_saf tx_print_stub
#define cm_print_m48e tx_print_stub
#define cm_print_mfoe tx_print_stub
#define cm_print_mfo tx_print_stub
#define cm_print_mtoe tx_print_stub
#define cm_print_mto tx_print_stub
#define cm_print_m48e tx_print_stub
#define cm_print_mfoe tx_print_stub
#define cm_print_mfo tx_print_stub
#define cm_print_mtoe tx_print_stub
#define cm_print_mto tx_print_stub
#define cm_print_am tx_print_stub // axis print functions
#define cm_print_fr tx_print_stub
#define cm_print_vm tx_print_stub
#define cm_print_tm tx_print_stub
#define cm_print_tn tx_print_stub
#define cm_print_jm tx_print_stub
#define cm_print_jh tx_print_stub
#define cm_print_ra tx_print_stub
#define cm_print_am tx_print_stub // axis print functions
#define cm_print_fr tx_print_stub
#define cm_print_vm tx_print_stub
#define cm_print_tm tx_print_stub
#define cm_print_tn tx_print_stub
#define cm_print_jm tx_print_stub
#define cm_print_jh tx_print_stub
#define cm_print_ra tx_print_stub
#define cm_print_hi tx_print_stub
#define cm_print_hd tx_print_stub
#define cm_print_sv tx_print_stub
#define cm_print_lv tx_print_stub
#define cm_print_lb tx_print_stub
#define cm_print_zb tx_print_stub
#define cm_print_cofs tx_print_stub
#define cm_print_cpos tx_print_stub
#define cm_print_hi tx_print_stub
#define cm_print_hd tx_print_stub
#define cm_print_sv tx_print_stub
#define cm_print_lv tx_print_stub
#define cm_print_lb tx_print_stub
#define cm_print_zb tx_print_stub
#define cm_print_cofs tx_print_stub
#define cm_print_cpos tx_print_stub
#define cm_print_pdt txt_print_stub
#define cm_print_pdt txt_print_stub
#endif // __TEXT_MODE
+27 -3
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