forked from nickrehm/dRehmFlight
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.ps1
51 lines (41 loc) · 977 Bytes
/
build.ps1
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$pio_env1 = "t4"
$pio_env2 = "t41"
function clean_workspace {
$junk = @(
".\.pio\"
".\.vscode\"
".\.gitignore"
)
foreach($item in $junk) {
Remove-Item -Recurse -Force $item -ErrorAction SilentlyContinue
}
}
function upload {
Clear-Host
$device = Read-Host -Prompt "Upload to Teensy4.0 (1) or Teensy4.1 (2) [1/2] >"
if ($device -eq "1") {
pio run -t upload -e $pio_env1
} elseif ($device -eq "2") {
pio run -t upload -e $pio_env2
} else {
Write-Host "Invalid device selection" -fore red
init
}
}
function build {
Clear-Host
Write-Host "Checking 4 bugs..." -fore green
pio run
}
function init {
$up = Read-Host -Prompt "Just Build (b) or Upload to Device (u) [b/u] >"
if ($up -eq "u") {
upload
} elseif ($up -eq "b") {
build
} else {
Write-Host "Invalid option" -fore red
}
}
clean_workspace
init