Set selected work offset when running program.
This commit is contained in:
+8
-3
@@ -96,10 +96,16 @@ void grbl::machine::check_program(const grbl::program& pgm) {
|
||||
switch_to_state(grbl_machine_state::check_program);
|
||||
}
|
||||
|
||||
void grbl::machine::run_program(const grbl::program& pgm) {
|
||||
void grbl::machine::run_program(const grbl::program& pgm, std::string work_offset) {
|
||||
running_program = pgm;
|
||||
std::cout << "running program (" << running_program.filename << ") with " << running_program.number_of_instructions() << " instructions"
|
||||
<< std::endl;
|
||||
<< " on work offset " << work_offset << std::endl;
|
||||
|
||||
// set desired offset
|
||||
while (awaiting_responses > 0);
|
||||
pipe->send(work_offset);
|
||||
while (awaiting_responses > 0);
|
||||
|
||||
switch_to_state(grbl_machine_state::run_program);
|
||||
}
|
||||
|
||||
@@ -821,7 +827,6 @@ void grbl::machine_state_run_program::on_enter(grbl::machine *m) {
|
||||
}
|
||||
|
||||
void grbl::machine_state_run_program::on_exit(grbl::machine *m) {
|
||||
|
||||
}
|
||||
|
||||
void grbl::machine_state_run_program::move_to_next_run_stage() {
|
||||
|
||||
+1
-1
@@ -228,7 +228,7 @@ struct machine : public transport_callbacks {
|
||||
|
||||
void set_listener(grbl::machine_listener *listener);
|
||||
void connect();
|
||||
void run_program(const grbl::program& pgm);
|
||||
void run_program(const grbl::program& pgm, std::string work_offset);
|
||||
void check_program(const grbl::program& pgm);
|
||||
void request_jog(jog_state jog) const;
|
||||
void cancel_jog() const;
|
||||
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
btnRunProgram = new Button(pgm_actions, "Run");
|
||||
btnRunProgram->set_enabled(false);
|
||||
btnRunProgram->set_callback([&] {
|
||||
cnc.run_program(pgm);
|
||||
cnc.run_program(pgm, "G" + std::to_string(cboOffset->selected_index() + 54));
|
||||
});
|
||||
btnRunProgram->set_tooltip("Execute program");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user