################################################################################
#
# Note:
#
#
################################################################################

#############
# Beginning #
#############


################################
# Selection of SW Board type   #
################################
#sweio_cd.cfg needs to be copied to ram1sdisc even for standard,
#as option weldtimer uses it
copy -from $BOOTPATH/sweio_cd.cfg -to sweio_cd.cfg
#TEST change back according to above
#copy -from sweio_cd.cfg -to sweio_cd.cfg
setvar -var 22 -value 10
echo -text " "
echo -text "Standard SpotWare Board Configuration"
echo -text "is a Digital Board at Address 10"
echo -text " "
echo -text "Is this ok?"
echo -text " "
query -text " Yes     No                              " -var 22 -fk_text
if -var 22 -value 10 -label STANDARD

#
# User Def
#


echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text "Select Board Type: "
echo -text "- Digital Board"
echo -text "- Combi Board"
echo -text "- Sim Board"
echo -text " "
query -text "Digital  Combi   Sim                        " -var 22 -fk_text

echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "

if -var 22 -value 10 -label DIGITAL
if -var 22 -value 20 -label COMBI
if -var 22 -value 30 -label SIM
echo -text "Invalid Board Type "
goto -label STANDARD

#DIGITAL
echo -text "Digital Board selected "
find_replace -path sweio_cd.cfg -find "d328 -Bus BASE" -replace "d328 -Bus BASE"
goto -label RACK_POS
#COMBI
echo -text "Combi Board selected "
find_replace -path sweio_cd.cfg -find "d328 -Bus BASE -Address 10 -Digin 16 -Digout 16" -replace "d327 -Bus BASE -Address 10 -Digin 16 -Digout 16 -Anout 2"
echo -text " "
goto -label RACK_POS
#SIM
echo -text "Simulated Board selected "
find_replace -path sweio_cd.cfg -find "d328 -Bus BASE" -replace "eip000 -Bus SIM"
goto -label RACK_POS

#RACK_POS
echo -text " "
echo -text "Select Module Address (10-64):"
echo -text " "
echo -text "Insert the First digit in address"
echo -text " "
query -text "Select First digit (E.g. 1 if 12):" -var 22
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "

if -var 22 -value 0 -label DIG0
if -var 22 -value 1 -label DIG1
if -var 22 -value 2 -label DIG2
if -var 22 -value 3 -label DIG3
if -var 22 -value 4 -label DIG4
if -var 22 -value 5 -label DIG5
if -var 22 -value 6 -label DIG6
#
#ERROR
echo -text " " 
echo -text "Address doesn't exist "
echo -text "Module address 10 selected!!!!"
goto -label STANDARD
##
#DIG0
echo -text " "
echo -text "First Digit 0X"
find_replace -path sweio_cd.cfg -find "-Address 1" -replace "-Address 0"
goto -label NEXT_STEP 
#DIG1
echo -text " "
echo -text "First Digit 1X"
find_replace -path sweio_cd.cfg -find "-Address 1" -replace "-Address 1"
goto -label NEXT_STEP 
#DIG2
echo -text " "
echo -text "First Digit 2X"
find_replace -path sweio_cd.cfg -find "-Address 1" -replace "-Address 2"
goto -label NEXT_STEP 
#DIG3
echo -text " "
echo -text "First Digit 3X"
find_replace -path sweio_cd.cfg -find "-Address 1" -replace "-Address 3"
goto -label NEXT_STEP 
#DIG4
echo -text " "
echo -text "First Digit 4X"
find_replace -path sweio_cd.cfg -find "-Address 1" -replace "-Address 4"
goto -label NEXT_STEP 
#DIG5
echo -text " "
echo -text "First Digit 5X"
find_replace -path sweio_cd.cfg -find "-Address 1" -replace "-Address 5"
goto -label NEXT_STEP 
#DIG6
echo -text " "
echo -text "First Digit 6X"
find_replace -path sweio_cd.cfg -find "-Address 1" -replace "-Address 6"
goto -label NEXT_STEP  

