This commit is contained in:
matteo porta 2022-10-24 12:19:20 +02:00
parent fe33cc4d4a
commit 7fa2039e52
6 changed files with 20 additions and 11 deletions

View File

@ -1,5 +1,5 @@
[machine]
description = ~~~~~~~~~~ THIS ~~~~~~~~~~
description = ~~~~~~~~~~ THIS ~~~~~~~~~~
[hardware_config]
archive_synchronizer: present
@ -17,6 +17,10 @@ vision: present
[tecna_t3]
model: t3l
port: /dev/ttyUSB0
saver: present
saver_label_template: 6
saver_print_on_fail: yes
saver_label_count: 1
[multicomp]
port: /dev/ttyACM0

View File

@ -17,7 +17,6 @@ python -B -u "./src/main.py" \
--auto-login-admin \
--auto-select \
--debugger-workaround \
--enable-saving-tecna-recipes \
--no-edgetpu \
--no-gpu \
--panel \
@ -32,6 +31,7 @@ $* 2> >(sed $'s/.*/\e[31m&\e[m/' >&2) # &
# --auto-login-user \
# --autotests-archive \
# --camera-edits \
# --enable-saving-tecna-recipes \
# --fail-vision \
# --full-screen \
# --interact \

View File

@ -46,6 +46,10 @@ class TecnaMarpossProvasetT3(ModbusComponent):
self.set_measure_units()
self.units = self.get_measure_units()
self.max_program_number = self.read("Max number of programs")
self.saver_label_count = min(abs(int(self.config[self.name].get("saver_label_count", 1))), 0b1111)
self.saver_print_on_fail = 1 if self.config[self.name].get("saver_print_on_fail", "no").lower() in {"yes", "y", "on", "true", "1", "x"} else 0
self.saver_label_template = min(abs(int(self.config[self.name].get("saver_label_template", 1))), 0b11111111)
self.model = self.config[self.name]["model"].lower()
self.log.info(f"units: {self.units}")
# def unlock_tecna(self, **kwargs):
@ -295,8 +299,9 @@ class TecnaMarpossProvasetT3(ModbusComponent):
"Test program for read/write operation": table,
**{719 - 1 + i: (recipe_name[i * 2 + 1] << 8) + recipe_name[i * 2] for i in range(8)}, # program name
**{727 - 1 + i: (recipe_barcode[i * 2 + 1] << 8) + recipe_barcode[i * 2] for i in range(12)}, # program associated bar-code
**{761 - 1 + i: (recipe_name[i * 2 + 1] << 8) + recipe_name[i * 2] for i in range(8)}, # program name
"Print options": 0b0001000000000110,
**{761 - 1 + i: (recipe_name[i * 2 + 1] << 8) + recipe_name[i * 2] for i in range(8)}, # print field 1
# **{769 - 1 + i: (recipe_name[i * 2 + 1] << 8) + recipe_name[i * 2] for i in range(8)}, # print field 2
"Print options": 0b0000000000000000 | self.saver_label_count << 12 | self.saver_print_on_fail << 8 | self.saver_label_template,
"Test type": "Leak Test",
"Test flags": 0b0110000001011100,
"T0 - Pre-filling time": step.spec["pre_filling_time"],
@ -364,7 +369,7 @@ class TecnaMarpossProvasetT3(ModbusComponent):
if len(recipes) > max(self.max_program_number - 1, 0):
self.log.warning(f"too many recipes ({len(recipes)}) saving only first {max(self.max_program_number - 1, 0)}")
for i, [recipe, step] in enumerate(recipes[:max(self.max_program_number - 1, 0)], start=1):
print(recipe.part_number, 150 + i)
self.write_recipe(recipe, step, table=150 + i)
self.log.debug(f"saving recipe {recipe.part_number} to table {i}")
self.write_recipe(recipe, step, table=i)
self.log.info(f"saved {min(len(recipes), max(self.max_program_number - 1, 0))} recipes")
self._store_recipes_lock.release(1)

View File

@ -308,9 +308,9 @@ registers = {
"Print options": [739 - 1, {"dt": "16bit_uint", }],
# | 15 14 13 12 | 11 10 9 8 | 7 6 5 4 3 2 1 0 |
# | STN | STS | STM |
# STM: printer template
# STS: print failed test 0=NO 1=YES
# STN: print copies
# STS: print failed test 0=NO 1=YES
# STM: printer template
"AW: Aperture weight time (AT)": [740 - 1, {"dt": "16bit_uint", }],
"AN: Aperture number": [741 - 1, {"dt": "16bit_uint", }],
# Format x

View File

@ -263,9 +263,9 @@ registers = {
"Print options": [739 - 1, {"dt": "16bit_uint", }],
# | 15 14 13 12 | 11 10 9 | 8 | 7 6 5 4 3 2 1 0 |
# | STN | | STS | STM |
# STM: printer template
# STS: print failed test 0=NO 1=YES
# STN: print copies
# STS: print failed test 0=NO 1=YES
# STM: printer template
"AW: Aperture weight time (AT)": [740 - 1, {"dt": "16bit_uint", }],
"AN: Aperture number": [741 - 1, {"dt": "16bit_uint", }],
# Format x

View File

@ -154,7 +154,7 @@ try:
# self.main_window.steps_management_a.triggered.connect(lambda checked, self=weakref.ref(self): self().main_window.open_dialog(Steps_Management()))
# if "--steps-management" in sys.argv:
# self.main_window.steps_management_a.trigger()
if "tecna_t3" in self.components and "--enable-saving-tecna-recipes" in sys.argv:
if "tecna_t3" in self.components and ("--enable-saving-tecna-recipes" in sys.argv or self.config.get("tecna_t3", {}).get("saver", None) == "present"):
self.main_window.save_tecna_recipes_a.triggered.connect(self.components["tecna_t3"].store_recipes)
self.main_window.save_tecna_recipes_a.setVisible(True)
if "--save-tecna-recipes" in sys.argv: