# File: fl_safe.src
#
# This procedure powers down the MDI ISS, mechanisms and camera
#
# This procedure is translated from m_fl_ipon TSTOL procedure.
# 

program "@(#) MODULE: ipon.src RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/flight/src/fl_safe.src"
descr "   fl_safe - Power off MDI subsystems"

beep
display "Bring up Power System display page."

perform reset                   ## Stop DEP sequencer
tcblock mbltopnl                ## Limb tracker to openloop

wait time 10

display "Switching off limb tracker."

tcblock mbpwltof                ## Power off limb tracker

wait time 60

if getdig(mkpwlt) <> "         OFF" then
  display "Limb tracker is NOT off"
  halt
end if

perform fl_obsmode                ## Set mechanisms to known position
tcblock mbshrs                  ## Reset shutter

wait time 10

display "Switching off mechanisms."

tcblock mbpwc2of                ## Power off CAL2 mechanism
tcblock mbpwc1of                ## Power off CAL1 mechanism
tcblock mbpwpaof                ## Power off PAW mechanism
tcblock mbpwm2of                ## Power off MTM2 mechanism
tcblock mbpwm1of                ## Power off MTM1 mechanism
tcblock mbpwshof                ## Power off shutter

wait time 60

if getdig(mkpwc2) <> "         OFF" then
  display "CAL2 mechanism is NOT off"
  halt
end if

if getdig(mkpwc1) <> "         OFF" then
  display "CAL1 mechanism is NOT off"
  halt
end if

if getdig(mkpwpa) <> "         OFF" then
  display "PAW mechanism is NOT off"
  halt
end if

if getdig(mkpwm2) <> "         OFF" then
  display "MTM2 mechanism is NOT off"
  halt
end if

if getdig(mkpwm1) <> "         OFF" then
  display "MTM1 mechanism is NOT off"
  halt
end if

if getdig(mkpwsh) <> "         OFF" then
  display "Shutter mechanism is NOT off"
  halt
end if

display "Switching off CCD camera."

tcblock mbpwcmof                ## Power off camera

wait time 60

if getdig(mkpwcm) <> "         OFF" then
  display "CCD camera is NOT off - procedure halted"
  halt
end if

return
