Skip to content

Commit 9329e93

Browse files
committed
Merge upload script final
2 parents ab3baf2 + 6fc5674 commit 9329e93

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
doxydocs
33
project.checksum
44
*.json
5+
.pio

317_upload.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,22 @@
33
import os
44
import subprocess
55
import re
6+
import time
67
filepath = ".pio/build/due/firmware.bin"
78
# bossa port format doesn't match above ls so we have to reconstruct
89
mac_port = subprocess.check_output("ls /dev/tty.usb*", shell=True, text=True).strip()
9-
print(mac_port)
1010
port_num = re.findall(r'\d+', mac_port)[0]
11-
print(port_num)
12-
port = "cu.usbmodem"+str(port_num)
11+
port = "/dev/cu.usbmodem"+str(port_num)
1312
# send 1200 bps signal to enter boot loading mode
14-
command = "stty 1200 < /dev/"+port
15-
os.system(command)
13+
subprocess.run(["stty","-f",port,"1200"],check=True)
14+
# double check port
15+
mac_port = subprocess.check_output("ls /dev/tty.usb*", shell=True, text=True).strip()
16+
port_num = re.findall(r'\d+', mac_port)[0]
17+
# name format different for bossa
18+
port = "cu.usbmodem"+str(port_num)
19+
# wait for boot loader
20+
time.sleep(2)
1621
# upload firmware with bossac.
1722
# -U must be true for native port upload (bobshieldv6)
18-
command = "~/Library/Arduino15/packages/arduino/tools/bossac/1.6.1-arduino/bossac -i -d --port="+port+" -U true -e -w -v -b "+filepath
23+
command = "~/Library/Arduino15/packages/arduino/tools/bossac/1.6.1-arduino/bossac --port="+port+" -U true -e -w -v -b "+filepath+" -R"
1924
os.system(command)

0 commit comments

Comments
 (0)