Emit feed mode state events
This commit is contained in:
@@ -111,6 +111,13 @@ void CanonEventSink::set_feed_rate(double feed, int line) {
|
||||
emit(event);
|
||||
}
|
||||
|
||||
void CanonEventSink::set_feed_mode(int mode, int line) {
|
||||
CncSimEvent event = base_event(CNC_SIM_EVENT_SET_FEED, line);
|
||||
event.feed = feed_;
|
||||
event.reserved = mode;
|
||||
emit(event);
|
||||
}
|
||||
|
||||
void CanonEventSink::set_spindle_speed(double spindle, int line) {
|
||||
spindle_ = spindle;
|
||||
CncSimEvent event = base_event(CNC_SIM_EVENT_SET_SPINDLE, line);
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
void use_length_units(double scale, int line);
|
||||
void select_plane(int plane, int line);
|
||||
void set_feed_rate(double feed, int line);
|
||||
void set_feed_mode(int mode, int line);
|
||||
void set_spindle_speed(double spindle, int line);
|
||||
void start_spindle(int direction, int line);
|
||||
void stop_spindle(int line);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string_view>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -296,6 +297,9 @@ void SET_FEED_REFERENCE(CANON_FEED_REFERENCE) {
|
||||
}
|
||||
|
||||
void SET_FEED_MODE(int, int) {
|
||||
if (active_sink) {
|
||||
active_sink->set_feed_mode(0, event_line());
|
||||
}
|
||||
}
|
||||
|
||||
void SET_MOTION_CONTROL_MODE(CANON_MOTION_MODE, double) {
|
||||
@@ -427,8 +431,17 @@ void RELOAD_TOOLDATA(void) {
|
||||
void CLAMP_AXIS(CANON_AXIS) {
|
||||
}
|
||||
|
||||
void COMMENT(const char *) {
|
||||
emit_state_event(CNC_SIM_EVENT_COMMENT, 0);
|
||||
void COMMENT(const char *message) {
|
||||
int reserved = 0;
|
||||
const std::string_view text = message ? std::string_view(message) : std::string_view();
|
||||
if (text.find("feed mode set to inverse time") != std::string_view::npos) {
|
||||
reserved = 93;
|
||||
} else if (text.find("feed mode set to units per minute") != std::string_view::npos) {
|
||||
reserved = 94;
|
||||
} else if (text.find("feed mode set to units per revolution") != std::string_view::npos) {
|
||||
reserved = 95;
|
||||
}
|
||||
emit_state_event(CNC_SIM_EVENT_COMMENT, reserved);
|
||||
}
|
||||
|
||||
void DISABLE_ADAPTIVE_FEED() {
|
||||
|
||||
@@ -314,6 +314,15 @@ int SmokeGcodeParser::parse(const char *program, size_t program_len, std::string
|
||||
absolute_ = true;
|
||||
} else if (g == 91) {
|
||||
absolute_ = false;
|
||||
} else if (g == 93 || g == 94 || g == 95) {
|
||||
emit_comment_state(sink_, line_number, g);
|
||||
if (stop_if_callback_aborted(sink_, error)) {
|
||||
return -1;
|
||||
}
|
||||
sink_.set_feed_mode(g == 95 ? 1 : 0, line_number);
|
||||
if (stop_if_callback_aborted(sink_, error)) {
|
||||
return -1;
|
||||
}
|
||||
} else if (g == 0 || g == 1 || g == 2 || g == 3) {
|
||||
modal_motion = g;
|
||||
} else if (g == 4) {
|
||||
|
||||
Reference in New Issue
Block a user