Fixed flash.ps1 to work outside of Windows Powershell - for some reason Get-ChildItem returns an object with all attributes unpopulated but present
This commit is contained in:
parent
1d46664233
commit
ef0dbdd1f9
|
@ -4,3 +4,6 @@
|
|||
[submodule "support/bme280"]
|
||||
path = support/bme280
|
||||
url = https://github.com/catdog2/mpy_bme280_esp8266
|
||||
[submodule "support/ws-epaper"]
|
||||
path = support/ws-epaper
|
||||
url = https://github.com/mcauser/micropython-waveshare-epaper
|
||||
|
|
21
flash.ps1
21
flash.ps1
|
@ -2,6 +2,7 @@ param(
|
|||
[String]$COMPort,
|
||||
[switch]$Extras,
|
||||
[switch]$ResetAfterFlash,
|
||||
[switch]$Verbose,
|
||||
[String[]]$Libs
|
||||
)
|
||||
|
||||
|
@ -11,7 +12,7 @@ Function Find-LibraryFile {
|
|||
[String]$Library,
|
||||
[String]$SearchPath = $(Get-Location)
|
||||
)
|
||||
return (Get-ChildItem -Path $SearchPath -Recurse -Name "$Library.py").FullName
|
||||
return (Get-ChildItem -Path $SearchPath -Recurse -Verbose:$Verbose -Name "$Library.py"|Convert-Path -Verbose:$Verbose)
|
||||
}
|
||||
|
||||
Function Write-AmpyFile {
|
||||
|
@ -23,6 +24,7 @@ Function Write-AmpyFile {
|
|||
If ((Get-Command -Name ampy -ErrorAction SilentlyContinue) -eq $false) {
|
||||
Write-Error -Message "Couldn't locate ``ampy`` in environment paths - please run ``pip install adafruit-ampy``." -ErrorAction Stop
|
||||
}
|
||||
Write-Verbose "Writing $Filename to port $COMPort" -Verbose:$Verbose
|
||||
ampy -p $COMPort put $Filename
|
||||
}
|
||||
|
||||
|
@ -34,6 +36,7 @@ Function Reset-AmpyDevice {
|
|||
If ((Get-Command -Name ampy -ErrorAction SilentlyContinue) -eq $false) {
|
||||
Write-Error -Message "Couldn't locate ``ampy`` in environment paths - please run ``pip install adafruit-ampy``." -ErrorAction Stop
|
||||
}
|
||||
Write-Verbose "Resetting port $COMPort" -Verbose:$Verbose
|
||||
ampy -p $COMPort reset
|
||||
}
|
||||
|
||||
|
@ -51,24 +54,24 @@ $CfgFiles = (
|
|||
)
|
||||
|
||||
$BaseFiles | % {
|
||||
$Lib = Find-LibraryFile -Library $_
|
||||
Write-AmpyFile -Filename "$Lib" -COMPort $COMPort
|
||||
$Lib = Find-LibraryFile -Library $_ -Verbose:$Verbose
|
||||
Write-AmpyFile -Filename "$Lib" -COMPort $COMPort -Verbose:$Verbose
|
||||
}
|
||||
$CfgFiles | % {
|
||||
If (Get-ChildItem "$_.py" -ErrorAction SilentlyContinue) {
|
||||
Write-AmpyFile -Filename "$_.py" -COMPort $COMPort
|
||||
Write-AmpyFile -Filename "$_.py" -COMPort $COMPort -Verbose:$Verbose
|
||||
}
|
||||
}
|
||||
If ($Extras) {
|
||||
$ExtraFiles | % {
|
||||
$Lib = Find-LibraryFile -Library $_
|
||||
Write-AmpyFile -Filename "$Lib" -COMPort $COMPort
|
||||
$Lib = Find-LibraryFile -Library $_ -Verbose:$Verbose
|
||||
Write-AmpyFile -Filename "$Lib" -COMPort $COMPort -Verbose:$Verbose
|
||||
}
|
||||
}
|
||||
If ($Libs.Count -gt 0) {
|
||||
$Libs | % {
|
||||
$Lib = Find-LibraryFile -Library $_
|
||||
Write-AmpyFile -Filename "$Lib" -COMPort $COMPort
|
||||
$Lib = Find-LibraryFile -Library $_ -Verbose:$Verbose
|
||||
Write-AmpyFile -Filename "$Lib" -COMPort $COMPort -Verbose:$Verbose
|
||||
}
|
||||
}
|
||||
If ($ResetAfterFlash) { Reset-AmpyDevice -COMPort $COMPort }
|
||||
If ($ResetAfterFlash) { Reset-AmpyDevice -COMPort $COMPort -Verbose:$Verbose }
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 86759f43f126c6fd2bf125b10a30c742742b943b
|
Loading…
Reference in New Issue