namespace eval el755 {} {
}

proc stdConfig::el755 {} {
  controller std
  prop startcmd "RMT 1"

  pollperiod 1 1

  obj EL755 -drive wr
  prop status idle
  prop start 0
  prop checklimits el755::checklimits
  prop read el755::read
  prop write el755::write

  kids EL755 {
    node upperlimit par 18
    node lowerlimit par -18
  }
}

proc el755::read {} {
  sct send "I 5"
  return el755::update
}

proc el755::write {} {
  sct send "I 5 [sct target]"
  return stdSct::complete
}

proc el755::update {} {
  sct update [sct result]
  return idle
}

proc el755::checklimits {} {
  if {[sct target] > [hval [sct]/upperlimit] ||
      [sct target] < [hval [sct]/lowerlimit]} {
    error "outside limits"
  }
  [sct controller] poll [sct] 2 read el755::wait [expr [DoubleTime] + 2]
  sct status run
}

  
proc el755::wait {} {
  sct status idle
  return unpoll
}
