-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.py
37 lines (29 loc) · 828 Bytes
/
compile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
import sys
import warnings
import subprocess
from util import getAndUpdateArduinoPort
"""
This script compiles the project and uploads it to the currently connected Arduino board.
Requires [arduino-cli](https://github.com/arduino/arduino-cli) to be installed and added to the PATH!
"""
arduinoPresent, portInfo = getAndUpdateArduinoPort('./.vscode/arduino.json')
if not arduinoPresent:
warnings.warn("No arduino board detected! Project will be only compiled, without upload")
args = [
"arduino-cli", "compile",
"--libraries", "./lib",
"-b", portInfo.FQBN,
]
if arduinoPresent:
args.extend([
"-p", portInfo.port,
"-u",
])
args.append(sys.argv[1])
proc = subprocess.run(
args,
stdout=sys.stdout,
stderr=sys.stderr,
)
exit(proc.returncode)