Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to camViewer #94

Merged
merged 32 commits into from
Mar 19, 2022
Merged
Changes from 4 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0390af7
ENH:Added full worded options --enable and --disable
spenc333 Jan 11, 2022
7920e8a
ENH:Allows cameras outside of hutch to be enabled and disabled
spenc333 Jan 12, 2022
6570eaf
BUG: Fixed -H option
spenc333 Jan 13, 2022
ef12eb1
BUG: Modified previous -H fix to work with other options
spenc333 Jan 13, 2022
20d716e
DEV: Initial commit for imgr script
spenc333 Jan 13, 2022
2132e0a
BUG:Added conditions to take care of all commands
spenc333 Jan 13, 2022
5cab304
Removed conditionals
spenc333 Jan 14, 2022
d23b085
Created iocinfo() to avoid code duplication for enable/disable
spenc333 Jan 14, 2022
77f0bcf
Fixed fully worded enable/disable options and removed else statement …
spenc333 Jan 14, 2022
8aac235
Removed sourcing
spenc333 Jan 14, 2022
c50a9c6
ENH: Changed how iocinfo deals with multiple iocs
spenc333 Jan 15, 2022
7d0af74
Added engineering tools to path
spenc333 Jan 15, 2022
c3c55c9
Revised adding engineering tools to path
spenc333 Jan 15, 2022
db69540
Updated imgr to use script specific to each hutch. Removed help funct…
spenc333 Jan 21, 2022
db4aba8
Fixed styling and edited -l and -c options
spenc333 Jan 21, 2022
3815117
Amended where the hutch gets defined
spenc333 Jan 21, 2022
673b647
STY: Style fixes from shellcheck
spenc333 Jan 21, 2022
7de00d4
Merge branch 'master' into camviewer-76
ZryletTC Feb 16, 2022
aa398e1
Removed imgr
spenc333 Feb 25, 2022
2b43155
Merge branch 'master' of https://github.com/pcdshub/engineering_tools…
spenc333 Feb 25, 2022
df4ac3d
Merge branch 'camviewer-76' of https://github.com/spenc333/engineerin…
spenc333 Feb 25, 2022
31a2f44
BUG: Fixed syntax errors that broke the default camera selection
spenc333 Mar 2, 2022
8536d20
Fixed enable and disable command line long options
spenc333 Mar 11, 2022
fb4a672
Updated usage function
spenc333 Mar 11, 2022
bda7203
Changed path instance
spenc333 Mar 12, 2022
e4f53db
Style Fixes
spenc333 Mar 16, 2022
1a8a311
More style fixes
spenc333 Mar 16, 2022
2935c52
Error handling
spenc333 Mar 19, 2022
9a67d97
Added usage function to unknown hutch error.
spenc333 Mar 19, 2022
14b0c9e
Merge branch 'master' of https://github.com/pcdshub/engineering_tools…
spenc333 Mar 19, 2022
8acdad4
Fixing a git push
spenc333 Mar 19, 2022
7044a3e
Syntax fixes
spenc333 Mar 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 56 additions & 41 deletions scripts/camViewer
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
PATH=$PATH:$DIR
PATH=$DIR:$PATH

#
# find_pv: use find_pv to get to the sysreset PV of the IOC for rebooting.
Expand Down Expand Up @@ -37,8 +37,8 @@ tmp=/tmp/cv.$$
cat "$VIEWERCFG" | grep -i "$NAME" | grep -v '#' | awk -F, '{ if (split($2,a,";")==1) n=$2; else n=a[2]; gsub(" ","",n); gsub(" ","",$4); printf "%s %s\n", n, $4; }' >$tmp
c=$(wc -l <$tmp)
if [ "$c" -eq 0 ]; then
VIEWERCFG='/reg/g/pcds/pyps/config/*/camviewer.cfg'
cat "$VIEWERCFG" | grep -i "$NAME" | grep -v '#' | awk -F, '{ if (split($2,a,";")==1) n=$2; else n=a[2]; gsub(" ","",n); gsub(" ","",$4); printf "%s %s\n", n, $4; }' >$tmp
VIEWERCFG=/reg/g/pcds/pyps/config/*/camviewer.cfg
cat $VIEWERCFG | grep -i "$NAME" | grep -v '#' | awk -F, '{ if (split($2,a,";")==1) n=$2; else n=a[2]; gsub(" ","",n); gsub(" ","",$4); printf "%s %s\n", n, $4; }' >$tmp
c=$(wc -l <$tmp)
if [ "$c" -eq 0 ]; then
echo "No match for $1"
Expand Down Expand Up @@ -104,14 +104,14 @@ HUTCH=$(echo "$1" | tr a-z A-Z)
hutch=$(echo "$1" | tr A-Z a-z)

ALLVIEWERCFG=/reg/g/pcds/pyps/config/*/camviewer.cfg
echo cat "$ALLVIEWERCFG" | grep -v '#' | awk -F, '{ if (split($2,a,";")==1) n=$2; else n=a[2]; gsub(" ","",n); gsub(" ","",$4); printf "%s %s\n", n, $4; }'
echo cat $ALLVIEWERCFG | grep -v '#' | awk -F, '{ if (split($2,a,";")==1) n=$2; else n=a[2]; gsub(" ","",n); gsub(" ","",$4); printf "%s %s\n", n, $4; }'

