#!/bin/bash
#==============================================================
#
#  Abs:   Controls LCLS I feedback ON/OFF
#
#  Name:  feedbackStateControl
#
#  Rem:  OFF will save current state so that ON restores that state
#        NORMAL restores file saved during normal operations
#        cp fbckState fbckStateNormal to make a new normal file. 
#
# Usage: 
#         
#  Auth:  29-Aug-2017, W. Colocho
#  Rev:   06-Jun-2017, W. Colocho, simple on/off now. excludes charge fbck
#         
#
#--------------------------------------------------------------
# Mods: (Latest to oldest)


option=$1
D=/usr/local/lcls/tools/script

case $option in
  OFF)
  caPut1 $D/fbckOff
  echo feedbacks states to OFF
;;
  ON)
  echo feedbacks states to ON
  caPut1 $D/fbckOn
;;
  NORMAL)
  echo feedbacks states to NORMAL
  caPut1 $D/fbckStateNormal
;;
 NEW_NORMAL)
 echo New NORMAL state saved for all feedbacks
 caGet1 $D/fbckList $D/fbckStateNormal
;;
 NEW_OFF)
 echo New OFF state saved for all feedbacks
 caGet1 $D/fbckList $D/fbckOff
;;
 NEW_ON)
 echo New ON state saved for all feedbacks
 caGet1 $D/fbckList $D/fbckOn
;;
esac