mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-30 03:26:13 +01:00
Enable using existing configs
This commit is contained in:
parent
be273454bc
commit
2e518fcac2
|
@ -55,7 +55,7 @@ $supportedDevices = @(
|
||||||
<############################################
|
<############################################
|
||||||
Define global parameters here such as known URLs etc.
|
Define global parameters here such as known URLs etc.
|
||||||
############################################>
|
############################################>
|
||||||
$installerVersion = "v0.0.1"
|
$installerVersion = "v0.0.2"
|
||||||
$gitHubAPITags = "https://api.github.com/repos/DCC-EX/CommandStation-EX/git/refs/tags"
|
$gitHubAPITags = "https://api.github.com/repos/DCC-EX/CommandStation-EX/git/refs/tags"
|
||||||
$gitHubURLPrefix = "https://github.com/DCC-EX/CommandStation-EX/archive/"
|
$gitHubURLPrefix = "https://github.com/DCC-EX/CommandStation-EX/archive/"
|
||||||
if ((Get-WmiObject win32_operatingsystem | Select-Object osarchitecture).osarchitecture -eq "64-bit") {
|
if ((Get-WmiObject win32_operatingsystem | Select-Object osarchitecture).osarchitecture -eq "64-bit") {
|
||||||
|
@ -253,8 +253,18 @@ catch {
|
||||||
<############################################
|
<############################################
|
||||||
If config directory provided, copy files here
|
If config directory provided, copy files here
|
||||||
############################################>
|
############################################>
|
||||||
# To be done
|
$configFiles = @("config.h", "myAutomation.h", "myHal.cpp", "mySetup.h")
|
||||||
# If exists copy config.h, myAutomation.h, myHal.cpp, mySetup.h
|
if ($PSBoundParameters.ContainsKey('configDirectory')) {
|
||||||
|
if (Test-Path -PathType Container -Path $configDirectory) {
|
||||||
|
foreach ($file in $configFiles) {
|
||||||
|
if (Test-Path -PathType Leaf -Path "$configDirectory\$file") {
|
||||||
|
Copy-Item -Path "$configDirectory\$file" -Destination "$commandStationDirectory\$file"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Output "Provided configuration directory $configDirectory does not exist, skipping"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<############################################
|
<############################################
|
||||||
Once files all together, identify available board(s)
|
Once files all together, identify available board(s)
|
||||||
|
@ -338,6 +348,7 @@ if ($null -eq $boardList[$selectedBoard].matching_boards.name) {
|
||||||
} else {
|
} else {
|
||||||
$deviceName = $supportedDevices[$userSelection - 1].name
|
$deviceName = $supportedDevices[$userSelection - 1].name
|
||||||
$deviceFQBN = $supportedDevices[$userSelection - 1].fqbn
|
$deviceFQBN = $supportedDevices[$userSelection - 1].fqbn
|
||||||
|
$devicePort = $boardList[$selectedBoard].port.address
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$deviceName = $boardList[$selectedBoard].matching_boards.name
|
$deviceName = $boardList[$selectedBoard].matching_boards.name
|
||||||
|
@ -349,21 +360,13 @@ if ($null -eq $boardList[$selectedBoard].matching_boards.name) {
|
||||||
Upload the sketch to the selected board
|
Upload the sketch to the selected board
|
||||||
############################################>
|
############################################>
|
||||||
#$arduinoCLI upload -b fqbn -p port $commandStationDirectory
|
#$arduinoCLI upload -b fqbn -p port $commandStationDirectory
|
||||||
Write-Output "Compiling for $deviceName"
|
Write-Output "Compiling and uploading to $deviceName on $devicePort"
|
||||||
|
Write-Output "& $arduinoCLI compile -b $deviceFQBN -u -t -p $devicePort $commandStationDirectory"
|
||||||
try {
|
try {
|
||||||
$output = & $arduinoCLI compile -b $deviceFQBN $commandStationDirectory --format jsonmini | ConvertFrom-Json
|
$output = & $arduinoCLI compile -b $deviceFQBN -u -t -p $devicePort $commandStationDirectory --format jsonmini | ConvertFrom-Json
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Output "Failed to compile"
|
Write-Output "Failed to compile"
|
||||||
Exit
|
Exit
|
||||||
}
|
}
|
||||||
Write-Output "$output"
|
Write-Output "$output"
|
||||||
Write-Output "Now uploading to $deviceName on port $devicePort"
|
|
||||||
try {
|
|
||||||
$output = & $arduinoCLI upload -t -b $deviceFQBN -p $devicePort $commandStationDirectory --format jsonmini | ConvertFrom-Json
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Output "Failed to upload"
|
|
||||||
Exit
|
|
||||||
}
|
|
||||||
Write-Output "$output"
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user