<# Flash the monitor firmware (UWB monitor, 2MB flash, app at 0x10000). Reads monitor/flasher_args.json for the chip, flash settings and the exact file -> offset map, auto-detects the serial port, and refuses to overwrite a partition table in a way that would lose data on the board. Examples: . lash_monitor.ps1 # flash bootloader + partition table + app . lash_monitor.ps1 -DryRun # show what would happen, write nothing . lash_monitor.ps1 -AppOnly # write only the app, keep board data . lash_monitor.ps1 -Monitor # flash, then open the serial monitor . lash_monitor.ps1 -Port COM12 # force a port . lash_monitor.ps1 -ManualBoot # board put into download mode by hand (BOOT+RESET) . lash_monitor.ps1 -List # just list candidate serial ports #> [CmdletBinding()] param( [string]$Port, [int]$Baud = 115200, # native USB CDC: real speed is USB full-speed; changing baud is flaky on some hosts — keep 115200 [string]$Esptool, [switch]$AppOnly, [switch]$DryRun, [switch]$Monitor, [switch]$NoVerify, [switch]$Force, [switch]$ManualBoot, [switch]$List ) . (Join-Path $PSScriptRoot 'flash_common.ps1') Invoke-EspFlash -TargetDir (Join-Path $PSScriptRoot 'monitor') @PSBoundParameters