From 1530c71fb03b6b8f5826e9e4edf22a363402e618 Mon Sep 17 00:00:00 2001 From: Romain Bazile Date: Wed, 21 Oct 2020 21:24:29 +0200 Subject: [PATCH] Python: add/remove todos --- hardware.json | 2 +- scripts/planktoscope/imager.py | 5 +---- scripts/planktoscope/mqtt.py | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hardware.json b/hardware.json index 0afc956..1e5e030 100644 --- a/hardware.json +++ b/hardware.json @@ -3,6 +3,6 @@ "focus_steps_per_mm" : 40, "pump_steps_per_ml" : 507, "focus_max_speed" : 0.5, - "pump_max_speed" : 30, + "pump_max_speed" : 30, "stepper_type" : "adafruit" } \ No newline at end of file diff --git a/scripts/planktoscope/imager.py b/scripts/planktoscope/imager.py index 80c4feb..c692c85 100644 --- a/scripts/planktoscope/imager.py +++ b/scripts/planktoscope/imager.py @@ -99,6 +99,7 @@ class StreamingHandler(http.server.BaseHTTPRequestHandler): output.condition.wait() frame = output.frame self.wfile.write(b"--FRAME\r\n") + # TODO exception BrokenPipeError here self.send_header("Content-Type", "image/jpeg") self.send_header("Content-Length", len(frame)) self.end_headers() @@ -158,10 +159,6 @@ class ImagerProcess(multiprocessing.Process): self.__export_path = "" self.__global_metadata = None - # TODO implement a way to receive directly the metadata from Node-Red via MQTT - # FIXME We should save the metadata to a file in the folder too - # TODO create a directory structure per day/per imaging session - logger.success("planktoscope.imager is initialised and ready to go!") @logger.catch diff --git a/scripts/planktoscope/mqtt.py b/scripts/planktoscope/mqtt.py index 1a5414f..becb7b0 100644 --- a/scripts/planktoscope/mqtt.py +++ b/scripts/planktoscope/mqtt.py @@ -87,6 +87,8 @@ class MQTT_Client: @logger.catch def connect(self): logger.info(f"trying to connect to {self.server}:{self.port}") + # TODO add try: except ConnectionRefusedError: block here + # This is a symptom that Mosquitto may have failed to start self.client.connect(self.server, self.port, 60) self.client.on_connect = self.on_connect self.client.on_subscribe = self.on_subscribe @@ -122,6 +124,7 @@ class MQTT_Client: # Run this function in order to subscribe to all the topics begining by actuator def on_subscribe(self, client, obj, mid, granted_qos): # Print when subscribed + # TODO Fix bug when this is called outside of this init function (for example when the imager subscribe to status/pump) logger.success( f"{self.name} subscribed to {self.topic}! - mid:{str(mid)} qos:{str(granted_qos)}" )