namespace eval lowdpflow {} {
}

proc stdConfig::lowdpflow {} {
  controller std "\r\n"

# driver for mass flow meter bronkhorst low-dp-flow
# serial interface is set to:
# Char Size/Stop Bits:         8/1    Input Speed:                38400
# Flow Ctrl:                  None    Output Speed:               38400
# Parity:                     None    Modem Control:               None


  obj low-dp-flow rd

# 0C=length
# 80=address
# 04=read
# 00 not chained, custom process 0
# 40 not chained, float, custom parameter 0
# 21 process 33
# 40 float, parameter 0
  prop readcmd ":06800400402140"
  prop readfmt ":0880020040%8s"
  prop update lowdpflow::update

}

proc lowdpflow::update {} {
  if {[scan [sct result] [sct readfmt] flow] != 1} {
    error "bad result format: '[sct result]' $flow"
  }
  set flow [cnvrt xieee2float $flow]
  sct update $flow
  return idle
}
