From a830af74be1480f0a8cd64c2689291b77795a7bb Mon Sep 17 00:00:00 2001 From: matteo porta Date: Tue, 12 Jul 2022 16:02:45 +0200 Subject: [PATCH] wip --- src/components/tecna_marposs_provaset_t3.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/components/tecna_marposs_provaset_t3.py b/src/components/tecna_marposs_provaset_t3.py index 658d332..d135ca5 100644 --- a/src/components/tecna_marposs_provaset_t3.py +++ b/src/components/tecna_marposs_provaset_t3.py @@ -58,7 +58,7 @@ class TecnaMarpossProvasetT3(ModbusComponent): return units def _convert_from_format(self, data, formatting=None, decoding_map=None): - if decoding_map is not None: + if decoding_map is not None and data in decoding_map: data = decoding_map[data] if formatting is not None: # units = self.units[formatting] @@ -69,7 +69,7 @@ class TecnaMarpossProvasetT3(ModbusComponent): def _convert_to_format(self, data, formatting=None, encoding_map=None): if formatting is not None: data = int(data / self.units[formatting][0]) - if encoding_map is not None: + if encoding_map is not None and data in encoding_map: data = encoding_map[data] return data @@ -109,7 +109,7 @@ class TecnaMarpossProvasetT3(ModbusComponent): self.log.debug(str(info)) super()._get([info]) - def start_test(self, table=1): + def start_test(self, table=100): self.log.info(f"starting test table {table!r}") self.write("INSTRUMENT SETTING: Selected table", table) self.write("Start testing", table) @@ -127,18 +127,15 @@ class TecnaMarpossProvasetT3(ModbusComponent): "Running test: result", ]} - def write_recipe(self, recipe, table=1): + def write_recipe(self, recipe, table=100): # "pressure_ramp": self.pressure_ramp_sb, # "stabilization_cycles": self.stabilization_cycles_sb, recipe_name = recipe.spec["part_number"][:16].encode("ascii") recipe_name += b"\x00" * (16 - len(recipe_name)) recipe = { - # "PASSWORD: Administrator": 1909, - # "PASSWORD: Modify program": 0, - # "PASSWORD: Select program": 0, - "PASSWORD: Administrator": 603, - "PASSWORD: Modify program": 603, - "PASSWORD: Select program": 603, + "PASSWORD: Administrator": 603, # was 1909 + "PASSWORD: Modify program": 603, # was 0 + "PASSWORD: Select program": 603, # was 0 "INSTRUMENT SETTING: Various flags": 0b0000000000000000, **{719 + i: (recipe_name[i * 2 + 1] << 8) + recipe_name[i * 2] for i in range(8)}, "Selection number of test table on which you intend to work": table,