VIEWERCFGLFE=/reg/g/pcds/pyps/config/lfe/camviewer.cfg
VIEWERCFG=/reg/g/pcds/pyps/config/$hutch/camviewer.cfg
VIEWERCFGXRT=/reg/g/pcds/pyps/config/xrt/camviewer.cfg

if [ "$hutch" != 'tmo' ] && [ "$hutch" != 'rix' ]; then
for gige_cam in $(grep -v '#' $VIEWERCFGLFE | awk -F, '{print $4 "\n" '); do
for gige_cam in $(grep -v '#' $VIEWERCFGLFE | awk -F, '{print $4 "\n"} '); do
echo "$gige_cam"
done

Expand Down Expand Up @@ -148,26 +148,27 @@ usage: $0 options
start the viewer for controls cameras

OPTIONS:
-c: camera name as in camera list or gige #
-m: bring up the edm screen
-r: reboot the IOC
-l: print list of cameras
-w #: (wait for # hours to ask to renew, default 2 and 12 for GIGEs)
-u #: update rate limit (default 5)
-H hutch: use a specific hutches camviewer config file
-e|--enable: enable camera ioc
-d|--disable: disable camera ioc
-c|--cam : camera name as in camera list or gige #
-m|--main : bring up the edm screen
ZryletTC marked this conversation as resolved.
Show resolved Hide resolved
-r|--reboot : reboot the IOC
-l|--list : print list of cameras
-w|--wait # : (wait for # hours to ask to renew, default 2 and 12 for GIGEs)
spenc333 marked this conversation as resolved.
Show resolved Hide resolved
-u|--rate # : update rate limit (default 5)
spenc333 marked this conversation as resolved.
Show resolved Hide resolved
-H|--hutch : use a specific hutches camviewer config file
spenc333 marked this conversation as resolved.
Show resolved Hide resolved
-e|--enable : enable camera ioc
-d|--disable: disable camera ioc
EOF
}

if [[ ($1 == "--help") || ($1 == "-h") ]]; then
usage
exit 0
fi


LIST=0
CAMNUM=0
CAMNAME=0
CAM=0
WAIT=0
RATE=-1
REBOOT=0
Expand All @@ -176,38 +177,52 @@ DISABLE=0
MAINSCREEN=0


while getopts " -o c:w:u:H:lmre:(enable)d:(disable)" OPTION
OPTIONS=$(getopt -o lmredc:w:u:H: --long list,main,reboot,enable,disable,cam:,wait:rate:hutch: -- "$@")
spenc333 marked this conversation as resolved.
Show resolved Hide resolved

if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi

eval set -- "$OPTIONS"

while [ : ]
do
case $OPTION in
l)
LIST=1
;;
c)
CAM=$OPTARG
;;
w)
WAIT=$OPTARG
;;
u)
RATE=$OPTARG
;;
H)
hutch=$OPTARG
;;
m)
MAINSCREEN=1
;;
r)
REBOOT=1
;;
e|enable)
case "$1" in
-l|--list)
LIST=1
shift
;;
-c|--cam)
CAM=$2
shift 2 ;;
-w|--wait)
WAIT=$2
shift 2 ;;
-u|--rate)
RATE=$2
shift 2 ;;
-H|--hutch)
hutch=$2
shift 2 ;;
-m|--main)
MAINSCREEN=1
shift
;;
-r|--rate)
REBOOT=1
shift
;;
-e|--enable)
ENABLE=1
shift
;;
d|disable)
-d|--disable)
DISABLE=1
shift
;;
--) shift
spenc333 marked this conversation as resolved.
Show resolved Hide resolved
break
;;
esac

esac
done


spenc333 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down