IP=${1:-192.168.165.44}  # default RFS in BEG lab

export PYTHONPATH="${PYTHONPATH}:../submodules/FEED/src/python"
leep_addr="leep://"$IP

# Basics on the chitchat Tx side
# Also see cc_reset.sh
python -m leep.cli $leep_addr reg \
    cc_loc1=2 \
    cct1_cavity0_status_aux=1 \
    cct1_cavity1_status_aux=2

# 0  beta_r
# 1  beta_i
# 2  invT
# 3  two
# beta == 0 will track the derivative of the cavity voltage,
# ignoring the forward wave drive term.
# For testing, need at least 2048 counts on cavity (out of 32767 full-scale)
# The physical control registers are 20 bits wide (signed)
python -m leep.cli $leep_addr reg \
    shell_0_dsp_piezo_sf_consts=[0,0,20000,32768] \
    shell_1_dsp_piezo_sf_consts=[0,0,20000,32768] \
    shell_0_dsp_quench_sf_consts=[0,0,0,0] \
    shell_1_dsp_quench_sf_consts=[0,0,0,0]

# look for results in ccr1_cavity0_status, ccr1_cavity1_status
# (0x52 0x53)
