From 165f61986910588cb62add5b1467a88c5ed60e78 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Wed, 23 Jun 2021 19:55:14 +0100 Subject: [PATCH] notify_on_stop errors if not moving notify_on_stop now gives an error if it's called while the stage is not moving. This means you can safely issue the command and await a response. If the stage is moving, it will block until the stage stops. If it's not moving, it will return immediately. --- src/modules/stage/stage.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/stage/stage.cpp b/src/modules/stage/stage.cpp index 8118aea..555db65 100644 --- a/src/modules/stage/stage.cpp +++ b/src/modules/stage/stage.cpp @@ -281,7 +281,14 @@ void is_stage_moving(String command) void activate_notify_on_stop(String command) { - notify_on_stop = true; + if (!stage_moving) + { + Serial.println("Error: stage is not moving"); + } + else + { + notify_on_stop = true; + } } //TODO: move help strings to program memory