# File mdifocus.src	14-12-93	SDW
#
# Performs a focus series at all 4 PAW positions as part of LFFT
#
#     !GI0 = exposure time in shutter ticks (0.25 msec/tick)
#     !GI7 = Sequence ID
#     !GI9 = wait time after exposure command in seconds
#

program "@(#) MODULE: mdifocus.src RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/eof/src/mdifocus.src"
descr "mdifocus - Performs focus series at all 4 PAW positions"

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

tcblock mbcmsumm 1 1

set !GI5 = 4
perform liplbic

write !GS9 "  Taking central 256x256"
writen !GS9 " in FD & HR OBS mode"

tcblock mbcmaadc 3
writen !GS9 "  CCD amplifier A, offset: 3"

set !GI7 = 0xc012

set !GI0 = 16000
ask !RI "Enter exposure time ('0' for default of 16000 ticks)"
if !RI > 0 then
  set !GI0 = !RI
end if
write !GS9 "  Exposure time:"
write !GS9 " %d" !GI0
set !GI9 = !GI0 / 4000.
set !GI9 = !GI9 + 4
if !GI9 < 8 then
  set !GI9 = 8
end if
write !GS9 " ticks with %d" !GI9
writen !GS9 " second waits"

open decom160 !LS1
writen !GS9 "  160k data stored in: %s" !LS1

display "Focus series in FULL DISK mode, all PAW pos."
writen !GS9 "    Focus series in FULL DISK mode;"
writen !GS9 "    PAW positions 125, 90, 18, 54"
perform sptfdfoc
display "Focus series in HI-REZ mode, all PAW pos."
writen !GS9 "    Focus series in HI-REZ mode;"
writen !GS9 "    PAW positions 125, 90, 18, 54"
perform spthrfoc

tcblock mbcmdrkr !GI7 !GI0 !GI0
wait time !GI9
writen !GS9 "    Soft DARK"

wait time 7
close decom160

writen !GS9 "Finished procedure mdifocus : %s" !TIME
writen !GS9 "  "
display "End procedure mdifocus"
