36 lines
1.2 KiB
Batchfile
36 lines
1.2 KiB
Batchfile
@echo off
|
|
rem ============================================================
|
|
rem ble_ota.bat - BLE OTA updater for CAIIC-MCM devices
|
|
rem
|
|
rem ble_ota.bat [combo_pkg]
|
|
rem default: tools\out\mothercup_ble_ota.bin
|
|
rem
|
|
rem The combined package holds both bank-linked payloads; the script
|
|
rem reads the current bank (info item 0x07 CUR_BANK) and downloads
|
|
rem the payload for the opposite bank, then verifies the reboot.
|
|
rem Requires tools\.venv-ble (created automatically on first run).
|
|
rem ============================================================
|
|
setlocal
|
|
set TOOLS=%~dp0
|
|
set PYEXE=%TOOLS%.venv-ble\Scripts\python.exe
|
|
|
|
if not exist "%PYEXE%" (
|
|
echo [setup] creating venv %TOOLS%.venv-ble ...
|
|
set PYREAL=
|
|
if exist "%LOCALAPPDATA%\Programs\Python\Python312\python.exe" set PYREAL="%LOCALAPPDATA%\Programs\Python\Python312\python.exe"
|
|
if not defined PYREAL (
|
|
py -3 --version >nul 2>&1 && set PYREAL=py -3
|
|
)
|
|
if not defined PYREAL set PYREAL=python
|
|
%PYREAL% -m venv "%TOOLS%.venv-ble" || goto :fail
|
|
"%PYEXE%" -m pip install --quiet bleak || goto :fail
|
|
)
|
|
|
|
"%PYEXE%" "%TOOLS%ble_ota_update.py" %1
|
|
goto :eof
|
|
|
|
:fail
|
|
echo.
|
|
echo *** setup failed - check python installation ***
|
|
exit /b 1
|