Hardware UART comms + partial v5 modules support

This commit is contained in:
Filip Ayazi 2022-09-03 22:04:28 +01:00
parent dfd4a99f1f
commit fde7a90480
10 changed files with 296 additions and 120 deletions

View file

@ -76,10 +76,10 @@ void print_position()
EACH_MOTOR
{
if (i > 0)
Serial.print(" ");
Serial.print(current_pos[i]);
SERIAL_PORT.print(" ");
SERIAL_PORT.print(current_pos[i]);
}
Serial.println();
SERIAL_PORT.println();
}
unsigned long move_start_time = 0;
@ -124,7 +124,7 @@ void start_move(long displ[n_motors])
}
else
{
Serial.println("done.");
SERIAL_PORT.println("done.");
}
}
@ -183,7 +183,7 @@ void stage_loop()
if (!stage_moving && notify_on_stop)
{
Serial.println("stopped");
SERIAL_PORT.println("stopped");
notify_on_stop = false;
}
}
@ -233,7 +233,7 @@ void stage_release(String command)
{
releaseMotor(i);
}
Serial.println("done");
SERIAL_PORT.println("done");
}
void stage_p(String command)
@ -247,14 +247,14 @@ void stage_min_step_delay(String command)
parse_arguments(args, command, 1);
if (args[0][0] == '?')
{
Serial.print("minimum step delay ");
Serial.println(min_step_delay);
SERIAL_PORT.print("minimum step delay ");
SERIAL_PORT.println(min_step_delay);
}
else
{
min_step_delay = atol(args[0]);
EEPROM.put(min_step_delay_eeprom, min_step_delay);
Serial.println("done.");
SERIAL_PORT.println("done.");
}
free(args[0]);
}
@ -265,14 +265,14 @@ void stage_ramp_time(String command)
parse_arguments(args, command, 1);
if (args[0][0] == '?')
{
Serial.print("ramp_time ");
Serial.println(ramp_time);
SERIAL_PORT.print("ramp_time ");
SERIAL_PORT.println(ramp_time);
}
else
{
ramp_time = atol(args[0]);
EEPROM.put(ramp_time_eeprom, ramp_time);
Serial.println("done.");
SERIAL_PORT.println("done.");
}
free(args[0]);
}
@ -283,41 +283,41 @@ void update_blocking_moves(String command)
parse_arguments(args, command, 1);
if (args[0][0] == '?')
{
Serial.print("blocking_moves ");
Serial.println(non_blocking_moves ? "false" : "true");
SERIAL_PORT.print("blocking_moves ");
SERIAL_PORT.println(non_blocking_moves ? "false" : "true");
}
else
{
non_blocking_moves = !(args[0][0] == 't');
EEPROM.put(non_blocking_moves_eeprom, non_blocking_moves);
Serial.println("done.");
SERIAL_PORT.println("done.");
}
}
void stage_zero(String command)
{
EACH_MOTOR current_pos[i] = 0;
Serial.println(F("position reset to 0 0 0"));
SERIAL_PORT.println(F("position reset to 0 0 0"));
EEPROM.put(0, current_pos);
}
void stage_stop(String command)
{
stage_moving = false;
Serial.println("Move aborted");
SERIAL_PORT.println("Move aborted");
}
void is_stage_moving(String command)
{
//TODO: should I bother checking for a ?
Serial.println(stage_moving ? "true" : "false");
SERIAL_PORT.println(stage_moving ? "true" : "false");
}
void activate_notify_on_stop(String command)
{
if (!stage_moving)
{
Serial.println("Error: stage is not moving");
SERIAL_PORT.println("Error: stage is not moving");
}
else
{