diff --git a/src/modules/stage/stage.cpp b/src/modules/stage/stage.cpp index 350e8a3..3fc106e 100644 --- a/src/modules/stage/stage.cpp +++ b/src/modules/stage/stage.cpp @@ -16,14 +16,14 @@ const int min_step_delay_eeprom = sizeof(long) * n_motors; long ramp_time; const int ramp_time_eeprom = sizeof(long) * (n_motors + 1); const int axis_max_eeprom = sizeof(long) * (n_motors + 2); -const int blocking_moves_eeprom = sizeof(long) * (n_motors + 3); +const int non_blocking_moves_eeprom = sizeof(long) * (n_motors + 3); Stepper *motors[n_motors]; signed long current_pos[n_motors]; long steps_remaining[n_motors]; bool stage_moving = false; bool notify_on_stop = false; -bool blocking_moves = false; +bool non_blocking_moves = false; void stage_setup() { @@ -51,8 +51,9 @@ void stage_setup() ramp_time = 0; EEPROM.put(ramp_time_eeprom, ramp_time); } - EEPROM.get(blocking_moves_eeprom, blocking_moves); - // TODO: do we need to do something to initialise this? + + //using non-blocking moves here to have blocking moves by default + EEPROM.get(non_blocking_moves_eeprom, non_blocking_moves); register_module(stage_commands, stage_loop); } @@ -115,7 +116,8 @@ void start_move(long displ[n_motors]) move_start_time = micros(); final_scaled_t = (float)max_steps * min_step_delay; //NB total time taken will be final_scaled_t + 2*ramp_time stage_moving = true; - if (blocking_moves){ + if (!non_blocking_moves) + { notify_on_stop = true; } else @@ -277,12 +279,12 @@ void update_blocking_moves(String command) if (args[0][0] == '?') { Serial.print("blocking_moves "); - Serial.println(blocking_moves ? "true" : "false"); + Serial.println(non_blocking_moves ? "false" : "true"); } else { - blocking_moves = args[0][0] == 't'; - EEPROM.put(blocking_moves_eeprom, blocking_moves); + non_blocking_moves = !(args[0][0] == 't'); + EEPROM.put(non_blocking_moves_eeprom, non_blocking_moves); Serial.println("done."); } }