Skip to content

Commit

Permalink
remove unused options and test uf2 exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Neradoc committed Nov 21, 2022
1 parent d691df1 commit 49da760
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/install_uf2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,21 @@
import shutil
import time

PRODUCT_NAME = "QT PY" # not case sensitive

def serial_trick(port):
serial.Serial(port, 1200).close()

# This lets you specify the drive name and data to send in the command line
parser = argparse.ArgumentParser()
parser.add_argument("--name", type=str, help="Product name", default="")
parser.add_argument("--name", type=str, help="Product name")
parser.add_argument("--uf2", type=str, help="Data to send", default="firmware.uf2")
parser.add_argument("--vid", type=int, help="Product name", default=0)
args = parser.parse_args()

# prepare the parameters
product_name = args.name
uf2_file = args.uf2

if not os.path.exists(uf2_file):
print("UF2 file not found")
print("UF2 file not found, running in test mode")

# use filters based on given parameters
if not product_name:
Expand Down Expand Up @@ -61,4 +58,7 @@ def serial_trick(port):

print(f"Copy {uf2_file} to {board.drive}")
uf2_name = os.path.basename(uf2_file)
shutil.copyfile(uf2_file, os.path.join(board.drive, uf2_name))
if os.path.exists(uf2_file):
shutil.copyfile(uf2_file, os.path.join(board.drive, uf2_name))
else:
print("File does not exist, no copy")

0 comments on commit 49da760

Please sign in to comment.