From 3ea0623d95ff73eab9a55018c66d9ed24b537e7c Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 17 Apr 2022 11:46:14 +0200 Subject: [PATCH] fix: bug in mcu index selection Signed-off-by: Dominik Willner th33xitus@gmail.com --- scripts/flash_klipper.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/flash_klipper.sh b/scripts/flash_klipper.sh index de363fc..00295df 100644 --- a/scripts/flash_klipper.sh +++ b/scripts/flash_klipper.sh @@ -105,7 +105,7 @@ function select_mcu_connection(){ #=================== STEP 3 =====================# #================================================# function select_mcu_id(){ - local i=1 sel_index=0 method=${1} + local i=0 sel_index=0 method=${1} top_border echo -e "| ${red}!!! ATTENTION !!!${white} |" hr @@ -115,9 +115,9 @@ function select_mcu_id(){ echo -e "${cyan}###### List of available MCU:${white}" ### list all mcus for mcu in "${mcu_list[@]}"; do + i=$((i+1)) mcu=$(echo "${mcu}" | rev | cut -d"/" -f1 | rev) echo -e " ● MCU #${i}: ${cyan}${mcu}${white}" - i=$((i+1)) done ### verify user input while [[ ! (${sel_index} =~ ^[1-9]+$) ]] || [ "${sel_index}" -gt "${i}" ]; do