Stubbed in an explicit job kill command - instead of just treating it like an alarm.

This commit is contained in:
Alden Hart
2017-03-03 07:17:56 -05:00
parent d2b27a014f
commit f9dc7e6942
5 changed files with 28 additions and 4 deletions
+15
View File
@@ -249,3 +249,18 @@ stat_t cm_panic(const stat_t status, const char *msg)
rpt_exception(status, msg); // send panic report
return (status);
}
/****************************************************************************************
* cm_job_kill() - Control-D handler
*/
void cm_job_kill()
{
cm->job_kill_requested = true;
if (cm->machine_state == MACHINE_ALARM) {
cm->machine_state = MACHINE_PROGRAM_STOP;
} else if (cm->machine_state == MACHINE_SHUTDOWN) {
cm->machine_state = MACHINE_READY;
}
}
+2
View File
@@ -260,6 +260,7 @@ typedef struct cmMachine { // struct to manage canonical machin
uint8_t shutdown_requested; // set non-zero to request shutdown in support of external estop (value is input number)
bool deferred_write_flag; // G10 data has changed (e.g. offsets) - flag to persist them
bool hold_exit_requested; // request exit from feedhold
bool job_kill_requested; // ^d job kill received
bool return_flags[AXES]; // flags for recording which axes moved - used in feedhold exit move
cmHomingState homing_state; // home: homing cycle sub-state machine
@@ -477,6 +478,7 @@ void cm_halt_motion(void); // halt motion (
stat_t cm_alarm(const stat_t status, const char *msg); // enter alarm state - preserve Gcode state
stat_t cm_shutdown(const stat_t status, const char *msg); // enter shutdown state - dump all state
stat_t cm_panic(const stat_t status, const char *msg); // enter panic state - needs RESET
void cm_job_kill(void); // control-D handler
/**** cfgArray interface functions ****/
+1 -1
View File
@@ -239,7 +239,7 @@ static void _dispatch_kernel(const devflags_t flags)
if (*cs.bufp == '!') { cm_request_feedhold(); }
else if (*cs.bufp == '%') { cm_request_queue_flush(); xio_flush_to_command(); }
else if (*cs.bufp == '~') { cm_request_exit_hold(); }
else if (*cs.bufp == EOT) { cm_alarm(STAT_KILL_JOB, "EOT Received"); }
else if (*cs.bufp == EOT) { cm_job_kill(); }
else if (*cs.bufp == ENQ) { controller_request_enquiry(); }
else if (*cs.bufp == CAN) { hw_hard_reset(); } // reset immediately
+2 -2
View File
@@ -73,7 +73,7 @@
<InterfaceName>SWD</InterfaceName>
</ToolOptions>
<ToolType>com.atmel.avrdbg.tool.atmelice</ToolType>
<ToolNumber>J41800019454</ToolNumber>
<ToolNumber>J41800036434</ToolNumber>
<ToolName>Atmel-ICE</ToolName>
</com_atmel_avrdbg_tool_atmelice>
<UseGdb>True</UseGdb>
@@ -100,7 +100,7 @@
<HWProgramCounterSampling>True</HWProgramCounterSampling>
</PercepioTrace>
<preserveEEPROM>true</preserveEEPROM>
<avrtoolserialnumber>J41800019454</avrtoolserialnumber>
<avrtoolserialnumber>J41800036434</avrtoolserialnumber>
<avrdeviceexpectedsignature>0x284E0A60</avrdeviceexpectedsignature>
<avrtoolinterfaceclock>10000000</avrtoolinterfaceclock>
<custom>
+8 -1
View File
@@ -240,6 +240,13 @@ stat_t mp_exec_move()
{
mpBuf_t *bf;
// It is possible to try to try to exec from a priming planner if coming off a hold
// This occurs if new p1 commands (and were held back) arrived while in a hold
// if (mp->planner_state <= PLANNER_PRIMING) {
// st_prep_null();
// return (STAT_NOOP);
// }
// Run an out of band dwell. It was probably set in the previous st_load_move()
if (mr->out_of_band_dwell_flag) {
mr->out_of_band_dwell_flag = false;
@@ -258,7 +265,7 @@ stat_t mp_exec_move()
// first-time operations
if (bf->buffer_state != MP_BUFFER_RUNNING) {
if ((bf->buffer_state < MP_BUFFER_PREPPED) && (cm->motion_state == MOTION_RUN)) {
debug_trap("mp_exec_move() buffer is not prepped. Starvation"); // IMPORTANT: can't rpt_exception from here!
// debug_trap("mp_exec_move() buffer is not prepped. Starvation"); // IMPORTANT: can't rpt_exception from here!
st_prep_null();
return (STAT_NOOP);
}