# File fl_pict.src
#
# Takes pictures in all modes for contamination monitoring 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: fl_pict.src RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/dev/src/fl_pict.src"
descr " fl_pict - Takes pictures in all modes"

display "Executing procedure: fl_pict"
display  "  "
display  " %s" !TIME

tcblock mbcmsumm 1 1
tcblock mbiplbic 0 3
tcblock mbcmhdr1 0x4040 0x4040 0 1 0
display "  Taking full 1024x1024 in FD & HR; OBS & CAL modes"

tcblock mbcmaadc 3
display  "  CCD amplifier A, offset: 3"

set !GI7 = 0xc018

set !GI0 = 16000
ask !RI "Enter exposure time ('0' for default of 16000 ticks)"
if !RI > 0 then
  set !GI0 = !RI
end if
display "  Exposure time: %d" !GI0
set !GI9 = 110

perform fl_obsmode_v02


tcblock mbcmtp1r !GI7 !GI0 !GI0
display  "    OBS FD"
wait time !GI9
tcblock mbcmtp3r !GI7 !GI0 !GI0
display  "    OBS HR"
wait time !GI9

perform fl_calmode_v02

tcblock mbcmtp1r !GI7 !GI0 !GI0
display  "    CAL FD"
wait time !GI9
tcblock mbcmtp3r !GI7 !GI0 !GI0
display  "    CAL HR"
wait time !GI9

tcblock mbcmdrkr !GI7 !GI0 !GI0
wait time !GI9
display  "    Soft DARK"

# tcblock mbcmbadc 3
# display  "  CCD amplifier B, offset: 3"
# tcblock mbcmdrkr !GI7 !GI0 !GI0
# wait time !GI9
# display  "    Soft DARK"

# tcblock mbcmtp3r !GI7 !GI0 !GI0
# display  "    CAL HR"
# set !GI9 = 120
# wait time !GI9

tcblock mbcmaadc 3
display  "  Set CCD amplifier back to A, offset: 3"

wait time 7
close decom160

display  "Finished procedure fl_pict : %s" !TIME
display  "  "
display "End procedure fl_pict"
