Emit program stop events for LinuxCNC stops
This commit is contained in:
@@ -192,6 +192,12 @@ void CanonEventSink::program_end(int line) {
|
||||
emit(base_event(CNC_SIM_EVENT_PROGRAM_END, line));
|
||||
}
|
||||
|
||||
void CanonEventSink::program_stop(int line, int kind) {
|
||||
CncSimEvent event = base_event(CNC_SIM_EVENT_PROGRAM_END, line);
|
||||
event.reserved = kind;
|
||||
emit(event);
|
||||
}
|
||||
|
||||
void CanonEventSink::emit_raw(CncSimEvent event) {
|
||||
if (event.version == 0) {
|
||||
event.version = 1;
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
void straight_probe(int line, const CncSimPose &end);
|
||||
void dwell(double seconds, int line);
|
||||
void program_end(int line);
|
||||
void program_stop(int line, int kind);
|
||||
void emit_raw(CncSimEvent event);
|
||||
|
||||
const CncSimPose &position() const;
|
||||
|
||||
@@ -471,6 +471,9 @@ void MIST_ON() {
|
||||
}
|
||||
|
||||
void PALLET_SHUTTLE() {
|
||||
if (active_sink) {
|
||||
active_sink->program_stop(event_line(), 3);
|
||||
}
|
||||
}
|
||||
|
||||
void TURN_PROBE_OFF() {
|
||||
@@ -499,6 +502,9 @@ bool GET_BLOCK_DELETE(void) {
|
||||
}
|
||||
|
||||
void OPTIONAL_PROGRAM_STOP() {
|
||||
if (active_sink) {
|
||||
active_sink->program_stop(event_line(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
void SET_OPTIONAL_PROGRAM_STOP(bool) {
|
||||
@@ -509,6 +515,9 @@ bool GET_OPTIONAL_PROGRAM_STOP() {
|
||||
}
|
||||
|
||||
void PROGRAM_STOP() {
|
||||
if (active_sink) {
|
||||
active_sink->program_stop(event_line(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
void SET_MOTION_OUTPUT_BIT(int) {
|
||||
|
||||
@@ -351,6 +351,16 @@ int SmokeGcodeParser::parse(const char *program, size_t program_len, std::string
|
||||
if (stop_if_callback_aborted(sink_, error)) {
|
||||
return -1;
|
||||
}
|
||||
} else if (m == 0) {
|
||||
sink_.program_stop(line_number, 1);
|
||||
if (stop_if_callback_aborted(sink_, error)) {
|
||||
return -1;
|
||||
}
|
||||
} else if (m == 1) {
|
||||
sink_.program_stop(line_number, 2);
|
||||
if (stop_if_callback_aborted(sink_, error)) {
|
||||
return -1;
|
||||
}
|
||||
} else if (m == 6) {
|
||||
sink_.change_tool(line_number);
|
||||
if (stop_if_callback_aborted(sink_, error)) {
|
||||
@@ -371,6 +381,11 @@ int SmokeGcodeParser::parse(const char *program, size_t program_len, std::string
|
||||
if (stop_if_callback_aborted(sink_, error)) {
|
||||
return -1;
|
||||
}
|
||||
} else if (m == 60) {
|
||||
sink_.program_stop(line_number, 3);
|
||||
if (stop_if_callback_aborted(sink_, error)) {
|
||||
return -1;
|
||||
}
|
||||
} else if (m == 2 || m == 30) {
|
||||
sink_.program_end(line_number);
|
||||
if (stop_if_callback_aborted(sink_, error)) {
|
||||
|
||||
Reference in New Issue
Block a user