#!../../../bin/rhel7-x86_64/tempSoft
#==============================================================
#
#  Abs:  EPICS Startup Script for B24 Test-Stand
#
#  Name: st.cmd
#
#  Facility: LCLS Temperature Controls
#
#  Auth: 15-Apr-2014, Sonya Hooble    (SONYA)
#  Rev:  dd-mmm-yyyy, Reviewer's Name (USERNAME)
#--------------------------------------------------------------
#  Mod:
#        19-Oct-2019, K. Luchini      (LUCHINI):
#         remove b34_hist.db, comments in bkhfapp/Db/dev/Makefile
#         said that history module dependency was removed.
#        16-Oct-2019, K. Luchini      (LUCHINI):
#         load common scripts
#         add caPutLogInit
#         remove unused env var
#         chg Bx to Bk, needed for epics V7
#         chg from 32-bit to 64-bit
#         chg bin from bkhf to tempSoft
#         add standard header
#
#==============================================================

# Set environment variables
epicsEnvSet("LOCATION","lcls-dev1")
epicsEnvSet("IOC_NAME","SIOC:B24:TM01")

# Load common startup script
< ../../common/st.cmd.soft

# bkhf-b024-tm01
#---------------
# Add coupler
# Bk9000_Coupler_Add( UINT8 * cplrname, UINT8 * ipaddr, UINT8 * init_string)
Bk9000_Coupler_Add("bkhf-b024-tm01","134.79.219.201",0)
# Add terminals to the coupler
# Bk9000_Terminal_Add( UINT8 * cplrname, UINT16 slot, UINT8 * btname, UINT8 * init_string)
Bk9000_Terminal_Add("bkhf-b024-tm01", 1, "KL3222", 0)
Bk9000_Terminal_Add("bkhf-b024-tm01", 2, "KL3314", 0)
Bk9000_Terminal_Add("bkhf-b024-tm01", 3, "KL3202", 0)
Bk9000_Terminal_Add("bkhf-b024-tm01", 4, "KL9010", 0)

# Load databases
dbLoadRecords("db/temp_b24.db")

# Set up autosave/restore
< iocBoot/common/init_restore_soft.cmd

# Start EPICS
iocInit()

# Initialize caPutLog
caPutLogInit("${EPICS_CA_PUT_LOG_ADDR}")
# Start autosave
< iocBoot/common/start_restore_soft.cmd

# End of script
