From d87b3a3e4cd3bd9a2da6c768afc07c94dc9953d6 Mon Sep 17 00:00:00 2001 From: Alden Hart Date: Mon, 6 Mar 2017 11:44:42 -0500 Subject: [PATCH] Removed MOTION_PLANNING from motion state. Not needed anymore. --- g2core/canonical_machine.cpp | 2 -- g2core/canonical_machine.h | 13 ++++++------- g2core/planner.cpp | 6 +----- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/g2core/canonical_machine.cpp b/g2core/canonical_machine.cpp index f0272250..15498dea 100644 --- a/g2core/canonical_machine.cpp +++ b/g2core/canonical_machine.cpp @@ -262,7 +262,6 @@ void cm_set_motion_state(const cmMotionState motion_state) switch (motion_state) { case (MOTION_STOP): { ACTIVE_MODEL = MODEL; break; } - case (MOTION_PLANNING): { ACTIVE_MODEL = RUNTIME; break; } case (MOTION_RUN): { ACTIVE_MODEL = RUNTIME; break; } case (MOTION_HOLD): { ACTIVE_MODEL = RUNTIME; break; } } @@ -311,7 +310,6 @@ cmCombinedState cm_get_combined_state(cmMachine_t *_cm) case CYCLE_MACHINING: case CYCLE_NONE: { switch(_cm->motion_state) { case MOTION_STOP: { return (COMBINED_RUN); } // See NOTE_1, above - case MOTION_PLANNING: { return (COMBINED_RUN); } case MOTION_RUN: { return (COMBINED_RUN); } case MOTION_HOLD: { return (COMBINED_HOLD); } default: { diff --git a/g2core/canonical_machine.h b/g2core/canonical_machine.h index fea8b4e1..d0d6f611 100644 --- a/g2core/canonical_machine.h +++ b/g2core/canonical_machine.h @@ -93,6 +93,12 @@ typedef enum { MACHINE_PANIC // machine is in panic state } cmMachineState; +typedef enum { + MOTION_STOP = 0, // motion has stopped: set when the steppers reach the end of the planner queue + MOTION_RUN, // machine is in motion: set when the steppers execute an ALINE segment + MOTION_HOLD // feedhold in progress: set whenever we leave FEEDHOLD_OFF, unset whenever we enter FEEDHOLD_OFF +} cmMotionState; + typedef enum { CYCLE_NONE = 0, // machine is not ins a cycle CYCLE_MACHINING, // in normal machining cycle @@ -103,13 +109,6 @@ typedef enum { // ... } cmCycleType; -typedef enum { - MOTION_STOP = 0, // motion has stopped: set when the steppers reach the end of the planner queue - MOTION_PLANNING, // machine has planned an ALINE segment, but not yet started to execute them - MOTION_RUN, // machine is in motion: set when the steppers execute an ALINE segment - MOTION_HOLD // feedhold in progress: set whenever we leave FEEDHOLD_OFF, unset whenever we enter FEEDHOLD_OFF -} cmMotionState; - typedef enum { // feedhold requests FEEDHOLD_NO_REQUEST = 0, // no pending request; reverts here when complete (read-only; cannot be set) FEEDHOLD_HOLD_P1, // enter p1 feedhold, enter HOLD state in p1 diff --git a/g2core/planner.cpp b/g2core/planner.cpp index dc445862..ba4c7ba8 100644 --- a/g2core/planner.cpp +++ b/g2core/planner.cpp @@ -785,11 +785,7 @@ void mp_commit_write_buffer(const blockType block_type) q->w->block_type = block_type; q->w->block_state = BLOCK_INITIAL_ACTION; - if (block_type == BLOCK_TYPE_ALINE) { - if (cm->motion_state == MOTION_STOP) { - cm_set_motion_state(MOTION_PLANNING); - } - } else { + if (block_type != BLOCK_TYPE_ALINE) { if ((mp->planner_state > PLANNER_STARTUP) && (cm->hold_state == FEEDHOLD_OFF)) { // NB: BEWARE! the requested exec may result in the planner buffer being // processed IMMEDIATELY and then freed - invalidating the contents