1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

Working on config output

This commit is contained in:
peteGSX 2023-04-11 05:31:44 +10:00
parent 1d29be9de6
commit 1aae0aed0a

View File

@ -76,7 +76,7 @@ $supportedDevices = @(
) )
<############################################ <############################################
List of supported displays and scroll modes List of supported displays
############################################> ############################################>
$displayList = @( $displayList = @(
@{ @{
@ -97,19 +97,13 @@ $displayList = @(
} }
) )
$scrollList = @( <############################################
@{ Basics of config.h
mode = "Continuous - fill screen if possible" ############################################>
configLine = "#define SCROLLMODE 0" $configLines = @(
}, "/*",
@{ "This config.h file was generated by the DCC-EX PowerShell installer $version",
mode = "Page (default) - alternate between pages" "*/`r`n"
configLine = "#define SCROLLMODE 1"
},
@{
mode = "Row - move up one row at a time"
configLine = "#define SCROLLMODE 2"
}
) )
<############################################ <############################################
@ -447,37 +441,31 @@ If no config directory provided, prompt for display option, and WiFi if using Me
) )
if ($displayChoice -eq ($displayList.Count + 2)) { if ($displayChoice -eq ($displayList.Count + 2)) {
Exit Exit
} elseif ($displayChoice -le ($displayList.Count + 1)) { } elseif ($displayChoice -le 1 -and ($displayList.Count + 1)) {
$displayLine = $displayList[$displayChoice - 1].configLine $configLines.Add("// Display configuration")
$scrollSelect = 1 $configLines.Add($displayList[$displayChoice - 1].configLine)
$defaultScroll = 1 $configLines.Add("#define SCROLLMODE 1 // Alternate between pages")
Write-Host "`r`n Select a scroll option, or press <Enter> to accept the default [$($defaultScroll)]"
foreach ($scroll in $scrollList) {
Write-Output "$scrollSelect - $($scrollList[$scrollSelect - 1].mode)"
$scrollSelect++
}
Write-Output "$($scrollList.Count + 1) - Exit"
do {
[int]$displayScroll = Read-Host "`r`n Select a scroll option, or press <Enter> to accept the default [$($defaultScroll)]"
} until (
(($displayScroll -ge 1 -and $displayScroll -le ($scrollList.Count + 1)) -or $displayScroll -eq "")
)
if ($displayScroll -eq ($scrollList.Count + 1)) {
Exit
} elseif ($displayScroll -eq "") {
$displayScroll = $defaultScroll
}
$scrollLine = $scrollList[$displayScroll - 1]
} }
if ($wifiBoards.Contains($deviceFQBN)) { if ($wifiBoards.Contains($deviceFQBN)) {
# WiFi prompt # WiFi prompt
} }
}
<############################################ <############################################
If display or WiFi options set, create config.h Write out config.h to a file here only if config directory not provided
############################################> ############################################>
$configH = $commandStationDirectory + "\config.h"
foreach ($line in $configLines) {
Write-Output $line
}
Pause
try {
$configLines | Out-File -FilePath $configH
}
catch {
Write-Output "Error writing config file to $configH"
Exit
}
}
<############################################ <############################################
Install core libraries for the platform Install core libraries for the platform