# File: fl_htr_config.src
#
# This procedure configures the Optics Package Heaters
#

program "@(#) MODULE: fl_htr_config.src RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/dev/src/fl_htr_config.src
descr "fl_htr_config.src - Configure Optics Package Heater"

#
# !LI0: loop count variable
# !LI1: heater setpoint variable
# !LS0: answer string
#----------------

## Main Loop:

for !LI0 = 0 to 1000
  menu !LS0 "Menu:" "Heater Pwr ON" "Heater Pwr OFF" "Heater Setpoint" "Exit"

  if !LS0 = "Heater Pwr ON" then
    tcblock mbpwhopn
    wait time 60
    if getdig(mkpwhop) <> "          ON" then
      beep
      display "OP heater power is NOT ON"
      halt
    end if
  end if

  if !LS0 = "Heater Pwr OFF" then 
    tcblock mbpwhopf
    wait time 60
    if getdig(mkpwhop) <> "         OFF" then
      beep
      display "OP heater power is NOT OFF"
      halt
    end if
  end if

  if !LS0 = "Heater Setpoint" then
    ask !LI1 "Enter OP heater setpoint (0 to 255)"
    display "Heater setpoint =  %d" !LI1
    tcblock mbhopspt !LI1
    wait time 60
    if getint(mkhopspt) <> !LI1 then
      beep
      display "OP heater setpoint is NOT correct"
      halt
    end if
  end if

  exit if !LS0 = "Exit"
end for

display "Finished procedure fl_htr_config      "
return
