Skip to content

Commit

Permalink
added tc test
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNASC20 committed Dec 18, 2024
1 parent 3895846 commit f647a20
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions abr-testing/abr_testing/tools/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,24 @@
# python3 test_modules.py


async def tc_test_1(module: str, path_to_file: str)-> None:
duration = int(input("How long to run this test for? (in seconds): "))
start = time.time()
while time.time() - start < duration:
try:
tc_open_lid(module, path_to_file)
except asyncio.TimeoutError:
return
time.sleep(5)
try:
tc_close_lid(module, path_to_file)
except asyncio.TimeoutError:
return
time.sleep(5)


async def hs_test_1(module: str, path_to_file: str) -> None:
"""Heater Shaker Test 1."""
"""Heater Shaker Test 1. (Home and Shake)"""
duration = int(input("How long to run this test for? (in seconds): "))
rpm = input("Target RPM (200-3000): ")
start = time.time()
Expand Down Expand Up @@ -44,14 +60,16 @@ async def input_codes(module: str, path_to_file: str) -> None:
"Test 1": (hs_test_1, "Repeatedly home heater shaker then set shake speed"),
"Input GCodes": (input_codes, "Input g codes"),
}
td_tests: Dict[str, Tuple[Any, str]] = {}

tc_tests: Dict[str, Tuple[Any, str]] = {}
tc_tests: Dict[str, Tuple[Any, str]] = {
"Test 1": (tc_test_1, "Repeatedly open and close TC lid"),
"Input GCodes": (input_codes, "Input g codes"),
}

global modules

modules = {
"heatershaker": hs_tests,
"tempdeck": td_tests,
"thermocycler": tc_tests,
}

Expand Down Expand Up @@ -80,6 +98,7 @@ async def main(module: str) -> None:
traceback.print_exc()


# HS Test Functions
async def hs_test_home(module: str, path_to_file: str) -> None:
"""Home heater shaker."""
hs_gcodes = module_control.hs_gcode_shortcuts
Expand All @@ -101,6 +120,21 @@ async def hs_deactivate(module: str, path_to_file: str) -> None:
await (module_control._main(module, [deactivate_gcode, "done"], path_to_file))


# TC Test Functions
async def tc_open_lid(module: str, path_to_file: str) -> None:
"""Open thermocycler lid"""
tc_gcodes = module_control.tc_gcode_shortcuts
open_lid_gcode = tc_gcodes["ol"]
await (module_control._main(module, [open_lid_gcode, "done"], path_to_file))

async def tc_close_lid(module: str, path_to_file: str) -> None:
"""Open thermocycler lid"""
tc_gcodes = module_control.tc_gcode_shortcuts
close_lid_gcode = tc_gcodes["cl"]
await (module_control._main(module, [close_lid_gcode, "done"], path_to_file))



if __name__ == "__main__":
print("Modules:")
for i, module in enumerate(modules):
Expand Down

0 comments on commit f647a20

Please sign in to comment.