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:
parent
4cf54971a2
commit
71f0da35a2
1 changed files with 12 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ 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;
|
||||||
|
|
||||||
void stage_setup()
|
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)
|
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");
|
Serial.println(stage_moving?"true":"false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void activate_notify_on_stop(String command)
|
||||||
|
{
|
||||||
|
notify_on_stop = true;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: move help strings to program memory
|
//TODO: move help strings to program memory
|
||||||
//F() cannot be used outside block context though
|
//F() cannot be used outside block context though
|
||||||
extern const Command stage_commands[] = {
|
extern const Command stage_commands[] = {
|
||||||
|
|
@ -288,4 +299,5 @@ extern const Command stage_commands[] = {
|
||||||
{"zero", stage_zero},
|
{"zero", stage_zero},
|
||||||
{"stop", stage_stop},
|
{"stop", stage_stop},
|
||||||
{"moving", is_stage_moving},
|
{"moving", is_stage_moving},
|
||||||
|
{"notify_on_stop", activate_notify_on_stop},
|
||||||
END_COMMAND};
|
END_COMMAND};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue