mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 12:51:24 +01:00
0.0.7 Ready for testing
This commit is contained in:
parent
1aae0aed0a
commit
6199cecd42
@ -89,11 +89,11 @@ $displayList = @(
|
||||
},
|
||||
@{
|
||||
option = "OLED 128 x 32"
|
||||
configLine = "#define OLED_DRIVER 128,32,0x3c"
|
||||
configLine = "#define OLED_DRIVER 128,32"
|
||||
},
|
||||
@{
|
||||
option = "OLED 128 x 64"
|
||||
configLine = "#define OLED_DRIVER 128,64,0x3c"
|
||||
configLine = "#define OLED_DRIVER 128,64"
|
||||
}
|
||||
)
|
||||
|
||||
@ -102,8 +102,12 @@ Basics of config.h
|
||||
############################################>
|
||||
$configLines = @(
|
||||
"/*",
|
||||
"This config.h file was generated by the DCC-EX PowerShell installer $version",
|
||||
"*/`r`n"
|
||||
"This config.h file was generated by the DCC-EX PowerShell installer $installerVersion",
|
||||
"*/",
|
||||
"",
|
||||
"// Define standard motor shield",
|
||||
"#define MOTOR_SHIELD_TYPE STANDARD_MOTOR_SHIELD",
|
||||
""
|
||||
)
|
||||
|
||||
<############################################
|
||||
@ -148,8 +152,6 @@ Prompt user to confirm all is ready to proceed
|
||||
$confirmation = Read-Host "Enter 'Y' or 'y' then press <Enter> to confirm you are ready to proceed, any other key to exit"
|
||||
if ($confirmation -ne "Y" -and $confirmation -ne "y") {
|
||||
Exit
|
||||
} else {
|
||||
Write-Output "Proceeding to obtain the Arduino CLI..."
|
||||
}
|
||||
|
||||
<############################################
|
||||
@ -165,7 +167,7 @@ if (!(Test-Path -PathType Leaf -Path $arduinoCLI)) {
|
||||
Exit
|
||||
}
|
||||
}
|
||||
Write-Output "Downloading and extracting Arduino CLI"
|
||||
Write-Output "`r`nDownloading and extracting Arduino CLI"
|
||||
try {
|
||||
Invoke-WebRequest -Uri $arduinoCLIURL -OutFile $arduinoCLIZip
|
||||
}
|
||||
@ -179,6 +181,8 @@ if (!(Test-Path -PathType Leaf -Path $arduinoCLI)) {
|
||||
catch {
|
||||
Write-Output "Failed to extract Arduino CLI"
|
||||
}
|
||||
} else {
|
||||
Write-Output "`r`nArduino CLI already downloaded, ensuring it is up to date and you have a board connected"
|
||||
}
|
||||
|
||||
<############################################
|
||||
@ -424,7 +428,7 @@ if ($PSBoundParameters.ContainsKey('configDirectory')) {
|
||||
} else {
|
||||
|
||||
<############################################
|
||||
If no config directory provided, prompt for display option, and WiFi if using Mega
|
||||
If no config directory provided, prompt for display option
|
||||
############################################>
|
||||
Write-Output "`r`nIf you have an LCD or OLED display connected, you can configure it here`r`n"
|
||||
$displaySelect = 1
|
||||
@ -441,25 +445,49 @@ If no config directory provided, prompt for display option, and WiFi if using Me
|
||||
)
|
||||
if ($displayChoice -eq ($displayList.Count + 2)) {
|
||||
Exit
|
||||
} 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")
|
||||
} elseif ($displayChoice -le ($displayList.Count)) {
|
||||
$configLines+= "// Display configuration"
|
||||
$configLines+= "$($displayList[$displayChoice - 1].configLine)"
|
||||
$configLines+= "#define SCROLLMODE 1 // Alternate between pages"
|
||||
}
|
||||
<############################################
|
||||
If device supports WiFi, prompt to configure
|
||||
############################################>
|
||||
if ($wifiBoards.Contains($deviceFQBN)) {
|
||||
# WiFi prompt
|
||||
Write-Output "`r`nYour chosen board supports WiFi`r`n"
|
||||
Write-Output "1 - I don't want WiFi, skip this step
|
||||
2 - Configure my device as an access point I will connect to directly
|
||||
3 - Configure my device to connect to my home WiFi network
|
||||
4 - Exit"
|
||||
do {
|
||||
[int]$wifiChoice = Read-Host "`r`nSelect a WiFi option"
|
||||
} until (
|
||||
($wifiChoice -ge 1 -and $wifiChoice -le 4)
|
||||
)
|
||||
if ($wifiChoice -eq 4) {
|
||||
Exit
|
||||
} elseif ($wifiChoice -ne 1) {
|
||||
$configLines+= ""
|
||||
$configLines+= "// WiFi configuration"
|
||||
$configLines+= "#define ENABLE_WIFI true"
|
||||
$configLines+= "#define IP_PORT 2560"
|
||||
$configLines+= "#define WIFI_HOSTNAME ""dccex"""
|
||||
$configLines+= "#define WIFI_CHANNEL 1"
|
||||
if ($wifiChoice -eq 3) {
|
||||
$wifiSSID = Read-Host "Please enter the SSID of your home network here"
|
||||
$wifiPassword = Read-Host "Please enter your home network WiFi password here"
|
||||
$configLines+= "#define WIFI_SSID ""$($wifiSSID)"""
|
||||
$configLines+= "#define WIFI_PASSWORD ""$($wifiPassword)"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<############################################
|
||||
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
|
||||
$configLines | Out-File -FilePath $configH -Encoding ascii
|
||||
}
|
||||
catch {
|
||||
Write-Output "Error writing config file to $configH"
|
||||
|
Loading…
Reference in New Issue
Block a user