#--------------------------------------------------------------------------
# helium: a script for reading the helium level from an AMI-135 Helium Level
# Monitor. 
#
# Mark Koennecke, December 1999
#-------------------------------------------------------------------------

#--------- some code to do proper initialization if necessary
set ret [catch {helium} msg]
if {$ret != 0} {
   Publish heliumport Spy
   Publish helium     Spy
   Publish heliuminit Mugger
}

#--------------- initialize things
proc heliuminit {mac chan} {
   serialport heliumport $mac 4000 $chan
   heliumport -tmo 2000
   return OK
}
#--------------- real work
proc helium {} {
   set ret [catch {heliumport cm} msg]
   if {$ret != 0} {
     error $msg
   }
   set ret [catch {heliumport level} msg]
   if {$ret != 0} {
     error $msg
   } else {
     return [format "helium = %6.2f cm" $msg]
   }
}
