Implemented report pins status.
This commit is contained in:
@@ -77,6 +77,10 @@ public:
|
||||
Widget *parameters_layer;
|
||||
TextBox *mpos_x_text, *mpos_y_text, *mpos_z_text;
|
||||
ComboBox *cbo_work_offset, *cbo_tool, *cbo_jog_feed_rates, *cbo_jog_distance;
|
||||
|
||||
ToolButton *btn_pin_door, *btn_pin_hold, *btn_pin_reset, *btn_pin_cycle_start;
|
||||
ToolButton *btn_pin_limit_x, *btn_pin_limit_y, *btn_pin_limit_z, *btn_pin_probe;
|
||||
|
||||
Button *btn_keyboard_jog;
|
||||
std::stringstream dro_ss;
|
||||
|
||||
@@ -101,6 +105,7 @@ public:
|
||||
|
||||
add_status_markup();
|
||||
add_dro_markup();
|
||||
add_pins_markup();
|
||||
add_jogging_markup();
|
||||
add_work_parameters_markup();
|
||||
|
||||
@@ -318,7 +323,7 @@ public:
|
||||
}
|
||||
|
||||
void add_dro_markup() {
|
||||
dro_ss << std::setprecision(4) << std::fixed;
|
||||
dro_ss << std::setprecision(3) << std::fixed;
|
||||
|
||||
// DRO
|
||||
info_layer->add<Label>("DRO", "sans-bold", 20);
|
||||
@@ -378,6 +383,48 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
void add_pins_markup() {
|
||||
// Pins
|
||||
info_layer->add<Label>("Pins", "sans-bold", 20);
|
||||
auto pins_holder = info_layer->add<Widget>();
|
||||
pins_holder->set_layout(new BoxLayout(Orientation::Horizontal, Alignment::Fill, 4, 4));
|
||||
|
||||
btn_pin_door = pins_holder->add<ToolButton>(0, "D");
|
||||
// btn_pin_door->set_enabled(false);
|
||||
btn_pin_door->set_flags(Button::Flags::NormalButton);
|
||||
|
||||
btn_pin_hold = pins_holder->add<ToolButton>(0, "H");
|
||||
// btn_pin_hold->set_enabled(false);
|
||||
btn_pin_hold->set_flags(Button::Flags::NormalButton);
|
||||
|
||||
btn_pin_reset = pins_holder->add<ToolButton>(0, "R");
|
||||
// btn_pin_reset->set_enabled(false);
|
||||
btn_pin_reset->set_flags(Button::Flags::NormalButton);
|
||||
|
||||
btn_pin_cycle_start = pins_holder->add<ToolButton>(0, "S");
|
||||
// btn_pin_cycle_start->set_enabled(false);
|
||||
btn_pin_cycle_start->set_flags(Button::Flags::NormalButton);
|
||||
|
||||
auto a = pins_holder->add<Label>("");
|
||||
a->set_fixed_width(30);
|
||||
|
||||
btn_pin_limit_x = pins_holder->add<ToolButton>(0, "X");
|
||||
// btn_pin_limit_x->set_enabled(false);
|
||||
btn_pin_limit_x->set_flags(Button::Flags::NormalButton);
|
||||
|
||||
btn_pin_limit_y = pins_holder->add<ToolButton>(0, "Y");
|
||||
// btn_pin_limit_y->set_enabled(false);
|
||||
btn_pin_limit_y->set_flags(Button::Flags::NormalButton);
|
||||
|
||||
btn_pin_limit_z = pins_holder->add<ToolButton>(0, "Z");
|
||||
// btn_pin_limit_z->set_enabled(false);
|
||||
btn_pin_limit_z->set_flags(Button::Flags::NormalButton);
|
||||
|
||||
btn_pin_probe = pins_holder->add<ToolButton>(0, "P");
|
||||
// btn_pin_probe->set_enabled(false);
|
||||
btn_pin_probe->set_flags(Button::Flags::NormalButton);
|
||||
}
|
||||
|
||||
void refresh_offset() const {
|
||||
auto offset_name = "G" + std::to_string(cbo_work_offset->selected_index() + 54);
|
||||
cnc.set_work_offset(offset_name);
|
||||
@@ -388,13 +435,13 @@ public:
|
||||
tab_widget->append_tab("Parameters", parameters_vscroll);
|
||||
|
||||
parameters_layer = new Widget(parameters_vscroll);
|
||||
parameters_layer->set_layout(new GridLayout(Orientation::Horizontal, 1, Alignment::Minimum));
|
||||
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::Minimum, 0, 0));
|
||||
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);
|
||||
|
||||
@@ -402,8 +449,8 @@ public:
|
||||
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
|
||||
auto z = w->add<Button>("", FA_SAVE);
|
||||
// z->set_flags(Button::Flags::NormalButton); // no toggle, please
|
||||
z->set_tooltip("save");
|
||||
}
|
||||
}
|
||||
@@ -499,6 +546,17 @@ public:
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
// FIXME: ugly way of retrieving the bg color
|
||||
btn_pin_door->set_background_color(report.signals.bit.door ? color_red : btn_load_program->background_color());
|
||||
btn_pin_hold->set_background_color(report.signals.bit.hold ? color_red : btn_load_program->background_color());
|
||||
btn_pin_reset->set_background_color(report.signals.bit.soft_reset ? color_red : btn_load_program->background_color());
|
||||
btn_pin_cycle_start->set_background_color(report.signals.bit.cycle_start ? color_red : btn_load_program->background_color());
|
||||
btn_pin_limit_x->set_background_color(report.signals.bit.x_limit ? color_red : btn_load_program->background_color());
|
||||
btn_pin_limit_y->set_background_color(report.signals.bit.y_limit ? color_red : btn_load_program->background_color());
|
||||
btn_pin_limit_z->set_background_color(report.signals.bit.z_limit ? color_red : btn_load_program->background_color());
|
||||
btn_pin_probe->set_background_color(report.signals.bit.probe ? color_red : btn_load_program->background_color());
|
||||
|
||||
update_dro();
|
||||
last_report = report;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user