From f13278e72a32928ea8d4df58d5fd230b291c749f Mon Sep 17 00:00:00 2001 From: Alden Hart Date: Wed, 25 Jan 2017 10:35:23 -0500 Subject: [PATCH] Corrected arc entry condition that was not properly trapped; more feedhold testing --- g2core/cycle_feedhold.cpp | 4 +++- g2core/error.h | 8 ++++---- g2core/g2core.cppproj | 8 ++++---- g2core/gcode_parser.cpp | 2 +- g2core/plan_arc.cpp | 11 ++++++++++- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/g2core/cycle_feedhold.cpp b/g2core/cycle_feedhold.cpp index cdb45738..06c570ec 100644 --- a/g2core/cycle_feedhold.cpp +++ b/g2core/cycle_feedhold.cpp @@ -341,11 +341,13 @@ stat_t cm_exit_hold_finalize() mr = mp->mr; cm_select = CM_PRIMARY; - // if queue flush occurred adjust primary planner positions to runtime positions + // execute this block if a queue flush was performed + // adjust primary planner positions to runtime positions if (cm1.queue_flush_state == FLUSH_WAS_RUN) { for (uint8_t axis = AXIS_X; axis < AXES; axis++) { cm_set_position(axis, mp_get_runtime_absolute_position(&mr2, axis)); } + // TODO: reset motion mode to G80 or G0. Others? cm1.queue_flush_state = FLUSH_OFF; } diff --git a/g2core/error.h b/g2core/error.h index b3c3f68a..4f4024c9 100644 --- a/g2core/error.h +++ b/g2core/error.h @@ -249,9 +249,9 @@ char *get_status_message(stat_t status); #define STAT_SPINDLE_SPEED_MAX_EXCEEDED 150 #define STAT_SPINDLE_MUST_BE_OFF 151 #define STAT_SPINDLE_MUST_BE_TURNING 152 // some canned cycles require spindle to be turning when called -#define STAT_ARC_ERROR_RESERVED 153 // RESERVED +#define STAT_ARC_SPECIFICATION_ERROR 153 // generic arc specification error #define STAT_ARC_HAS_IMPOSSIBLE_CENTER_POINT 154 // trap (.05 inch/.5 mm) OR ((.0005 inch/.005mm) AND .1% of radius condition -#define STAT_ARC_SPECIFICATION_ERROR 155 // generic arc specification error +#define STAT_ARC_HAS_ROTARY_AXIS 155 // arc specification includes a rotary axis #define STAT_ARC_AXIS_MISSING_FOR_SELECTED_PLANE 156 // arc is missing axis (axes) required by selected plane #define STAT_ARC_OFFSETS_MISSING_FOR_SELECTED_PLANE 157 // one or both offsets are not specified #define STAT_ARC_RADIUS_OUT_OF_TOLERANCE 158 // WARNING - radius arc is too large - accuracy in question @@ -543,9 +543,9 @@ static const char stat_149[] = "Spindle speed below minimum"; static const char stat_150[] = "Spindle speed exceeded maximum"; static const char stat_151[] = "Spindle must be off for this command"; static const char stat_152[] = "Spindle must be turning for this command"; -static const char stat_153[] = "153"; +static const char stat_153[] = "Arc specification error"; static const char stat_154[] = "Arc specification error - impossible center point"; -static const char stat_155[] = "Arc specification error"; +static const char stat_155[] = "Arc specification error - arc has rotary axis(es)"; static const char stat_156[] = "Arc specification error - missing axis(es)"; static const char stat_157[] = "Arc specification error - missing offset(s)"; //--------------------------------------1--------10--------20--------30--------40--------50--------60-64 diff --git a/g2core/g2core.cppproj b/g2core/g2core.cppproj index 0f767602..36e55b55 100644 --- a/g2core/g2core.cppproj +++ b/g2core/g2core.cppproj @@ -68,12 +68,12 @@ - 9836116 + 10000000 SWD com.atmel.avrdbg.tool.atmelice - J41800030015 + J41800036434 Atmel-ICE True @@ -100,9 +100,9 @@ True true - J41800030015 + J41800036434 0x284E0A60 - 9836116 + 10000000 diff --git a/g2core/gcode_parser.cpp b/g2core/gcode_parser.cpp index 8f8f5fc1..d0bc3cdd 100644 --- a/g2core/gcode_parser.cpp +++ b/g2core/gcode_parser.cpp @@ -724,7 +724,7 @@ static stat_t _parse_gcode_block(char *buf, char *active_comment) * 20. perform motion (G0 to G3, G80-G89) as modified (possibly) by G53 * 21. stop and end (M0, M1, M2, M30, M60) * - * Values in gn are in original units and should not be unit converted prior + * Values in gv are in original units and should not be unit converted prior * to calling the canonical functions (which do the unit conversions) */ diff --git a/g2core/plan_arc.cpp b/g2core/plan_arc.cpp index 49389f29..963db602 100644 --- a/g2core/plan_arc.cpp +++ b/g2core/plan_arc.cpp @@ -105,7 +105,7 @@ stat_t cm_arc_feed(const float target[], const bool target_f[], // target en const cmMotionMode motion_mode) // defined motion mode { // Start setting up the arc and trapping arc specification errors - + // Trap some precursor cases. Since motion mode (MODAL_GROUP_G1) persists from the // previous move it's possible for non-modal commands such as F or P to arrive here // when no motion has actually been specified. It's also possible to run an arc as @@ -127,6 +127,15 @@ stat_t cm_arc_feed(const float target[], const bool target_f[], // target en // Some things you might think are errors but are not: // - offset specified for linear axis (i.e. not one of the plane axes). Ignored // - rotary axes are present. Ignored + // - no parameters are specified. This can happen when G2 or G3 motion mode persists but + // a non-arc, non-motion command is entered afterwards, such as M3 or T. Trapped here: + + // Trap if no parameters were specified while in CW or CCW arc motion mode. This is OK + if (!(target_f[AXIS_X] | target_f[AXIS_Y] | target_f[AXIS_Z] | + offset_f[AXIS_X] | offset_f[AXIS_Y] | offset_f[AXIS_Z] | + radius_f | P_word_f)) { + return(STAT_OK); + } // trap missing feed rate if (fp_ZERO(cm->gm.feed_rate)) {