Skip to content

Commit b2c7075

Browse files
author
andy
committed
store
1 parent dd749f5 commit b2c7075

File tree

14 files changed

+187
-77
lines changed

14 files changed

+187
-77
lines changed

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.7.9

__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import subprocess
33

4-
VERSION = '1.3.2'
4+
VERSION = '1.3.4'
55

66

77
def get_version():

dist/Productions-1.3.2.exe

-15.2 MB
Binary file not shown.

dist/Productions-1.3.4.exe

79.9 MB
Binary file not shown.

modules_testing/thermocycle_diagnostic/report.py

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,45 @@
11
import csv
2+
import os.path
23
import time
34

45

56
class Report:
6-
def __init__(self, csv_name: str):
7+
def __init__(self, file_path, csv_name: str):
78
self.csv_name = csv_name + "-" + time.strftime("%Y%m%d") + '.csv'
9+
self.csv_name = os.path.join(file_path, self.csv_name)
10+
11+
def init_report(self):
12+
"""
13+
init csv
14+
:return:
15+
"""
16+
17+
head1 = ["Test: Barcode Scan", "Test: Get System Info", "Test: Get System Info", "Test: Get Board HW Revision",
18+
"Test: UI LED Test", "Test: Front Button LED", "Test: Seal Retracted Switch Test",
19+
"Test: Seal Retracted Switch Test",
20+
"Test: Plate Lift Test", "Test: Lid Open Switch Test", "Test: Lid Open Switch Test",
21+
"Test: Front Button Press", "Test: Front Button Press", "Test: Close Lid Extend Seal Switch Test",
22+
"Test: Close Lid Extend Seal Switch Test",
23+
"Test: Lid Thermistor Test", "Test: Lid Thermistor Test", "Test: Plate Thermistor Test",
24+
"Test: Plate Thermistor Test",
25+
"Test: Heatsink Fan Test", "Test: Heatsink Fan Test", "Test: Lid Heater Test", "Test: Lid Heater Test",
26+
"Test: Cold Peltier Test", "Test: Cold Peltier Test", "Test: Hot Peltier Test",
27+
"Test: Hot Peltier Test", "Test: Plate Temperature&Light", "Test: Plate Temperature&Light"]
28+
29+
head2 = ["Unit Barcode Number", "Unit Firmware Serial Number", "Unit Firmware Revision",
30+
"Unit Board HW Revision",
31+
"RESULT", "RESULT", "M901.D Response", "RESULT", "RESULT", "M901.D Response", "RESULT",
32+
"M901.D Response", "RESULT", "M901.D Response", "RESULT", "Lid Thermistor M141 Response", "RESULT",
33+
"Plate Thermistor M105.D Response", "RESULT", "Heatsink Fan M103.D Response", "RESULT",
34+
"M141 Response",
35+
"RESULT", "Cold Peltier Test M105.D Response", "RESULT", "Hot Peltier Test M105.D Response", "RESULT",
36+
"RESULT Blue(<23C)", "RESULT Red(>23C)"
37+
]
38+
if os.path.exists(self.csv_name):
39+
pass
40+
else:
41+
self.write_row(head1)
42+
self.write_row(head2)
843

944
def write_row(self, row: list):
1045
"""
@@ -36,10 +71,4 @@ def delete_lines(filename, tail):
3671

3772

3873
if __name__ == '__main__':
39-
r = Report("test")
40-
r.write_row(['n', 'c', 2])
41-
r.write_row([3, 4, 3])
42-
r.write_row([3, 4, 3])
43-
r.write_row([3, 4, 3])
44-
r.write_last_row([2, 3, 4])
45-
r.write_last_row([1, 3, 4])
74+
pass

modules_testing/thermocycle_diagnostic/tc_diagnostic.py

Lines changed: 86 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020

2121
class TC:
22-
def __init__(self):
23-
self.report = Report(ReportName)
22+
def __init__(self, file_path):
23+
self.report = Report(file_path, ReportName)
2424
self.serail = SerialDriver()
2525
self.test_result = []
2626

@@ -31,53 +31,20 @@ def write_csv(self):
3131
"""
3232
self.report.write_row(self.test_result)
3333

