ls370: add 'abs' as possible raw curve for bad wired sensors

This commit is contained in:
l_samenv
2023-03-31 14:31:10 +02:00
parent dafdf41caa
commit 4bd4bd8fd2

View File

@ -624,7 +624,7 @@ proc lsc::read_curve {} {
return return
} }
switch [sct target] { switch [sct target] {
raw - code - vacuum - undefined { raw - abs - code - vacuum - undefined {
sct Serial_Number [sct target] sct Serial_Number [sct target]
return return
} }
@ -852,7 +852,7 @@ proc lsc::set_curve {} {
if {[string match "manual*" $sno]} { if {[string match "manual*" $sno]} {
return lsc::detect_sensor return lsc::detect_sensor
} }
if {$sno eq "raw"} { if {[regexp (raw|abs) $sno]} {
sct update $sno sct update $sno
return stdSct::complete return stdSct::complete
} }
@ -1613,7 +1613,6 @@ proc lsc::invalidate_after_commerror {objectPath} {
proc lsc::get370T1 {} { proc lsc::get370T1 {} {
stdSct::scanf "%d,%d" chan auto stdSct::scanf "%d,%d" chan auto
set now [DoubleTime] set now [DoubleTime]
set actchan [silent -1 sct actchan] set actchan [silent -1 sct actchan]
sct actchan $chan sct actchan $chan
@ -1631,7 +1630,7 @@ proc lsc::get370T1 {} {
if {$chan ne $actchan} { if {$chan ne $actchan} {
set apath [silent 0 sct channel_$actchan] set apath [silent 0 sct channel_$actchan]
if {$apath ne "0"} { if {$apath ne "0"} {
if {[hvali $cpath/active]} { if {$cpath ne "0" && [hvali $cpath/active]} {
set updatechan $actchan set updatechan $actchan
} }
} }
@ -1772,10 +1771,11 @@ proc lsc::update370stat {chan} {
set statxt "" set statxt ""
} }
if {[string index $statxt 0] == "t"} { 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 silent 0 updateval $sensor/status 0
} else { } else {
silent 0 updateval $sensor/status "$stat $statxt" silent 0 updateval $sensor/status "$stat $statxt"
hsetprop $sensor geterror "$stat $statxt"
} }
sct send "RDGR?$chan" sct send "RDGR?$chan"
return "lsc::update370R $chan" return "lsc::update370R $chan"
@ -1793,7 +1793,7 @@ proc lsc::update370stat {chan} {
return stdSct::complete return stdSct::complete
} }
silent 0 updateval $sensor/status $stat silent 0 updateval $sensor/status $stat
if {[sctval $sensor/curve] eq "raw"} { if {[regexp (raw|abs) [sctval $sensor/curve]]} {
sct send "RDGR?$chan" sct send "RDGR?$chan"
return "lsc::update370R $chan" return "lsc::update370R $chan"
} }
@ -1813,6 +1813,8 @@ proc lsc::update370R {chan} {
updateval $sensor/raw [sct result] updateval $sensor/raw [sct result]
if {[sctval $sensor/curve] eq "raw"} { if {[sctval $sensor/curve] eq "raw"} {
updateval $sensor [sct result] updateval $sensor [sct result]
} elseif {[sctval $sensor/curve] eq "abs"} {
updateval $sensor [expr abs([sct result])]
} }
hsetprop $sensor updatetime [clock seconds] hsetprop $sensor updatetime [clock seconds]
if {$chan != "A" && [sct model] eq "372" && [silent "" sct channel_A] ne ""} { if {$chan != "A" && [sct model] eq "372" && [silent "" sct channel_A] ne ""} {
@ -3550,7 +3552,7 @@ proc lsc::wrrdgrng370 {} {
} }
proc lsc::wrrdgrng372 {} { 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"} { if {[sctval [sct]/curve] eq "raw"} {
set unit 2 set unit 2
} else { } else {
@ -3605,7 +3607,7 @@ proc lsc::setrdgrng37x {mode exc rng auto csoff {unit 0} {doit 0}} {
if {[sct model] eq "370"} { if {[sct model] eq "370"} {
sct send "RDGRNG [sct @channel],$mode,$exc,$rng,$auto,$csoff;*OPC?" sct send "RDGRNG [sct @channel],$mode,$exc,$rng,$auto,$csoff;*OPC?"
} else { } 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 return stdSct::complete
} }