Implemented showing program extents

This commit is contained in:
2023-05-07 11:05:01 +03:00
parent 4556ddb746
commit 71e51c5033
4 changed files with 160 additions and 2 deletions
+18
View File
@@ -682,6 +682,12 @@ void grbl::machine::request_jog_fixed(grbl::jog_direction dir, float distance, f
awaiting_responses++;
}
void grbl::machine::start_z_probe(float min_z, float feed_rate) {
std::string command = "G38.2 Z" + std::to_string(min_z) + "F" + std::to_string(feed_rate);
pipe->send(command);
awaiting_responses++;
}
bool grbl::jog_state::no_jogging() const {
return !(up_pressed || down_pressed || left_pressed || right_pressed || z_up_pressed || z_down_pressed);
}
@@ -812,6 +818,18 @@ void grbl::machine_state_idle::on_line_received(std::string line) {
// TODO: some parameters have more than two :
auto pieces = split_string(line, ":");
cnc->parameters[pieces[0]] = pieces[1];
if (starts_with(line, "PRB")) {
auto pieces = split_string(line, ":");
auto coords_as_string = split_string(pieces[1], ",");
float probe_coords[3];
for (auto i = 0; i < 3; i++) {
probe_coords[i] = std::stof(coords_as_string[i]);
}
bool probe_touched = pieces[2] == "1";
cnc->listener->on_probe_result(probe_touched, probe_coords);
}
}
}