# FILE: modemenu.src
#
# DESCRIPTION: This procedure sets limits based on mode.
#
# HISTORY: Created by Joe Covington 11-15-95

program "@(#) MODULE: modemenufast.src RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/flight/src/modemenufast_v04.src"
descr " modemenufast - Sets various limits based on mode"

if !GS9 = "" then
  open user "mode" dt !GS9 w
  display "Logging to: %s" !GS9
  write  !GS9 "Log File: %s" !GS9
  writen !GS9 " "
end if

display "Executing procedure modemenu."
write  !GS9 "Executing procedure modemenu :"
write  !GS9 " %s" !DATE
writen !GS9 " %s" !TIME
writen !GS9 " "

# select mode of MDI

startCNFG:

setstr !LS0 = "Which MDI mode?"
setstr !LS3 = "OFF"
setstr !LS4 = "SLEEP"
setstr !LS5 = "SAFE"
setstr !LS6 = "STANDBY"
setstr !LS7 = "READY"
setstr !LS8 = "OBSERVE"

menu !LS9 !LS0 !LS3 !LS4 !LS5 !LS6 !LS7 !LS8

if !LS9 = !LS3  then   ##OFF mode
#  set !GS5 = "OFF"
 inhibit all
 perform  sctemplmt_v01
 perform  dpofflmt_v01
  goto doMODE
end if
if !LS9 = !LS4 then     ##SLEEP mode
#  set !GS5 = "SLEEP"
 perform  sctemplmt_v01
 perform  scvoltlmt_v01
 perform  dponlmt_v01
 perform  mdtemplmt_v02
 perform  mdvoltlmt_v01
 perform  fdclslmt_v01
 perform  icmlofflmt_v01
  goto doMODE
end if
if !LS9 = !LS5  then    ##SAFE mode
#  set !GS5 = "SAFE"
 perform  sctemplmt_v01
 perform  scvoltlmt_v01
 perform  dponlmt_v01
 perform  mdtemplmt_v02
 perform  mdvoltlmt_v01
 perform  icmlonlmt_v01
 perform  fdclslmt_v01
 perform  ltopnlmt_v01
  goto doMODE
end if
if !LS9 = !LS6  then    ##STANDBY mode
#  set !GS5 = "STANDBY"
 perform  sctemplmt_v01
 perform  scvoltlmt_v01
 perform  dponlmt_v01
 perform  mdtemplmt_v02
 perform  mdvoltlmt_v01
 perform  icmlonlmt_v01
 perform  fdopn1lmt_v01
 perform  ltopnlmt_v01
  goto doMODE
end if
if !LS9 = !LS7  then    ##READY mode
#  set !GS5 = "READY" 
 perform  sctemplmt_v01
 perform  scvoltlmt_v01
 perform  dponlmt_v01
 perform  mdtemplmt_v02
 perform  mdvoltlmt_v01
 perform  icmlonlmt_v01
 perform  fdopn1lmt_v01
 perform  ltclslmt_v01
  goto doMODE
end if
if !LS9 = !LS8  then    ##OBSERVE mode
#  set !GS5 = "OBSERVE"
 perform  sctemplmt_v01
 perform  scvoltlmt_v01
 perform  dponlmt_v01
 perform  mdtemplmt_v02
 perform  mdvoltlmt_v01
 perform  icmlonlmt_v01
 perform  fdopn1lmt_v01
 perform  ltclslmt_v01
  goto doMODE
end if

doMODE:

writen !GS9 "MDI Mode Selected: %s" !LS9
display "MDI Mode Selected %s " !LS9 to 31

Done:

writen !GS9 "Finished procedure modemenu: %s" !TIME
writen !GS9 " "

close user !GS9 
setstr !GS9 = ""
return

