#  File: lltcom.src
#
#  This procedure file performs the short form test of the limb tracker.
#  This proceedure assumes the limb tracker was turned on using llton
#  and that the instrument is in the normal observation mode (lobsmode).
#  It also assumes that the grid image has been centered (lltcntr)
#  so that lltsetup can be used to close the loop and that the alignment
#  mechanism is on (lamon)
#
#  V02 - 14 Oct 1998 Dnyanesh Mathur 
#        Leave PZT A offset at 95 while offsets for B and C are changed
#        as per Ted Tarbell's message dated, 13 Oct 1998 21:48:20.
#

program "@(#) MODULE: lltcom.src RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/dev/src/lltcom.src"
descr "  lltcom - Commission limb tracker"

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

writen !GS9 " "
write  !GS9 "Initial Tracker Conditions: "
writen !GS9 "Open loop, fine offset, prime photodiodes"

# move error signals to zero by using offsets

#display "Zeroing error signals using X & Y offsets " to 30
#perform lltsetup
#menu !LS0 "Are error signals between 2.1 and 2.5?" "YES" "NO"
#if !LS0 <> "YES" then
#  display "Zero error signals using X & Y offsets    " to 30
#  halt
#end if

# write error offsets
write  !GS9 "Error signals zeroed: "
write  !GS9 "X offset: %3d " getint(mkltxofs)
write  !GS9 "(%2.0xx)  ; "   getint(mkltxofs)
write  !GS9 "Y offset: %3d " getint(mkltyofs)
writen !GS9 "(%2.0xx)    "   getint(mkltyofs)
writen !GS9 " "

start:

perform lltprn1_v01

ask !GI0 "Enter exposure (in ticks)"

tcblock mbcmsumm 1 1
tcb mbiplbic 3 3
wait time 5
tcb mbcmhdr1 0x4040 0x4040 0 1 0
wait time 5
 
tcblock mbcmtp1r 0xc018 !GI0 !GI0 
wait time 110

display "X & Y offsets to 0, PZT A offset to 95  " to 30
writen !GS9 "X & Y offsets to 0, PZT A offset to 95"
tcblock mbltaofs 95
wait time 15
perform lltprn1_v01

tcblock mbcmtp1r 0xc018 !GI0 !GI0 
wait time 110

display "PZT B offset to 95" to 30
writen !GS9 "PZT B offset to 95"
tcblock mbltbofs 95 
wait time 15
perform lltprn1_v01
tcblock mbcmtp1r 0xc018 !GI0 !GI0 
wait time 110

display "PZT B offset to 63 PZT C offset to 95"  to 30
writen !GS9 "PZT B offset to 63 PZT C offset to 95" 
tcblock mbltbofs 63 
tcblock mbltcofs 95 
wait time 15
perform lltprn1_v01
tcblock mbcmtp1r 0xc018 !GI0 !GI0 
wait time 110

display "PZT A and C offset to 63" to 30
writen !GS9 "PZT A and C offset to 63" 
tcblock mbltaofs 63
tcblock mbltcofs 63 
wait time 15
perform lltprn1_v01

display "Finished Procedure lltcom"
writen !GS9 "Finished procedure lltcom : %s" !TIME
writen !GS9 " "