34-
def init_report(self):
35-
"""
36-
init csv
37-
:return:
38-
"""
39-
40-
head1 = ["Test: Barcode Scan", "Test: Get System Info", "Test: Get System Info", "Test: Get Board HW Revision",
41-
"Test: UI LED Test", "Test: Front Button LED", "Test: Seal Retracted Switch Test",
42-
"Test: Seal Retracted Switch Test",
43-
"Test: Plate Lift Test", "Test: Lid Open Switch Test", "Test: Lid Open Switch Test",
44-
"Test: Front Button Press", "Test: Front Button Press", "Test: Close Lid Extend Seal Switch Test",
45-
"Test: Close Lid Extend Seal Switch Test",
46-
"Test: Lid Thermistor Test", "Test: Lid Thermistor Test", "Test: Plate Thermistor Test",
47-
"Test: Plate Thermistor Test",
48-
"Test: Heatsink Fan Test", "Test: Heatsink Fan Test", "Test: Lid Heater Test", "Test: Lid Heater Test",
49-
"Test: Cold Peltier Test", "Test: Cold Peltier Test", "Test: Hot Peltier Test",
50-
"Test: Hot Peltier Test"]
51-
52-
head2 = ["Unit Barcode Number", "Unit Firmware Serial Number", "Unit Firmware Revision",
53-
"Unit Board HW Revision",
54-
"RESULT", "RESULT", "M901.D Response", "RESULT", "RESULT", "M901.D Response", "RESULT",
55-
"M901.D Response", "RESULT", "M901.D Response", "RESULT", "Lid Thermistor M141 Response", "RESULT",
56-
"Plate Thermistor M105.D Response", "RESULT", "Heatsink Fan M103.D Response", "RESULT",
57-
"M141 Response",
58-
"RESULT", "Cold Peltier Test M105.D Response", "RESULT", "Hot Peltier Test M105.D Response", "RESULT"
59-
]
60-
csv = ReportName + "-" + time.strftime("%Y%m%d") + '.csv'
61-
if os.path.exists(csv):
62-
pass
63-
else:
64-
self.report.write_row(head1)
65-
self.report.write_row(head2)
66-
6734
def init_serial(self):
6835
"""
6936
init serial port connect
7037
:return:
7138
"""
7239
self.serail.init()
7340

74-
def load_test_specification(self):
41+
def load_test_specification(self, test_config=None):
7542
"""
7643
load test guide
7744
:return:
7845
"""
7946
import json
80-
with open("tc_test_specificaition.json", "r", encoding='utf-8') as f:
47+
with open("../../source/modules/tc_test_specification.json", "r", encoding='utf-8') as f:
8148
dict_res = json.load(f)
8249
f.close()
8350
return dict_res
@@ -365,13 +332,13 @@ def flash_sn(self):
365332
else:
366333
print("PASS")
367334

368-
def test_unit(self):
335+
def test_unit(self, test_config):
369336
"""
370337
v-for test unit and write csv
371338
:return:
372339
"""
373340
self.repair_to_start()
374-
specification_dict: dict = self.load_test_specification()
341+
specification_dict: dict = self.load_test_specification(test_config=test_config)
375342
self.get_barcode_number()
376343
result = ""
377344
for k, v in specification_dict.items():
@@ -455,29 +422,99 @@ def test_unit(self):
455422
self.lift_plate()
456423

457424
self.serail.close()
458-
self.write_csv()
459425

426+
def get_plate_tem(self):
427+
responds = self.serail.write_and_get_buffer("M105", delay=3)
428+
try:
429+
idx = responds.index('C:')
430+
temp = responds[idx+2:idx + 6]
431+
temp = float(temp)
432+
return temp
433+
except Exception as e:
434+
print(e)
460435

