From 9c0b36dc65ffeeebb0ac7736ed33e56b9d84212c Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Tue, 5 Sep 2023 17:48:36 +0200 Subject: [PATCH] tools/psoc6/mpy-psoc.cmd: Fixing board selection validation. Signed-off-by: enriquezgarc --- tools/psoc6/mpy-psoc6.cmd | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/tools/psoc6/mpy-psoc6.cmd b/tools/psoc6/mpy-psoc6.cmd index 6cda1b672699..b57227c78635 100644 --- a/tools/psoc6/mpy-psoc6.cmd +++ b/tools/psoc6/mpy-psoc6.cmd @@ -20,7 +20,7 @@ exit /b 0 exit /b 0 :cmd_firmware_deploy - call :mpy_firmware_deploy %2 %3 + call :mpy_firmware_deploy %2 %3 %4 exit /b 0 :cmd_device_erase @@ -175,10 +175,18 @@ exit /b 0 echo ^| 1 ^| CY8CPROTO-063-BLE ^| echo +---------+-----------------------------------+ echo: - @REM echo No user selection required. Only one choice. - @REM set /a board_index=0 - echo: - set /p/( board_index="Please type the desired board ID.") + set /P board_index=Please type the desired board ID: + + if !board_index! LSS 0 ( + echo error: board ID not valid + exit /b 1 + ) + + if !board_index! GTR 1 ( + echo error: board ID not valid + exit /b 1 + ) + call set board=%%board_list[!board_index!]%% ) echo MicroPython PSoC6 Board :: %board% @@ -239,10 +247,18 @@ exit /b 0 echo ^| 1 ^| CY8CPROTO-063-BLE ^| echo +---------+-----------------------------------+ echo: - @REM echo No user selection required. Only one choice. - @REM set /a board_index=0 - echo: - set /p/( board_index="Please type the desired board ID.") + set /P board_index=Please type the desired board ID: + + if !board_index! LSS 0 ( + echo error: board ID not valid + exit /b 1 + ) + + if !board_index! GTR 1 ( + echo error: board ID not valid + exit /b 1 + ) + call set board=%%board_list[!board_index!]%% ) echo MicroPython PSoC6 Board :: %board%