@echo off
REM ESP32-S3 - flash easun.bin (merged image) na 0x0
cd /d "%~dp0"

esptool.exe --chip esp32s3 --baud 921600 --before default_reset --after hard_reset write_flash -e -z --flash_mode dio --flash_freq 80m --flash_size 16MB 0x0 easun.bin

if errorlevel 1 (
  echo.
  echo FAIL - zkus nizsi baud nebo USB port:
  echo   esptool.exe --chip esp32s3 --port COMx --baud 460800 --before usb_reset write_flash -e -z --flash_mode dio --flash_freq 80m --flash_size 16MB 0x0 easun.bin
  pause
  exit /b 1
)
echo OK
pause
