From 4bd4bd8fd2dd756dbf3fc7f4de137000fd6b98db Mon Sep 17 00:00:00 2001 From: l_samenv Date: Fri, 31 Mar 2023 14:31:10 +0200 Subject: [PATCH] ls370: add 'abs' as possible raw curve for bad wired sensors --- tcl/drivers/lsc.tcl | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tcl/drivers/lsc.tcl b/tcl/drivers/lsc.tcl index d909d94..f28bef5 100644 --- a/tcl/drivers/lsc.tcl +++ b/tcl/drivers/lsc.tcl @@ -624,7 +624,7 @@ proc lsc::read_curve {} { return } switch [sct target] { - raw - code - vacuum - undefined { + raw - abs - code - vacuum - undefined { sct Serial_Number [sct target] return } @@ -852,7 +852,7 @@ proc lsc::set_curve {} { if {[string match "manual*" $sno]} { return lsc::detect_sensor } - if {$sno eq "raw"} { + if {[regexp (raw|abs) $sno]} { sct update $sno return stdSct::complete } @@ -1613,7 +1613,6 @@ proc lsc::invalidate_after_commerror {objectPath} { proc lsc::get370T1 {} { stdSct::scanf "%d,%d" chan auto - set now [DoubleTime] set actchan [silent -1 sct actchan] sct actchan $chan @@ -1631,7 +1630,7 @@ proc lsc::get370T1 {} { if {$chan ne $actchan} { set apath [silent 0 sct channel_$actchan] if {$apath ne "0"} { - if {[hvali $cpath/active]} { + if {$cpath ne "0" && [hvali $cpath/active]} { set updatechan $actchan } } @@ -1772,10 +1771,11 @@ proc lsc::update370stat {chan} { set statxt "" } if {[string index $statxt 0] == "t"} { - if {[hvali $sensor/curve] eq "raw"} { + if {[regexp (raw|abs) [hvali $sensor/curve]]} { silent 0 updateval $sensor/status 0 } else { silent 0 updateval $sensor/status "$stat $statxt" + hsetprop $sensor geterror "$stat $statxt" } sct send "RDGR?$chan" return "lsc::update370R $chan" @@ -1793,7 +1793,7 @@ proc lsc::update370stat {chan} { return stdSct::complete } silent 0 updateval $sensor/status $stat - if {[sctval $sensor/curve] eq "raw"} { + if {[regexp (raw|abs) [sctval $sensor/curve]]} { sct send "RDGR?$chan" return "lsc::update370R $chan" } @@ -1813,6 +1813,8 @@ proc lsc::update370R {chan} { updateval $sensor/raw [sct result] if {[sctval $sensor/curve] eq "raw"} { updateval $sensor [sct result] + } elseif {[sctval $sensor/curve] eq "abs"} { + updateval $sensor [expr abs([sct result])] } hsetprop $sensor updatetime [clock seconds] if {$chan != "A" && [sct model] eq "372" && [silent "" sct channel_A] ne ""} { @@ -3550,7 +3552,7 @@ proc lsc::wrrdgrng370 {} { } proc lsc::wrrdgrng372 {} { - stdSct::scanf "%d,%d,%d,%d,%d,%d" mode exc rng auto csoff oldunit + stdSct::scanf "%d,%d,%d,%d,%d,%d" mode exc auto rng csoff oldunit if {[sctval [sct]/curve] eq "raw"} { set unit 2 } else { @@ -3605,7 +3607,7 @@ proc lsc::setrdgrng37x {mode exc rng auto csoff {unit 0} {doit 0}} { if {[sct model] eq "370"} { sct send "RDGRNG [sct @channel],$mode,$exc,$rng,$auto,$csoff;*OPC?" } else { - sct send "INTYPE [sct @channel],$mode,$exc,$rng,$auto,$csoff,$unit;*OPC?" + sct send "INTYPE [sct @channel],$mode,$exc,$auto,$rng,$csoff,$unit;*OPC?" } return stdSct::complete }