From b3703388c7fb1dc3f491b8de70cf6b9b70508516 Mon Sep 17 00:00:00 2001 From: Romain Bazile Date: Tue, 15 Dec 2020 19:10:08 +0100 Subject: [PATCH] stepper: fix whitespace error --- scripts/planktoscope/stepper.py | 34 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/scripts/planktoscope/stepper.py b/scripts/planktoscope/stepper.py index 123afd3..e0d84ed 100644 --- a/scripts/planktoscope/stepper.py +++ b/scripts/planktoscope/stepper.py @@ -348,23 +348,21 @@ class StepperProcess(multiprocessing.Process): def treat_command(self): command = "" - logger.info("We received a new message") - last_message = self.actuator_client.msg["payload"] - logger.debug(last_message) - command = self.actuator_client.msg["topic"].split("/", 1)[1] - logger.debug(command) - self.actuator_client.read_message() - - # If the command is "pump" - if command == "pump": - self.__message_pump(last_message) - # If the command is "focus" - elif command == "focus": - self.__message_focus(last_message) - elif command != "": - logger.warning( - f"We did not understand the received request {command} - {last_message}" - ) + logger.info("We received a new message") + last_message = self.actuator_client.msg["payload"] + logger.debug(last_message) + command = self.actuator_client.msg["topic"].split("/", 1)[1] + logger.debug(command) + self.actuator_client.read_message() + + if command == "pump": + self.__message_pump(last_message) + elif command == "focus": + self.__message_focus(last_message) + elif command != "": + logger.warning( + f"We did not understand the received request {command} - {last_message}" + ) def focus(self, direction, distance, speed=focus_max_speed): """moves the focus stepper @@ -508,7 +506,7 @@ class StepperProcess(multiprocessing.Process): delay = 0.001 while not self.stop_event.is_set(): if self.actuator_client.new_message_received(): - self.treat_command() + self.treat_command() if self.pump_stepper.move(): delay = 0.0001 planktoscope.light.ready()