From b3d417e3b94eb354ed0271fd30cfc1bb217ca710 Mon Sep 17 00:00:00 2001 From: Romain Bazile Date: Thu, 3 Dec 2020 16:45:01 +0100 Subject: [PATCH] imager bug if object_date is not set --- flows/main.json | 25 +++++++++++++++++++++++++ scripts/planktoscope/imager.py | 14 ++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/flows/main.json b/flows/main.json index 6c83f92..5633023 100644 --- a/flows/main.json +++ b/flows/main.json @@ -7918,5 +7918,30 @@ [], [] ] + }, + { + "id": "2dc762df.08cd7e", + "type": "inject", + "z": "baa1e3d9.cb29d", + "name": "Default: 0.01", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": true, + "onceDelay": 0.1, + "topic": "", + "payload": "0.05", + "payloadType": "num", + "x": 310, + "y": 320, + "wires": [ + [ + "df1ea904.cd261" + ] + ] } ] \ No newline at end of file diff --git a/scripts/planktoscope/imager.py b/scripts/planktoscope/imager.py index bc40da0..9b43802 100644 --- a/scripts/planktoscope/imager.py +++ b/scripts/planktoscope/imager.py @@ -581,6 +581,20 @@ class ImagerProcess(multiprocessing.Process): # Concat the local metadata and the metadata from Node-RED self.__global_metadata = {**self.__global_metadata, **local_metadata} + if "object_date" not in self.__global_metadata: + # If this path exists, then ids are reused when they should not + logger.error(f"The metadata did not contain object_date!") + self.imager_client.client.publish( + "status/imager", + '{"status":"Configuration update error: object_date is missing!"}', + ) + # Reset the counter to 0 + self.__img_done = 0 + # Change state towards stop + self.__imager.change(planktoscope.imager_state_machine.Stop) + planktoscope.light.error() + return + logger.info("Setting up the directory structure for storing the pictures") self.__export_path = os.path.join( self.__base_path,