DRO works properly with work offsets. Offsets can be zeroed.

This commit is contained in:
2023-05-04 15:57:34 +03:00
parent cacbe1b8aa
commit 3ea1ca5efa
3 changed files with 219 additions and 167 deletions
+57 -11
View File
@@ -373,16 +373,25 @@ std::string grbl::setting_description(int number) {
case 75: case 75:
return "Bluetooth service ()\nBluetooth service name."; return "Bluetooth service ()\nBluetooth service name.";
case 80: return "Spindle P-gain"; case 80:
case 81: return "Spindle I-gain"; return "Spindle P-gain";
case 82: return "Spindle D-gain"; case 81:
case 84: return "Spindle PID max error"; return "Spindle I-gain";
case 85: return "Spindle PID max I error\nSpindle PID max integrator error"; case 82:
return "Spindle D-gain";
case 84:
return "Spindle PID max error";
case 85:
return "Spindle PID max I error\nSpindle PID max integrator error";
case 90: return "Spindle sync P-gain"; case 90:
case 91: return "Spindle sync I-gain"; return "Spindle sync P-gain";
case 92: return "Spindle sync D-gain"; case 91:
case 95: return "Spindle sync PID max I error\nSpindle sync PID max integrator error"; return "Spindle sync I-gain";
case 92:
return "Spindle sync D-gain";
case 95:
return "Spindle sync PID max I error\nSpindle sync PID max integrator error";
case 100: case 100:
return "X-axis travel resolution (step/mm)\nX-axis travel resolution in steps per millimeter."; return "X-axis travel resolution (step/mm)\nX-axis travel resolution in steps per millimeter.";
@@ -609,6 +618,30 @@ const std::map<std::string, std::string, grbl::parameters_cmp>& grbl::machine::g
return parameters; return parameters;
} }
void grbl::machine::zero_offset(int which) {
while (awaiting_responses > 0);
pipe->send("G10 L20 P" + std::to_string(1 + which) + " X0 Y0 Z0"); // P1 => G54
awaiting_responses++;
while (awaiting_responses > 0);
pipe->send("$#");
awaiting_responses++;
while (awaiting_responses > 0);
listener->on_parameters_reloaded();
}
void grbl::machine::zero_offset_axis(int offset_index, int axis) {
while (awaiting_responses > 0);
pipe->send("G10 L20 P" + std::to_string(1 + offset_index) + " " + char('X' + axis) + "0"); // P1 => G54
awaiting_responses++;
while (awaiting_responses > 0);
pipe->send("$#");
awaiting_responses++;
while (awaiting_responses > 0);
listener->on_parameters_reloaded();
}
bool grbl::jog_state::no_jogging() const { bool grbl::jog_state::no_jogging() const {
return !(up_pressed || down_pressed || left_pressed || right_pressed || z_up_pressed || z_down_pressed); return !(up_pressed || down_pressed || left_pressed || right_pressed || z_up_pressed || z_down_pressed);
} }
@@ -678,7 +711,7 @@ void grbl::machine_state_init::move_to_next_init_stage() {
switch (init_state) { switch (init_state) {
case init_stage::start: case init_stage::start:
init_state = init_stage::set_work_pos; init_state = init_stage::set_work_pos;
cnc->pipe->send("$10=0"); cnc->pipe->send("$10=1"); // machine pos in report, please
break; break;
case init_stage::set_work_pos: case init_stage::set_work_pos:
init_state = init_stage::fetch_settings; init_state = init_stage::fetch_settings;
@@ -714,18 +747,31 @@ void grbl::machine_state_idle::on_exit(grbl::machine *m) {
void grbl::machine_state_idle::on_line_received(std::string line) { void grbl::machine_state_idle::on_line_received(std::string line) {
if (starts_with(line, "ok")) { if (starts_with(line, "ok")) {
if (cnc->awaiting_responses > 0) {
cnc->awaiting_responses--;
}
} else if (starts_with(line, "error")) { } else if (starts_with(line, "error")) {
if (cnc->awaiting_responses > 0) {
cnc->awaiting_responses--;
}
} else if (starts_with(line, "Grbl")) { } else if (starts_with(line, "Grbl")) {
cnc->listener->on_banner(line); cnc->listener->on_banner(line);
cnc->reset_machine_state(); cnc->reset_machine_state();
} else if (starts_with(line, "<")) { } else if (starts_with(line, "<")) {
cnc->last_report = parse_status_report(line, cnc->last_report); cnc->last_report = parse_status_report(line, cnc->last_report);
cnc->listener->on_realtime_status_report(cnc->last_report); cnc->listener->on_realtime_status_report(cnc->last_report);
} else if (starts_with(line, "[MSG:")) { } else if (starts_with(line, "[MSG:")) {
cnc->listener->on_message(line.substr(5, line.size() - 6)); cnc->listener->on_message(line.substr(5, line.size() - 6));
} else if (starts_with(line, "ALARM:")) { } else if (starts_with(line, "ALARM:")) {
cnc->listener->on_alarm(std::stoi(line.substr(6))); cnc->listener->on_alarm(std::stoi(line.substr(6)));
} else if (starts_with(line, "$")) {
auto pieces = split_string(line, "=");
cnc->settings[pieces[0]] = pieces[1];
} else if (starts_with(line, "[G") || starts_with(line, "[H") || starts_with(line, "[T") || starts_with(line, "[P")) {
line = line.substr(1, line.size() - 2);
// TODO: some parameters have more than two :
auto pieces = split_string(line, ":");
cnc->parameters[pieces[0]] = pieces[1];
} }
} }
+8 -1
View File
@@ -112,6 +112,8 @@ struct machine_listener {
virtual void on_init_completed() = 0; virtual void on_init_completed() = 0;
virtual void on_run_completed(bool success, size_t failed_index, size_t error) = 0; virtual void on_run_completed(bool success, size_t failed_index, size_t error) = 0;
virtual void on_check_completed(bool success, size_t failed_index, size_t error) = 0; virtual void on_check_completed(bool success, size_t failed_index, size_t error) = 0;
virtual void on_settings_reloaded() = 0;
virtual void on_parameters_reloaded() = 0;
}; };
@@ -210,10 +212,14 @@ struct machine : public transport_callbacks {
void request_unlock(); void request_unlock();
void request_home(); void request_home();
void request_reset(); void request_reset();
void request_cycle_start(); void request_cycle_start();
void request_feed_hold(); void request_feed_hold();
// 0 = G54, 1 = G55, etc
void zero_offset(int which);
// 0 = G54, 1 = G55, etc axis 0=X, 1=Y, 2=Z
void zero_offset_axis(int offset_index, int axis);
protected: protected:
void on_connected(transport *transport) override; void on_connected(transport *transport) override;
@@ -232,6 +238,7 @@ protected:
std::map<std::string, std::string, settings_cmp> settings; std::map<std::string, std::string, settings_cmp> settings;
std::map<std::string, std::string, parameters_cmp> parameters; std::map<std::string, std::string, parameters_cmp> parameters;
volatile size_t awaiting_responses = 0;
realtime_status_report last_report{}; realtime_status_report last_report{};
machine_listener *listener = nullptr; machine_listener *listener = nullptr;
transport *pipe = nullptr; transport *pipe = nullptr;
+154 -155
View File
@@ -51,7 +51,6 @@ public:
Window *window; Window *window;
grbl::jog_state jog; grbl::jog_state jog;
Label *m_pos_x, *m_pos_y, *m_pos_z;
TextArea *lblStatus, *lblSubstatus; TextArea *lblStatus, *lblSubstatus;
nanogui::Color colRed = nanogui::Color(255, 0, 0, 255); nanogui::Color colRed = nanogui::Color(255, 0, 0, 255);
nanogui::Color colGreen = nanogui::Color(0, 255, 0, 255); nanogui::Color colGreen = nanogui::Color(0, 255, 0, 255);
@@ -60,7 +59,6 @@ public:
grbl::program pgm; grbl::program pgm;
Button *btnLoadProgram, *btnCheckProgram, *btnRunProgram; Button *btnLoadProgram, *btnCheckProgram, *btnRunProgram;
grbl::program_renderer renderer; grbl::program_renderer renderer;
glm::vec3 cam_target = glm::vec3(0); glm::vec3 cam_target = glm::vec3(0);
@@ -74,66 +72,10 @@ public:
VScrollPanel *parameters_vscroll; VScrollPanel *parameters_vscroll;
Widget *parameters_layer; Widget *parameters_layer;
TextBox *mpos_x_text, *mpos_y_text, *mpos_z_text; TextBox *mpos_x_text, *mpos_y_text, *mpos_z_text;
ComboBox *cboOffset, *cboTool;
void fill_in_settings() { float offset_x = 0;
settings_vscroll = new VScrollPanel(tab_widget); float offset_y = 0;
tab_widget->append_tab("Settings", settings_vscroll); float offset_z = 0;
settings_layer = new Widget(settings_vscroll);
settings_layer->set_layout(new GridLayout(Orientation::Horizontal, 1, Alignment::Middle));
auto& settings = cnc.get_settings();
for (auto& s: settings) {
auto w = settings_layer->add<Widget>();
w->set_layout(new BoxLayout(Orientation::Horizontal, Alignment::Middle, 2, 2));
auto x = w->add<Label>(s.first, "sans-bold", 20);
x->set_fixed_width(40);
auto desc = grbl::setting_description(std::stoi(s.first.substr(1)));
auto y = w->add<TextBox>(s.second);
y->set_editable(true);
y->set_tooltip(desc);
y->set_fixed_width(200);
auto z = w->add<ToolButton>(FA_SAVE);
z->set_flags(Button::Flags::NormalButton); // no toggle, please
z->set_tooltip("save");
auto t = w->add<TextArea>();
t->set_fixed_width(200);
t->set_fixed_height(20);
t->clear();
t->append(desc.substr(0, desc.find_first_of('\n')));
}
}
void fill_in_parameters() {
parameters_vscroll = new VScrollPanel(tab_widget);
tab_widget->append_tab("Parameters", parameters_vscroll);
parameters_layer = new Widget(parameters_vscroll);
parameters_layer->set_layout(new GridLayout(Orientation::Horizontal, 1, Alignment::Middle));
auto& parameters = cnc.get_parameters();
for (auto& entry: parameters) {
auto w = parameters_layer->add<Widget>();
w->set_layout(new BoxLayout(Orientation::Horizontal, Alignment::Middle, 2, 2));
auto x = w->add<Label>(entry.first, "sans-bold", 20);
x->set_fixed_width(50);
auto y = w->add<TextBox>(entry.second);
y->set_editable(true);
y->set_fixed_width(200);
auto z = w->add<ToolButton>(FA_SAVE);
z->set_flags(Button::Flags::NormalButton); // no toggle, please
z->set_tooltip("save");
}
}
SenderApp() : Screen(Vector2i(1024, 768), "GRBL Sender") { SenderApp() : Screen(Vector2i(1024, 768), "GRBL Sender") {
inc_ref(); inc_ref();
@@ -162,77 +104,107 @@ public:
layer->set_layout(new GroupLayout()); layer->set_layout(new GroupLayout());
tab_widget->append_tab("Info", layer); tab_widget->append_tab("Info", layer);
// Widget *layer3 = new Widget(tab_widget);
// tab_widget->append_tab("Offsets", layer3);
// layer3->set_layout(new GroupLayout());
// layer3->add<Label>("Parameters");
// layer3->add<TextBox>();
new Label(layer, "Status", "sans-bold"); new Label(layer, "Status", "sans-bold");
Widget *status_holder = new Widget(layer); Widget *status_holder = new Widget(layer);
status_holder->set_layout(new GridLayout()); status_holder->set_layout(new GridLayout());
lblStatus = new TextArea(layer); lblStatus = layer->add<TextArea>();
lblStatus->set_fixed_height(20); lblStatus->set_fixed_height(20);
lblStatus->set_font("sans"); lblStatus->set_font("sans");
lblSubstatus = new TextArea(layer); lblSubstatus = layer->add<TextArea>();
lblSubstatus->set_font("sans"); lblSubstatus->set_font("sans");
lblSubstatus->set_fixed_height(50); lblSubstatus->set_fixed_height(50);
// Machine pos // DRO
layer->add<Label>("Machine pos", "sans-bold"); layer->add<Label>("DRO", "sans-bold", 20);
Widget *mpos = new Widget(layer); Widget *mpos = new Widget(layer);
mpos->set_layout(new GridLayout(Orientation::Horizontal, 1, Alignment::Middle)); mpos->set_layout(new GridLayout(Orientation::Horizontal, 1, Alignment::Middle, 0, 6));
auto x_holder = mpos->add<Widget>(); auto x_holder = mpos->add<Widget>();
x_holder->set_layout(new BoxLayout(Orientation::Horizontal)); x_holder->set_layout(new BoxLayout(Orientation::Horizontal, Alignment::Middle, 0, 6));
auto lbl = x_holder->add<Label>("X"); auto lbl = x_holder->add<Label>("X", "sans-bold", 20);
lbl->set_font_size(20); lbl->set_fixed_width(30);
lbl->set_fixed_width(50); mpos_x_text = x_holder->add<TextBox>(std::to_string(cnc.get_status().machine_pos[0]));
mpos_x_text = x_holder->add<TextBox>(std::to_string(cnc.get_status().work_pos[0]));
mpos_x_text->set_fixed_width(200); mpos_x_text->set_fixed_width(200);
auto zero_btn = x_holder->add<ToolButton>(FA_BAN);
zero_btn->set_flags(Button::Flags::NormalButton);
zero_btn->set_tooltip("Zero axis");
zero_btn->set_callback([&]() {
cnc.zero_offset_axis(cboOffset->selected_index(), 0);
});
auto y_holder = mpos->add<Widget>(); auto y_holder = mpos->add<Widget>();
y_holder->set_layout(new BoxLayout(Orientation::Horizontal)); y_holder->set_layout(new BoxLayout(Orientation::Horizontal, Alignment::Middle, 0, 6));
lbl = y_holder->add<Label>("Y"); lbl = y_holder->add<Label>("Y", "sans-bold", 20);
lbl->set_font_size(20); lbl->set_fixed_width(30);
lbl->set_fixed_width(50); mpos_y_text = y_holder->add<TextBox>(std::to_string(cnc.get_status().machine_pos[1]));
mpos_y_text = y_holder->add<TextBox>(std::to_string(cnc.get_status().work_pos[1]));
mpos_y_text->set_fixed_width(200); mpos_y_text->set_fixed_width(200);
zero_btn = y_holder->add<ToolButton>(FA_BAN);
zero_btn->set_flags(Button::Flags::NormalButton);
zero_btn->set_tooltip("Zero axis");
zero_btn->set_callback([&]() {
cnc.zero_offset_axis(cboOffset->selected_index(), 1);
});
auto z_holder = mpos->add<Widget>(); auto z_holder = mpos->add<Widget>();
z_holder->set_layout(new BoxLayout(Orientation::Horizontal)); z_holder->set_layout(new BoxLayout(Orientation::Horizontal, Alignment::Middle, 0, 6));
lbl = z_holder->add<Label>("Z"); lbl = z_holder->add<Label>("Z", "sans-bold", 20);
lbl->set_font_size(20); lbl->set_fixed_width(30);
lbl->set_fixed_width(50); mpos_z_text = z_holder->add<TextBox>(std::to_string(cnc.get_status().machine_pos[0]));
mpos_z_text = z_holder->add<TextBox>(std::to_string(cnc.get_status().work_pos[0]));
mpos_z_text->set_fixed_width(200); mpos_z_text->set_fixed_width(200);
zero_btn = z_holder->add<ToolButton>(FA_BAN);
zero_btn->set_flags(Button::Flags::NormalButton);
zero_btn->set_tooltip("Zero axis");
zero_btn->set_callback([&]() {
cnc.zero_offset_axis(cboOffset->selected_index(), 2);
});
auto zero_all_btn = mpos->add<Button>("Zero all");
zero_all_btn->set_callback([&]() {
cnc.zero_offset(cboOffset->selected_index());
});
// work parameters
layer->add<Label>("Work parameters", "sans-bold", 20);
auto x = new Widget(layer);
x->set_layout(new GridLayout(Orientation::Horizontal, 4, Alignment::Middle, 0, 6));
x->add<Label>("Offset:");
std::vector<std::string> offset_items = {"G54", "G55", "G56", "G57", "G58", "G59"};
cboOffset = x->add<ComboBox>(offset_items);
cboOffset->set_callback([&](int idx) {
refresh_offset();
update_dro();
});
x->add<Label>("Tool:");
std::vector<std::string> tool_items = {"None"};
cboTool = x->add<ComboBox>(tool_items);
// buttons to change state // buttons to change state
new Label(layer, "Actions", "sans-bold"); new Label(layer, "Actions", "sans-bold");
Widget *actions = new Widget(layer); auto *actions = new Widget(layer);
actions->set_layout(new BoxLayout(Orientation::Horizontal)); actions->set_layout(new BoxLayout(Orientation::Horizontal));
Button *btnUnlock = new Button(actions, "Unlock"); auto *btnUnlock = new Button(actions, "Unlock");
btnUnlock->set_callback([&] { btnUnlock->set_callback([&] {
cnc.request_unlock(); cnc.request_unlock();
}); });
Button *btnHome = new Button(actions, "Home"); auto *btnHome = new Button(actions, "Home");
btnHome->set_callback([&] { btnHome->set_callback([&] {
cnc.request_home(); cnc.request_home();
}); });
Button *btnReset = new Button(actions, "Reset"); auto *btnReset = new Button(actions, "Reset");
btnReset->set_background_color(colRed); btnReset->set_background_color(colRed);
btnReset->set_callback([&] { btnReset->set_callback([&] {
cnc.request_reset(); cnc.request_reset();
}); });
Button *btnCycleStart = new Button(actions, "Cycle Start"); auto *btnCycleStart = new Button(actions, "Cycle Start");
btnCycleStart->set_callback([&] { btnCycleStart->set_callback([&] {
cnc.request_cycle_start(); cnc.request_cycle_start();
}); });
Button *btnFeedHold = new Button(actions, "Feed Hold"); auto *btnFeedHold = new Button(actions, "Feed Hold");
btnFeedHold->set_callback([&] { btnFeedHold->set_callback([&] {
cnc.request_feed_hold(); cnc.request_feed_hold();
}); });
@@ -280,68 +252,83 @@ public:
}); });
btnRunProgram->set_tooltip("Execute program"); btnRunProgram->set_tooltip("Execute program");
// // Alternative construction notation using variadic template
// btnLoadProgram = window->add<Button>("Styled", FA_ROCKET);
// btnLoadProgram->set_background_color(Color(0, 0, 255, 25));
// btnLoadProgram->set_callback([] { std::cout << "pushed!" << std::endl; });
// btnLoadProgram->set_tooltip("This button has a fairly long tooltip. It is so long, in "
// "fact, that the shown text will span several lines.");
//
// new Label(window, "Toggle buttons", "sans-bold");
// btnLoadProgram = new Button(window, "Toggle me");
// btnLoadProgram->set_flags(Button::ToggleButton);
// btnLoadProgram->set_change_callback([](bool state) { std::cout << "Toggle button state: " << state << std::endl; });
//
// new Label(window, "Radio buttons", "sans-bold");
// btnLoadProgram = new Button(window, "Radio button 1");
// btnLoadProgram->set_flags(Button::RadioButton);
// btnLoadProgram = new Button(window, "Radio button 2");
// btnLoadProgram->set_flags(Button::RadioButton);
//
// new Label(window, "A tool palette", "sans-bold");
// Widget *tools = new Widget(window);
// tools->set_layout(new BoxLayout(Orientation::Horizontal,
// Alignment::Middle, 0, 6));
//
// btnLoadProgram = new ToolButton(tools, FA_CLOUD);
// btnLoadProgram = new ToolButton(tools, FA_FAST_FORWARD);
// btnLoadProgram = new ToolButton(tools, FA_COMPASS);
// btnLoadProgram = new ToolButton(tools, FA_UTENSILS);
//
// new Label(window, "Popup buttons", "sans-bold");
// PopupButton *popup_btn = new PopupButton(window, "Popup", FA_FLASK);
// Popup *popup = popup_btn->popup();
// popup->set_layout(new GroupLayout());
// new Label(popup, "Arbitrary widgets can be placed here");
// new CheckBox(popup, "A check box");
// // popup right
// popup_btn = new PopupButton(popup, "Recursive popup", FA_CHART_PIE);
// Popup *popup_right = popup_btn->popup();
// popup_right->set_layout(new GroupLayout());
// new CheckBox(popup_right, "Another check box");
// // popup left
// popup_btn = new PopupButton(popup, "Recursive popup", FA_DNA);
// popup_btn->set_side(Popup::Side::Left);
// Popup *popup_left = popup_btn->popup();
// popup_left->set_layout(new GroupLayout());
// new CheckBox(popup_left, "Another check box");
perform_layout(); perform_layout();
// All NanoGUI widgets are initialized at this point. Now
// create shaders to draw the main window contents.
//
// NanoGUI comes with a simple wrapper around OpenGL 3, which
// eliminates most of the tedious and error-prone shader and buffer
// object management.
m_render_pass = new RenderPass({this}); m_render_pass = new RenderPass({this});
m_render_pass->set_clear_color(0, Color(0.3f, 0.3f, 0.32f, 1.f)); m_render_pass->set_clear_color(0, Color(0.3f, 0.3f, 0.32f, 1.f));
m_render_pass->set_depth_test(RenderPass::DepthTest::Always, true); m_render_pass->set_depth_test(RenderPass::DepthTest::Always, true);
m_render_pass->set_cull_mode(RenderPass::CullMode::Disabled); m_render_pass->set_cull_mode(RenderPass::CullMode::Disabled);
} }
void refresh_offset() {
auto offset_name = "G" + std::to_string(cboOffset->selected_index() + 54);
auto offset_values = cnc.get_parameters().at(offset_name);
auto offset_pieces = split_string(offset_values, ",");
offset_x = std::stof(offset_pieces[0]);
offset_y = std::stof(offset_pieces[1]);
offset_z = std::stof(offset_pieces[2]);
}
void fill_in_parameters() {
parameters_vscroll = new VScrollPanel(tab_widget);
tab_widget->append_tab("Parameters", parameters_vscroll);
parameters_layer = new Widget(parameters_vscroll);
parameters_layer->set_layout(new GridLayout(Orientation::Horizontal, 1, Alignment::Middle));
auto& parameters = cnc.get_parameters();
for (auto& entry: parameters) {
auto w = parameters_layer->add<Widget>();
w->set_layout(new BoxLayout(Orientation::Horizontal, Alignment::Middle, 2, 2));
auto x = w->add<Label>(entry.first, "sans-bold", 20);
x->set_fixed_width(50);
auto y = w->add<TextBox>(entry.second);
y->set_editable(true);
y->set_fixed_width(200);
auto z = w->add<ToolButton>(FA_SAVE);
z->set_flags(Button::Flags::NormalButton); // no toggle, please
z->set_tooltip("save");
}
}
void fill_in_settings() {
settings_vscroll = new VScrollPanel(tab_widget);
tab_widget->append_tab("Settings", settings_vscroll);
settings_layer = new Widget(settings_vscroll);
settings_layer->set_layout(new GridLayout(Orientation::Horizontal, 1, Alignment::Middle));
auto& settings = cnc.get_settings();
for (auto& s: settings) {
auto w = settings_layer->add<Widget>();
w->set_layout(new BoxLayout(Orientation::Horizontal, Alignment::Middle, 2, 2));
auto x = w->add<Label>(s.first, "sans-bold", 20);
x->set_fixed_width(40);
auto desc = grbl::setting_description(std::stoi(s.first.substr(1)));
auto y = w->add<TextBox>(s.second);
y->set_editable(true);
y->set_tooltip(desc);
y->set_fixed_width(200);
auto z = w->add<ToolButton>(FA_SAVE);
z->set_flags(Button::Flags::NormalButton); // no toggle, please
z->set_tooltip("save");
auto t = w->add<TextArea>();
t->set_fixed_width(200);
t->set_fixed_height(20);
t->clear();
t->append(desc.substr(0, desc.find_first_of('\n')));
}
}
void init_program_geometry() { void init_program_geometry() {
renderer.update(pgm, cnc); renderer.update(pgm, cnc);
@@ -363,16 +350,26 @@ public:
void on_disconnected() override { void on_disconnected() override {
} }
void on_settings_reloaded() override {
}
void on_parameters_reloaded() override {
refresh_offset();
update_dro();
}
grbl::realtime_status_report last_report; grbl::realtime_status_report last_report;
void on_init_completed() override { void on_init_completed() override {
fill_in_settings(); fill_in_settings();
fill_in_parameters(); fill_in_parameters();
refresh_offset();
update_dro();
} }
void on_realtime_status_report(grbl::realtime_status_report report) override { void on_realtime_status_report(grbl::realtime_status_report report) override {
if (report == last_report) return; // if (report == last_report) return;
if (last_report.status != report.status) { if (last_report.status != report.status) {
lblStatus->clear(); lblStatus->clear();
@@ -386,14 +383,16 @@ public:
} }
} }
update_dro();
mpos_x_text->set_value(std::to_string(cnc.get_status().work_pos[0]));
mpos_y_text->set_value(std::to_string(cnc.get_status().work_pos[1]));
mpos_z_text->set_value(std::to_string(cnc.get_status().work_pos[2]));
last_report = report; last_report = report;
} }
void update_dro() {
mpos_x_text->set_value(std::to_string(cnc.get_status().machine_pos[0] - offset_x));
mpos_y_text->set_value(std::to_string(cnc.get_status().machine_pos[1] - offset_y));
mpos_z_text->set_value(std::to_string(cnc.get_status().machine_pos[2] - offset_z));
}
void on_banner(std::string line) override { void on_banner(std::string line) override {
} }