461-
if __name__ == '__main__':
436+
def test_light_status(self, ):
437+
"""
438+
pass
439+
"""
440+
441+
def get_tem_and_break(target_tem, time_out=3 * 60):
442+
"""
443+
获得温度然后退出
444+
"""
445+
for i in range(time_out):
446+
time.sleep(1)
447+
temp = self.get_plate_tem()
448+
if abs(temp - target_tem) < 0.1:
449+
return True
450+
return False
451+
452+
def show_responds():
453+
ret = self.serail.write_and_get_buffer("M105", delay=3)
454+
print(f"Responds: {ret}")
455+
456+
# 降温到4
457+
print("开始降温 -> 4C")
458+
self.serail.write_and_get_buffer("M104 S4", delay=3)
459+
ret = get_tem_and_break(4)
460+
assert ret, 'set temperature timeout'
461+
462+
input("Plate Temperature & Light 开始测试...")
463+
# 升温到23
464+
self.serail.write_and_get_buffer("M104 S23", delay=3)
465+
get_tem_and_break(23)
466+
show_responds()
467+
ret = input('是否亮蓝色灯条(Y/N)?')
468+
if ret.strip().upper() == 'Y':
469+
print('TEST PASS')
470+
self.test_result.append('Pass')
471+
else:
472+
self.test_result.append('Fail')
473+
# 升温到95
474+
self.serail.write_and_get_buffer("M104 S95", delay=3)
475+
get_tem_and_break(95)
476+
show_responds()
477+
ret = input('是否亮红色灯条(Y/N)?')
478+
if ret.strip().upper() == 'Y':
479+
print('TEST PASS')
480+
self.test_result.append('Pass')
481+
else:
482+
print('TEST FAIL')
483+
self.test_result.append('Fail')
484+
485+
self.serail.write_and_get_buffer("M104 S23", delay=3)
486+
get_tem_and_break(23)
487+
print("结束测试失能...")
488+
self.serail.write_and_get_buffer("M18", delay=3)
489+
490+
491+
def run_tc(project_path):
462492
while True:
463493
get_type = input("=====================\n"
464494
"TC Diagnostic Test\n\n"
465495
"type 1 to start(输入1开始测试)\n"
466496
"type 2 to lift plate(输入2取96孔板)\n"
467497
"type 3 to flash serial number(输入3开始烧录条码)\n"
468-
"type 4 to get error message(输入4查看当前错误信息)\n")
498+
"type 4 to get error message(输入4查看当前错误信息)\n"
499+
"type 5 to test plat temperature&light(输入5测试灯条颜色)\n")
469500
start_time = time.time()
470-
tc = TC()
501+
data_path = os.path.join(project_path, 'testing_data')
502+
config = os.path.join(project_path, 'source', 'modules', 'tc_test_specification.json')
503+
tc = TC(data_path)
471504
tc.init_serial()
472505
if str(get_type) == "1":
473-
tc.init_report()
474-
tc.test_unit()
506+
tc.report.init_report()
507+
tc.test_unit(config)
508+
tc.test_light_status()
509+
tc.write_csv()
475510
elif str(get_type) == "2":
476511
tc.lift_plate()
477512
elif str(get_type) == "3":
478513
tc.flash_sn()
479514
elif str(get_type) == "4":
480515
tc.get_error_message()
516+
elif str(get_type) == "5":
517+
tc.test_light_status()
481518
else:
482519
pass
483520
end_time = time.time()
@@ -486,3 +523,7 @@ def test_unit(self):
486523
get_input = input("Test Complete, type 'q' to exit, others to continue...(测试结束, 输入‘q’退出,其它键继续...)")
487524
if get_input.strip().lower() == 'q':
488525
break
526+
527+
528+
if __name__ == '__main__':
529+
pass

