From ef0dbdd1f904e2154a50f76a0ae518d4936fb1e0 Mon Sep 17 00:00:00 2001 From: Matthew Connelly Date: Mon, 25 Jun 2018 23:30:36 +0100 Subject: [PATCH] Fixed flash.ps1 to work outside of Windows Powershell - for some reason Get-ChildItem returns an object with all attributes unpopulated but present --- .gitmodules | 3 +++ flash.ps1 | 21 ++++++++++++--------- support/ws-epaper | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) create mode 160000 support/ws-epaper diff --git a/.gitmodules b/.gitmodules index 33a7a0f..79e5ae4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/flash.ps1 b/flash.ps1 index 4cf14a0..9cda2f5 100644 --- a/flash.ps1 +++ b/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 } diff --git a/support/ws-epaper b/support/ws-epaper new file mode 160000 index 0000000..86759f4 --- /dev/null +++ b/support/ws-epaper @@ -0,0 +1 @@ +Subproject commit 86759f43f126c6fd2bf125b10a30c742742b943b