Skip to content

Commit

Permalink
fix(thermocycler-gen2): add serial port argument to hold_temp script (#…
Browse files Browse the repository at this point in the history
…424)

* Add script argument to use a specific port

* Create csv file in a cross-platform manner
  • Loading branch information
fsinapi authored Nov 7, 2022
1 parent 0f4943e commit 6f2f7fd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions stm32-modules/thermocycler-gen2/scripts/hold_temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import re
import time
import datetime
import os

from serial.tools.list_ports import grep
from typing import Dict, Tuple, List
Expand All @@ -17,6 +18,7 @@ def parse_args():
parser = argparse.ArgumentParser(description="Hold temperature")
parser.add_argument('-t', '--temp', type=float, required=True, help='Target temp')
parser.add_argument('--hold', type=float, required=False, default=None, help='Hold time')
parser.add_argument('--port', type=str, required=False, default=None, help='Port to use (comport or tty path)')
parser.add_argument('-f', '--file', type=argparse.FileType('w'), required=False, default=None, help='file to log temperature to')
return parser.parse_args()

Expand Down Expand Up @@ -135,12 +137,13 @@ def main():

target = args.temp

tc = Thermocycler()
tc = Thermocycler(port=args.port)

file = args.file
if not file:
timestamp = datetime.datetime.now()
file = open(f'./tc-hold-{timestamp}.csv', 'w', newline='\n')
filepath = os.path.join(os.getcwd(), f'tc-hold-{timestamp}.csv')
file = open(filepath, 'w', newline='\n')

if args.hold:
print(f'Holding for {args.hold} seconds')
Expand Down

0 comments on commit 6f2f7fd

Please sign in to comment.