diff --git a/tcl/drivers/trun.tcl b/tcl/drivers/trun.tcl index 7390b86..6597218 100644 --- a/tcl/drivers/trun.tcl +++ b/tcl/drivers/trun.tcl @@ -447,7 +447,16 @@ proc trun::read_run {} { } if {$dblctrl} { if {[hval [sct]/dblctrl/mode] == 0} { # inactive -> stable - hupdate [sct]/dblctrl/mode 1 + set tol [hvali [sct]/tolerance] + set tg [silent $tsample sct target] + if {$tg > $tsample + $tol} { + set dmode 2 ;# up + } elseif {$tg < $tsample - $tol} { + set dmode 3 ;# down + } else { + set dmode 1 ;# stable + } + hupdate [sct]/dblctrl/mode $dmode } set value $tsample } else {