stage: set blocking moves as default

Switches the variable to non_blocking_moves so eeprom load returns false
when nothing has been set to match original firmware behaviour.
This commit is contained in:
Filip Ayazi 2021-07-14 01:17:05 +01:00
parent 638c13676b
commit 2dab1008dc

View file

@ -16,14 +16,14 @@ const int min_step_delay_eeprom = sizeof(long) * n_motors;
long ramp_time; long ramp_time;
const int ramp_time_eeprom = sizeof(long) * (n_motors + 1); const int ramp_time_eeprom = sizeof(long) * (n_motors + 1);
const int axis_max_eeprom = sizeof(long) * (n_motors + 2); 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]; Stepper *motors[n_motors];
signed long current_pos[n_motors]; signed long current_pos[n_motors];
long steps_remaining[n_motors]; long steps_remaining[n_motors];
bool stage_moving = false; bool stage_moving = false;
bool notify_on_stop = false; bool notify_on_stop = false;
bool blocking_moves = false; bool non_blocking_moves = false;
void stage_setup() void stage_setup()
{ {
@ -51,8 +51,9 @@ void stage_setup()
ramp_time = 0; ramp_time = 0;
EEPROM.put(ramp_time_eeprom, ramp_time); 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); register_module(stage_commands, stage_loop);
} }
@ -115,7 +116,8 @@ void start_move(long displ[n_motors])
move_start_time = micros(); 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 final_scaled_t = (float)max_steps * min_step_delay; //NB total time taken will be final_scaled_t + 2*ramp_time
stage_moving = true; stage_moving = true;
if (blocking_moves){ if (!non_blocking_moves)
{
notify_on_stop = true; notify_on_stop = true;
} }
else else
@ -277,12 +279,12 @@ void update_blocking_moves(String command)
if (args[0][0] == '?') if (args[0][0] == '?')
{ {
Serial.print("blocking_moves "); Serial.print("blocking_moves ");
Serial.println(blocking_moves ? "true" : "false"); Serial.println(non_blocking_moves ? "false" : "true");
} }
else else
{ {
blocking_moves = args[0][0] == 't'; non_blocking_moves = !(args[0][0] == 't');
EEPROM.put(blocking_moves_eeprom, blocking_moves); EEPROM.put(non_blocking_moves_eeprom, non_blocking_moves);
Serial.println("done."); Serial.println("done.");
} }
} }