oem_projects/burning_rock/examples/tc_control.py

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import time
22

3-
from modules.thermocycler import ThermocyclerModule
4-
from ot_type import ModuleName
3+
from oem_projects.burning_rock.modules.thermocycler import ThermocyclerModule
4+
from oem_projects.burning_rock.ot_type import ModuleName
55
import asyncio
66

77

@@ -10,19 +10,30 @@ async def _main():
1010
thermo_v2 = await _thermo_module.get_module_id_by_name(ModuleName.TC_V2)
1111
this_module_id = thermo_v2[0]
1212

13-
await _thermo_module.set_lid_temperature(this_module_id, 50)
14-
await _thermo_module.wait_for_lid_temperature(this_module_id)
15-
await _thermo_module.set_block_temperature(this_module_id, 50)
16-
await _thermo_module.wait_for_block_temperature(this_module_id)
17-
18-
lid_temp = await _thermo_module.get_lid_temperature(this_module_id)
19-
block_temp = await _thermo_module.get_block_temperature(this_module_id)
20-
21-
print(f"Lid Temp: {lid_temp}")
22-
print(f"Block Temp: {block_temp}")
23-
24-
await _thermo_module.deactivate_lid(this_module_id)
25-
await _thermo_module.deactivate_block(this_module_id)
13+
# await _thermo_module.set_lid_temperature(this_module_id, 90)
14+
# await _thermo_module.deactivate_all(this_module_id)
15+
# await _thermo_module.wait_for_lid_temperature(this_module_id)
16+
# await _thermo_module.set_block_temperature(this_module_id, 50)
17+
# await _thermo_module.wait_for_block_temperature(this_module_id)
18+
#
19+
# lid_temp = await _thermo_module.get_lid_temperature(this_module_id)
20+
# block_temp = await _thermo_module.get_block_temperature(this_module_id)
21+
#
22+
# print(f"Lid Temp: {lid_temp}")
23+
# print(f"Block Temp: {block_temp}")
24+
#
25+
# await _thermo_module.deactivate_lid(this_module_id)
26+
# await _thermo_module.deactivate_block(this_module_id)
27+
28+
# run profile
29+
await _thermo_module.run_profile(this_module_id, profile=[
30+
{"holdSeconds": 100, "celsius": 50},
31+
{"holdSeconds": 100, "celsius": 95},
32+
{"holdSeconds": 100, "celsius": 50},
33+
{"holdSeconds": 100, "celsius": 95}
34+
])
35+
36+
await _thermo_module.deactivate_all(this_module_id)
2637

2738
await _thermo_module.open_lid(this_module_id)
2839
lid_status = await _thermo_module.get_lid_status(this_module_id)

oem_projects/burning_rock/hardware_control/hardware_control.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from http_client import HttpClient
2-
from ot_type import PositionSel, Mount, Point, Target, Axis, LabWare, Instrument
1+
from oem_projects.burning_rock.http_client import HttpClient
2+
from oem_projects.burning_rock.ot_type import PositionSel, Mount, Point, Target, Axis, LabWare, Instrument
33
from typing import Union, List
44
import asyncio
55

oem_projects/burning_rock/http_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import requests
44

55
# Domain = "http://OT2CEP20230630R01-DEBUGGER:31950"
6-
Domain = "http://192.168.6.8:31950"
6+
Domain = "http://192.168.3.5:31950"
77
headers = {
88
"Content-Type": "application/json",
99
"Opentrons-Version": "3"

oem_projects/burning_rock/modules/module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from hardware_control.hardware_control import HttpClient
2-
from ot_type import ModuleName
1+
from oem_projects.burning_rock.hardware_control.hardware_control import HttpClient
2+
from oem_projects.burning_rock.ot_type import ModuleName
33

44

55
class ModuleBuilder:

0 commit comments

Comments
 (0)