deviceDesc = trinamic motor setup valve

makeCCU4 ori1 nv

GraphAdd hepump.hemot.encoder deg valvepos
GraphAdd hemot.target deg valvepos_set

#hsetprop /hepump/hemot/encoder INIT 1
_hemot updatescript /hepump/hemot/encoder updenc

proc updenc {encoder} {
  set sync_time [silent 1 hgetpropval /sics/_hemot/tasks sync_time]
  if {abs([silent -999 sct oldvalue] - $encoder) > 0.5 ||
      $sync_time != [silent 0 sct sync_time]} {
    sct showcnt 3
    sct oldvalue $encoder
    sct sync_time $sync_time
  }
  if {[silent 0 sct showcnt] > 0} {
    clientput "pump number [result hemot pump_number], position $encoder"
    sct showcnt [expr [sct showcnt] - 1]
  }
}

proc pn {number} {
  hemot maxcurrent 255
  hemot maxspeed 100
  hemot acceleration 50
  hemot freewheeling 1
  hemot lowerlimit -1.4
  hemot upperlimit 80
  hemot precision 1.8
  hemot maxencdif 3.6
  hemot id 1161
  hemot standbycurrent 8
  set encoder [result hemot encoder]
  hemot zero [expr [result hemot zero] - $encoder]
  hemot pump_number $number
  hemot eeprom 2
}

publishLazy pn
