This commit is contained in:
matteo porta 2022-07-12 16:02:45 +02:00
parent 162a7e7e1b
commit a830af74be

View File

@ -58,7 +58,7 @@ class TecnaMarpossProvasetT3(ModbusComponent):
return units return units
def _convert_from_format(self, data, formatting=None, decoding_map=None): 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] data = decoding_map[data]
if formatting is not None: if formatting is not None:
# units = self.units[formatting] # units = self.units[formatting]
@ -69,7 +69,7 @@ class TecnaMarpossProvasetT3(ModbusComponent):
def _convert_to_format(self, data, formatting=None, encoding_map=None): def _convert_to_format(self, data, formatting=None, encoding_map=None):
if formatting is not None: if formatting is not None:
data = int(data / self.units[formatting][0]) 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] data = encoding_map[data]
return data return data
@ -109,7 +109,7 @@ class TecnaMarpossProvasetT3(ModbusComponent):
self.log.debug(str(info)) self.log.debug(str(info))
super()._get([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.log.info(f"starting test table {table!r}")
self.write("INSTRUMENT SETTING: Selected table", table) self.write("INSTRUMENT SETTING: Selected table", table)
self.write("Start testing", table) self.write("Start testing", table)
@ -127,18 +127,15 @@ class TecnaMarpossProvasetT3(ModbusComponent):
"Running test: result", "Running test: result",
]} ]}
def write_recipe(self, recipe, table=1): def write_recipe(self, recipe, table=100):
# "pressure_ramp": self.pressure_ramp_sb, # "pressure_ramp": self.pressure_ramp_sb,
# "stabilization_cycles": self.stabilization_cycles_sb, # "stabilization_cycles": self.stabilization_cycles_sb,
recipe_name = recipe.spec["part_number"][:16].encode("ascii") recipe_name = recipe.spec["part_number"][:16].encode("ascii")
recipe_name += b"\x00" * (16 - len(recipe_name)) recipe_name += b"\x00" * (16 - len(recipe_name))
recipe = { recipe = {
# "PASSWORD: Administrator": 1909, "PASSWORD: Administrator": 603, # was 1909
# "PASSWORD: Modify program": 0, "PASSWORD: Modify program": 603, # was 0
# "PASSWORD: Select program": 0, "PASSWORD: Select program": 603, # was 0
"PASSWORD: Administrator": 603,
"PASSWORD: Modify program": 603,
"PASSWORD: Select program": 603,
"INSTRUMENT SETTING: Various flags": 0b0000000000000000, "INSTRUMENT SETTING: Various flags": 0b0000000000000000,
**{719 + i: (recipe_name[i * 2 + 1] << 8) + recipe_name[i * 2] for i in range(8)}, **{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, "Selection number of test table on which you intend to work": table,