1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-22 23:56:13 +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 = @(
@{
@ -97,19 +97,13 @@ $displayList = @(
}
)
$scrollList = @(
@{
mode = "Continuous - fill screen if possible"
configLine = "#define SCROLLMODE 0"
},
@{
mode = "Page (default) - alternate between pages"
configLine = "#define SCROLLMODE 1"
},
@{
mode = "Row - move up one row at a time"
configLine = "#define SCROLLMODE 2"
}
<############################################
Basics of config.h
############################################>
$configLines = @(
"/*",
"This config.h file was generated by the DCC-EX PowerShell installer $version",
"*/`r`n"
)
<############################################
@ -447,37 +441,31 @@ If no config directory provided, prompt for display option, and WiFi if using Me
)
if ($displayChoice -eq ($displayList.Count + 2)) {
Exit
} elseif ($displayChoice -le ($displayList.Count + 1)) {
$displayLine = $displayList[$displayChoice - 1].configLine
$scrollSelect = 1
$defaultScroll = 1
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]
} elseif ($displayChoice -le 1 -and ($displayList.Count + 1)) {
$configLines.Add("// Display configuration")
$configLines.Add($displayList[$displayChoice - 1].configLine)
$configLines.Add("#define SCROLLMODE 1 // Alternate between pages")
}
if ($wifiBoards.Contains($deviceFQBN)) {
# 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