Got rid of segfault when uploading VBOs.

Added go-to-zero function.
Reworked how work pos is obtained.
This commit is contained in:
2023-05-05 15:42:30 +03:00
parent 05db38ec55
commit 3f9eb049b7
5 changed files with 86 additions and 26 deletions
+10 -11
View File
@@ -73,9 +73,6 @@ public:
Widget *parameters_layer;
TextBox *mpos_x_text, *mpos_y_text, *mpos_z_text;
ComboBox *cboOffset, *cboTool;
float offset_x = 0;
float offset_y = 0;
float offset_z = 0;
SenderApp() : Screen(Vector2i(1024, 768), "GRBL Sender") {
inc_ref();
@@ -165,6 +162,11 @@ public:
cnc.zero_offset(cboOffset->selected_index());
});
auto goto_zero_btn = mpos->add<Button>("Goto 0");
goto_zero_btn->set_callback([&]() {
cnc.go_to_zero(true, true, true);
});
// work parameters
layer->add<Label>("Work parameters", "sans-bold", 20);
auto x = new Widget(layer);
@@ -262,11 +264,7 @@ public:
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]);
cnc.set_work_offset(offset_name);
}
void fill_in_parameters() {
@@ -388,9 +386,10 @@ public:
}
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));
auto work_pos = cnc.get_work_pos();
mpos_x_text->set_value(std::to_string(work_pos[0]));
mpos_y_text->set_value(std::to_string(work_pos[1]));
mpos_z_text->set_value(std::to_string(work_pos[2]));
}
void on_banner(std::string line) override {