#!/bin/bash
#
# saltro off - read ADC and temp
RMTHOST=192.168.4.12
RMTUSER=mholl
RMTDIR=/home/mholl/smalltpc/lvcard2
CSVDIR=${RMTDIR}/csv
DEVICE=/dev/lvcard2_1
./biasctrltpc-mcmx.sh 1 0
echo "Reading ADCs"
ssh ${RMTUSER}@${RMTHOST} "${RMTDIR}/lvcard2 --readadc 9 --mcmaddress 0 -f ${CSVDIR}/readadc.csv"
echo "Reading LVCARD temperatures"
ssh ${RMTUSER}@${RMTHOST} "${RMTDIR}/lvcard2 --lvtemp 9 --mcmaddress 0 -f ${CSVDIR}/lvtemp.csv"
echo "Reading MCM temperatures"
ssh ${RMTUSER}@${RMTHOST} "${RMTDIR}/lvcard2 --mcmtemp 9 --mcmaddress 0 -f ${CSVDIR}/mcmtemp.csv"
read -p "Exit[eE], else continue:" myinput
re='^[eE]'
if [[ "$myinput" =~ $re ]] ; then
    echo "EXITING"
    exit 1
fi
#
echo "Shutdown power on LVcard"
ssh ${RMTUSER}@${RMTHOST} "${RMTDIR}/lvcard2 --poweroff 10 --mcmaddress 0 -f ${CSVDIR}/power.csv"
echo "Reading ADCs"
ssh ${RMTUSER}@${RMTHOST} "${RMTDIR}/lvcard2 --readadc 10 --mcmaddress 0 -f ${CSVDIR}/readadc.csv"
echo "Reading LVCARD temperatures"
ssh ${RMTUSER}@${RMTHOST} "${RMTDIR}/lvcard2 --lvtemp 10 --mcmaddress 0 -f ${CSVDIR}/lvtemp.csv"
echo "DONE"