#NEXT_STEP
echo -text " "
echo -text "Insert the Second digit in address"
echo -text " "
query -text "Select Second digit (E.g. 2 if 12):" -var 22
echo -text " "
if -var 22 -value 0 -label DIG0
if -var 22 -value 1 -label DIG1
if -var 22 -value 2 -label DIG2
if -var 22 -value 3 -label DIG3
if -var 22 -value 4 -label DIG4
if -var 22 -value 5 -label DIG5
if -var 22 -value 6 -label DIG6
if -var 22 -value 7 -label DIG7
if -var 22 -value 8 -label DIG8
if -var 22 -value 9 -label DIG9
#
#ERROR
echo -text " " 
echo -text "Address doesn't exist "
echo -text "Module Address 10 selected!!!!"
goto -label STANDARD
##
#DIG0
echo -text " "
echo -text "Second Digit 0"
find_replace -path sweio_cd.cfg -find "0 -Digin 16 -Digout 16" -replace "0 -Digin 16 -Digout 16"
goto -label NEXT_STEP 
#DIG1
echo -text " "
echo -text "Second Digit 1"
find_replace -path sweio_cd.cfg -find "0 -Digin 16 -Digout 16" -replace "1 -Digin 16 -Digout 16"
goto -label NEXT_STEP 
#DIG2
echo -text " "
echo -text "Second Digit 2"
find_replace -path sweio_cd.cfg -find "0 -Digin 16 -Digout 16" -replace "2 -Digin 16 -Digout 16"
goto -label NEXT_STEP 
#DIG3
echo -text " "
echo -text "Second Digit 3"
find_replace -path sweio_cd.cfg -find "0 -Digin 16 -Digout 16" -replace "3 -Digin 16 -Digout 16"
goto -label NEXT_STEP 
#DIG4
echo -text " "
echo -text "Second Digit 4"
find_replace -path sweio_cd.cfg -find "0 -Digin 16 -Digout 16" -replace "4 -Digin 16 -Digout 16"
goto -label NEXT_STEP 
#DIG5
echo -text " "
echo -text "Second Digit 5"
find_replace -path sweio_cd.cfg -find "0 -Digin 16 -Digout 16" -replace "5 -Digin 16 -Digout 16"
goto -label NEXT_STEP 
#DIG6
echo -text " "
echo -text "Second Digit 6"
find_replace -path sweio_cd.cfg -find "0 -Digin 16 -Digout 16" -replace "6 -Digin 16 -Digout 16"
goto -label NEXT_STEP 
#DIG7
echo -text " "
echo -text "Second Digit 7"
find_replace -path sweio_cd.cfg -find "0 -Digin 16 -Digout 16" -replace "7 -Digin 16 -Digout 16"
goto -label NEXT_STEP 
#DIG8
echo -text " "
echo -text "Second Digit 8"
find_replace -path sweio_cd.cfg -find "0 -Digin 16 -Digout 16" -replace "8 -Digin 16 -Digout 16"
goto -label NEXT_STEP 
#DIG9
echo -text " "
echo -text "Second Digit 9"
find_replace -path sweio_cd.cfg -find "0 -Digin 16 -Digout 16" -replace "9 -Digin 16 -Digout 16"
goto -label NEXT_STEP 


#NEXT_STEP
#TEST delete next row
#copy -from sweio_cd.cfg -to sweio_cd.tst

config -filename sweio_cd.cfg -domain EIO
# Cannot delete -path sweio_cd.cfg here, 
# as serial weld timer MIGHT be installed 
# delete -path sweio_cd.cfg  is done on weld timer disc IF installed  

goto -label END

#STANDARD 

echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text " "
echo -text "Digital Board is selected at pos 10"
config -filename $BOOTPATH/sweio_cd.cfg -domain EIO
#TEST change according to above 
#config -filename sweio_cd.cfg -domain EIO

goto -label END

#######
# End #
#######

#
#END
