Erase command:
esptool.py --chip esp32 --port COM3 erase_flash
Flash command:
esptool.py --chip esp32 --port COM3 write_flash -z 0x1000 esp32-idf4-20200902-v1.13.bin
Using powershell and ampy to load code (user path replaced with ... ):
Code: Select all
$defaultPort = 'COM3'
$port = $defaultPort
$folder = get-location
<#
$port = Read-Host "Port: [$($defaultPort)]"
if ([string]::IsNullOrWhiteSpace($port))
{
$port = $defaultPort
}
$folder = Read-Host -Prompt 'Folder to Upload'
if ([string]::IsNullOrWhiteSpace($folder))
{
$folder = get-location
Write-Host "Defaulting to current folder: "
Write-Host $folder
}
#>
$app = 'ampy.exe'
$arg1 = '-p'
$arg2 = $port
$arg3 = 'put'
<#
copy library files from the library folder
update this at one point to look to higher folder and libraries folder
this seems to fail the first time, so do it again after folder .py files
#>
$fileName = "...\OneDrive - mc2software, Inc\Development\Automation\Python Projects\libraries\mc2software.py"
$arg4 = $fileName
Write-Host "Uploading " $fileName
& $app $arg1 $arg2 $arg3 $arg4
$files = Get-ChildItem $folder -Filter *.py
foreach ($f in $files)
{
$file = $f.FullName
$fileName = $f.Name
Write-Host "Uploading " $fileName
$arg4 = $file
& $app $arg1 $arg2 $arg3 $arg4
}
<#
copy library files from the library folder
this seems to fail the first time, so do it again
#>
$fileName = "...\OneDrive - mc2software, Inc\Development\Automation\Python Projects\libraries\mc2software.py"
$arg4 = $fileName
Write-Host "Uploading " $fileName
& $app $arg1 $arg2 $arg3 $arg4