Added command to notify when stage stops

This allows simpler emulation of blocking moves.
We may want to improve the way this works...
This commit is contained in:
Richard Bowman 2021-06-23 18:54:29 +01:00
parent 4cf54971a2
commit 71f0da35a2

View file

@ -21,6 +21,7 @@ signed long current_pos[n_motors];
long steps_remaining[n_motors];
bool stage_moving = false;
bool notify_on_stop = false;
void stage_setup()
{
@ -164,6 +165,11 @@ void stage_loop()
}
}
}
if (!stage_moving && notify_on_stop)
{
Serial.println("stopped");
notify_on_stop = false;
}
}
void stage_move_single_axis(uint8_t axis, String command)
@ -273,6 +279,11 @@ void is_stage_moving(String command)
Serial.println(stage_moving?"true":"false");
}
void activate_notify_on_stop(String command)
{
notify_on_stop = true;
}
//TODO: move help strings to program memory
//F() cannot be used outside block context though
extern const Command stage_commands[] = {
@ -288,4 +299,5 @@ extern const Command stage_commands[] = {
{"zero", stage_zero},
{"stop", stage_stop},
{"moving", is_stage_moving},
{"notify_on_stop", activate_notify_on_stop},
END_COMMAND};