Files
WLED_MM_Infinity/tools/flash_rfp_s3.ps1
JFly02 95137a6d65
Some checks failed
WLED CI / wled_build (push) Has been cancelled
Deploy Nightly / wled_build (push) Has been cancelled
Deploy Nightly / Deploy nightly (push) Has been cancelled
Clean up RFP ESP32-S3 target and tooling
2026-04-17 01:00:37 +02:00

45 lines
1.3 KiB
PowerShell

param(
[string]$ComPort,
[switch]$BuildOnly
)
$ErrorActionPreference = "Stop"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$repoRoot = Split-Path -Parent $scriptDir
$envName = "rfp_esp32s3_wroom1_n16r8_3x106"
$venvPython = Join-Path $repoRoot ".venv\Scripts\python.exe"
if (-not $BuildOnly -and [string]::IsNullOrWhiteSpace($ComPort)) {
throw "ComPort is required unless -BuildOnly is used."
}
if (Test-Path $venvPython) {
$pythonCommand = $venvPython
$pythonArgs = @()
} elseif (Get-Command py -ErrorAction SilentlyContinue) {
$pythonCommand = "py"
$pythonArgs = @("-3")
} elseif (Get-Command python -ErrorAction SilentlyContinue) {
$pythonCommand = "python"
$pythonArgs = @()
} else {
throw "No Python runtime found. Install Python or create .venv first."
}
$pioHome = Join-Path $repoRoot ".piohome"
$env:PLATFORMIO_CORE_DIR = $pioHome
$env:PLATFORMIO_PACKAGES_DIR = Join-Path $pioHome "packages"
$env:PLATFORMIO_PLATFORMS_DIR = Join-Path $pioHome "platforms"
$env:PLATFORMIO_CACHE_DIR = Join-Path $pioHome ".cache"
$env:PLATFORMIO_BUILD_CACHE_DIR = Join-Path $pioHome "buildcache"
$args = @("-m", "platformio", "run", "-e", $envName)
if (-not $BuildOnly) {
$args += @("-t", "upload", "--upload-port", $ComPort)
}
& $pythonCommand @pythonArgs @args
exit $LASTEXITCODE