##########################                                            ##-#
#                                                                     ##-#
# Assembled by checkpoint, 1.18.2 (23-Sep-99).                        ##-#
# (EDIT THE ORIGINAL SOURCE, NOT THIS FILE!)                          ##-#
# Date-assembled: Fri Dec  3 12:35:39 EST 1999                        ##-#
# Orig-source: /mdisw/cfl/flight/src/closeloop_v01.src                ##-#
#                                                                     ##-#
##########################                                            ##-#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/flight/src/q_closeloop_v01.src"
descr "q_closeloop - open ISS loop"
# program closeloop.src, created 96.1.24 Igor Zayer 
#
# Closes the ISS loop
                                                                      ##-#
#=#=#=#=#=#=#=#=#=#=# src ln 8.  (Open Log file)                      ##-#
if !GS9 = "" then                                                     ##-#
  display "Opening logfile from q_closeloop_v01"                      ##-#
  perf openlog                                                        ##-#
end if                                                                ##-#
write !GS9 "%s q_closeloop_v01:" !TIME                                ##-#
writen !GS9 "Starting..."                                             ##-#
beep
display "Check ISS error signals on HK page !!"

menu !LS0 "OK to close loop?" "YES, lock ISS" "CANCEL"
if !LS0 = "YES, lock ISS" then
#=#=#=#=#=#=#=#=#=#=#+ src ln 14.  Block 0  Next line is #29          ##-#
 display "Running block 0 of q_closeloop_v01."                        ##-#
set !LI0 = getint(mktccnt)                                            ##-#
  display "Closing ISS loop"
  tcblock mbltclsl
#=#=#=#=#=#=#=#=#=#=#- src ln 15.  Block 0   Cmds:1   Total:1         ##-#
wait time 8 ## Wait for hk packet                                     ##-#
set !LI2 = !LI0 + 1                                                   ##-#
if !LI2 > 255 then                                                    ##-#
 set !LI1 = !LI2 - 256                                                ##-#
else                                                                  ##-#
 set !LI1 = !LI2                                                      ##-#
end if                                                                ##-#
set !LI2 = getint(mktccnt)                                            ##-#
if !LI1 <> !LI2 then                                                  ##-#
 write !GS9 "%s q_closeloop_v01:" !TIME                               ##-#
 writen !GS9  "CMD CT ERR in block 0. cmd ctr: %d" !LI2               ##-#
 writen !GS9  "      (Sent 1 cmds; expected cmd ctr: %d)" !LI1        ##-#
 writen !GS9  "      Halted.  (restart at line 29)"                   ##-#
 display "ERR: q_closeloop_v01 blk 0: cmd ctr isnt %d. (CONT 29)" !LI1##-#
 halt                                                                 ##-#
 write !GS9 "%s q_closeloop_v01:" !TIME                               ##-#
 writen !GS9  "Override.  Continuing past block 0..."                 ##-#
else                                                                  ##-#
 write !GS9 "%s q_closeloop_v01:" !TIME                               ##-#
 writen !GS9  "Block 0 completed OK."                                 ##-#
display "Completed block 0 of q_closeloop_v01."                       ##-#
end if                                                                ##-#
#################### END of BLOCK 0 ####################              ##-#
end if
 
write !GS9 "%s q_closeloop_v01:" !TIME                                ##-#
writen !GS9 "returning from procedure 'q_closeloop_v01'"              ##-#
return
write !GS9 "%s q_closeloop_v01:" !TIME                                ##-#
writen !GS9 "Falling off the bottom."                                 ##-#
