-
Notifications
You must be signed in to change notification settings - Fork 42
/
build-windows.ps1
39 lines (30 loc) · 1.01 KB
/
build-windows.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
# automated build script for Windows
# check if idf.py is avaialble
try {if(Get-Command idf.py){}}
Catch {
Write-Host "idf.py not available. Run script in ESP-IDF command prompt with"
Write-Host "powershell .\build-windows.ps1"
$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
exit
}
# compress web pages
cd main\www
start-process -wait compress_pages.sh
cd ..\..
# build project
Start-Process -wait idf.py all -NoNewWindow
# read default COM port from build-windows-defaultcomport file
$defaultCOMport = Get-Content build-windows-defaultcomport
# ask user for COM port
$COMport = Read-Host -Prompt "Enter COM port (default: $defaultCOMport)"
if (-not $COMport) {
$COMport = $defaultCOMport
}
if (-not $COMport.StartsWith("COM")) {
$COMport = "COM" + $COMport
}
Write-Host 'Restart Device in Upload Mode now'
Write-Host -NoNewLine "Press any key to upload firmware to $COMport"
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
# flash firmware
idf.py -p $COMport app-flash