Removed MOTION_HOLD state

This commit is contained in:
Alden Hart
2017-03-11 08:55:50 -05:00
parent 741014988d
commit c5a969775c
4 changed files with 17 additions and 14 deletions
+6 -5
View File
@@ -259,12 +259,13 @@ stat_t canonical_machine_test_assertions(cmMachine_t *_cm)
void cm_set_motion_state(const cmMotionState motion_state)
{
cm->motion_state = motion_state;
ACTIVE_MODEL = (motion_state ? MODEL : RUNTIME);
switch (motion_state) {
case (MOTION_STOP): { ACTIVE_MODEL = MODEL; break; }
case (MOTION_RUN): { ACTIVE_MODEL = RUNTIME; break; }
case (MOTION_HOLD): { ACTIVE_MODEL = RUNTIME; break; }
}
// switch (motion_state) {
// case (MOTION_STOP): { ACTIVE_MODEL = MODEL; break; }
// case (MOTION_RUN): { ACTIVE_MODEL = RUNTIME; break; }
// case (MOTION_HOLD): { ACTIVE_MODEL = RUNTIME; break; }
// }
}
/*
+2 -2
View File
@@ -95,8 +95,8 @@ typedef enum { // Note: MachineState signals if the machine is
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
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 {
+3 -3
View File
@@ -428,7 +428,7 @@ void cm_start_hold()
{
// Can only request a feedhold if the machine is in motion and there not one is not already in progress
if ((cm1.hold_state == FEEDHOLD_OFF) && (mp_has_runnable_buffer(mp))) {
cm_set_motion_state(MOTION_HOLD);
// cm_set_motion_state(MOTION_HOLD);
cm1.hold_state = FEEDHOLD_SYNC; // invokes hold from aline execution
}
}
@@ -463,7 +463,7 @@ stat_t cm_feedhold_sequencing_callback()
// invoking a p1 feedhold is a 2 step process - get to the stop, then execute the hold actions
if (cm1.hold_state == FEEDHOLD_INITIATED) {
if (mp_has_runnable_buffer(&mp1)) { // bypass cm_start_hold() to start from here
cm_set_motion_state(MOTION_HOLD);
// cm_set_motion_state(MOTION_HOLD);
cm1.hold_state = FEEDHOLD_SYNC; // invokes hold from aline execution
}
}
@@ -474,7 +474,7 @@ stat_t cm_feedhold_sequencing_callback()
// p2 feedhold states - feedhold in feedhold
if (cm2.hold_state == FEEDHOLD_INITIATED) {
if (mp_has_runnable_buffer(&mp2)) {
cm_set_motion_state(MOTION_HOLD);
// cm_set_motion_state(MOTION_HOLD);
cm2.hold_state = FEEDHOLD_SYNC;
}
}
+6 -4
View File
@@ -307,8 +307,8 @@ stat_t mp_exec_move()
}
// Manage motion state transitions
if ((cm->motion_state != MOTION_RUN) && (cm->motion_state != MOTION_HOLD)) {
// +++++ if (cm->motion_state != MOTION_RUN) {
// if ((cm->motion_state != MOTION_RUN) && (cm->motion_state != MOTION_HOLD)) {
if (cm->motion_state != MOTION_RUN) {
cm_set_motion_state(MOTION_RUN); // also sets active model to RUNTIME
}
}
@@ -486,7 +486,8 @@ stat_t mp_exec_aline(mpBuf_t *bf)
// Feed Override Processing - We need to handle the following cases (listed in rough sequence order):
// Feedhold Processing - We need to handle the following cases (listed in rough sequence order):
if (cm->motion_state == MOTION_HOLD) {
// if (cm->motion_state == MOTION_HOLD) {
if (cm->hold_state != FEEDHOLD_OFF) {
// if FEEDHOLD_P2_START, FEEDHOLD_P2_WAIT, FEEDHOLD HOLD or FEEDHOLD_P2_EXIT
if (cm->hold_state >= FEEDHOLD_P2_START) { // handles _exec_aline_feedhold_processing case (7)
return (STAT_NOOP); // VERY IMPORTANT to exit as a NOOP. Do not load another move
@@ -899,7 +900,8 @@ static stat_t _exec_aline_segment()
// Otherwise if not at a section waypoint compute target from segment time and velocity
// Don't do waypoint correction if you are going into a hold.
if ((--mr->segment_count == 0) && (cm->motion_state != MOTION_HOLD)) {
// if ((--mr->segment_count == 0) && (cm->motion_state != MOTION_HOLD)) {
if ((--mr->segment_count == 0) && (cm->hold_state == FEEDHOLD_OFF)) {
copy_vector(mr->gm.target, mr->waypoint[mr->section]);
} else {
float segment_length = mr->segment_velocity * mr->segment_time;