#! /bin/sh #__USAGE #%C # Starts Instrument operation, including # batchfile interact # display hpfdisp # algorithm hpfalgo # client hpfclt # command log #%C stop # Terminates Instrument Operations #%C not # Prevents Instrument Operation on power up by invoking # pick_file /dev/null #%C wait # Delays starting GSE until flight node has begun # the startup process. This verifies that the flight # system operates in flight configuration. #---------------------------------------------------------------- # Perform Common Initializations #---------------------------------------------------------------- boilerplate=mkdoit2.sh for dir in /usr/local/lib/src /usr/local/bin /usr/lib; do if [ -f $dir/$boilerplate ]; then boilerplate=$dir/$boilerplate break fi done [ ! -f $boilerplate ] && { echo Cannot locate boilerplate script $boilerplate >&2 exit 1 } LocalRing="" . $boilerplate #---------------------------------------------------------------- # Allocate Screens #---------------------------------------------------------------- typeset _scr1 _scr2 if [ -n "$_scrdefs" ]; then eval `getcon $condev _scr1 _scr2` elif [ $winrunning = yes ]; then exec on -t $condev $0 -W $* else eval `getcon $condev _scr2` _scr1=$_scr0 fi [ -z "$_scr2" ] && nl_error Unable to allocate enough screens [ $winrunning = yes ] && { winsetsize $_scr0 8 45 `basename $0` echo Allocating Screens > $_scr0 winsetsize $_scr1 25 80 hpf echo "\033/2t \r\c" > $_scr1 escq="\033\"" logf="$Experiment.log\"" echo "${escq}t$logf${escq}i$logf${escq}p$logf\033/2t \r\c" >$_scr2 } typeset _bg_pids='-p' #---------------------------------------------------------------- # Instrument Startup Sequence #---------------------------------------------------------------- if [ -n "$wait_for_node" ]; then echo Waiting for Flight Node to Boot [ $winrunning = yes ] && echo "\033/5t\c" namewait -n0 dg fi echo Waiting for pick_file [ $winrunning = yes ] && echo "\033/5t\c" FlightNode=`pick_file -n interact 2> $_scr0` [ -n "$FlightNode" ] || nl_error pick_file returned an error _msgopts="-v -c$FlightNode" _dcopts="-b$FlightNode -i1" _cmdopts="-C$FlightNode" #---------------------------------------------------------------- # Startup Memo Log Window #---------------------------------------------------------------- on -t $_scr2 less +F //$FlightNode$HomeDir/$Experiment.log [ $winrunning = yes ] && echo "\033/1t\c" > $_scr2 getcon -r $_scr2 typeset _cfgfile if [ -z "$MONOCHROME" ]; then _attrs=02,06,04,05 _cfgfile=hpf.cfg fi echo Waiting for Data Buffer [ $winrunning = yes ] && echo "\033/5t\c" namewait -n$FlightNode db echo Waiting for Command Interpreter [ $winrunning = yes ] && echo "\033/5t\c" namewait -n$FlightNode cmdinterp #---------------------------------------------------------------- # Display Programs: #---------------------------------------------------------------- scrpaint $_msgopts hpf $_cfgfile > $_scr1 < $_scr1; stty +opost < $_scr1 [ $winrunning = yes ] && echo "\033/1t\c" > $_scr1 hpfdisp $_msgopts $_dcopts -A $_scr1 & _bg_pids="$_bg_pids $!" [ $winrunning = yes ] && echo "\033/2t\c" #---------------------------------------------------------------- # Algorithms: #---------------------------------------------------------------- hpfalgo $_msgopts $_dcopts $_cmdopts -A $_scr1 -r 21 & _bg_pids="$_bg_pids $!" #---------------------------------------------------------------- # Keyboard Client: #---------------------------------------------------------------- hpfclt $_msgopts $_cmdopts -A $_scr1 slay -t /${_scr2#//*/} less if [ $winrunning = yes ]; then _scrs="" echo "\033/1t\033/5tShutting Down..." else _scrs=" $_scr0 $_scr1 $_scr2" fi exec parent -qvnt3 "$_bg_pids" $_scrs