sensirion: set scale to 2.3 when 1, improve save
This commit is contained in:
@ -32,9 +32,8 @@ proc stdConfig::sensirion {} {
|
||||
prop writecmd "str7 n%-6d int 10 / str9"
|
||||
|
||||
node offset wr
|
||||
prop check sensirion::checkCalib
|
||||
prop read stdSct::read
|
||||
prop complete sensirion::update
|
||||
prop complete sensirion::update_and_check
|
||||
prop update sensirion::update
|
||||
prop write stdSct::write
|
||||
prop readcmd "str1 o int 10 / str9"
|
||||
@ -42,15 +41,15 @@ proc stdConfig::sensirion {} {
|
||||
|
||||
node scale wr
|
||||
prop read stdSct::read
|
||||
prop complete sensirion::update
|
||||
prop update sensirion::update
|
||||
prop check sensirion::checkCalib
|
||||
prop complete sensirion::update_and_check
|
||||
prop update sensirion::updateScale
|
||||
prop write stdSct::write
|
||||
prop readcmd "str1 g int 10 / str9"
|
||||
prop writecmd "str7 g%-6.4f int 10 / str9"
|
||||
|
||||
node save out
|
||||
node save wr
|
||||
prop enum 1
|
||||
prop read sensirion::readSave
|
||||
prop write sensirion::saveCalib
|
||||
prop help "unchecked: current calib is not saved. set checked: save calib"
|
||||
|
||||
@ -75,14 +74,6 @@ proc sensirion::currentCalib {} {
|
||||
return [format {%.4f %.4f} [hval [sct objectPath]/offset] [hval [sct objectPath]/scale]]
|
||||
}
|
||||
|
||||
proc sensirion::checkCalib {} {
|
||||
if {[silent "" currentCalib] ne "[silent 0 sct saved]"} {
|
||||
hupdate [sct parent]/save 0
|
||||
} else {
|
||||
hupdate [sct parent]/save 0
|
||||
}
|
||||
}
|
||||
|
||||
proc sensirion::saveCalib {} {
|
||||
if {[sct target]} {
|
||||
sct send "str1 s int 10 / str1"
|
||||
@ -99,3 +90,31 @@ proc sensirion::update {} {
|
||||
sct update [sct result]
|
||||
return idle
|
||||
}
|
||||
|
||||
proc sensirion::update_and_check {} {
|
||||
sct update [sct result]
|
||||
[sct controller] queue [sct parent]/save progress read
|
||||
return idle
|
||||
}
|
||||
|
||||
proc sensirion::readSave {} {
|
||||
set current [silent "" currentCalib]
|
||||
set saved [silent "" sct saved]
|
||||
if {$current eq $saved} {
|
||||
sct update 1
|
||||
} else {
|
||||
sct update 0
|
||||
}
|
||||
return idle
|
||||
}
|
||||
|
||||
proc sensirion::updateScale {} {
|
||||
if {[sct result] == 1 && [silent 0 sct target] != 1} {
|
||||
# probably an uncalibrated sensor was replaced and not initialized
|
||||
sct target 2.3
|
||||
clientput "change nvflow scale from 1 to 2.3"
|
||||
return write
|
||||
}
|
||||
sct update [sct result]
|
||||
return idle
|
||||
}
|
||||
|
Reference in New Issue
Block a user