Make sure spin flipper code in rfamp.c is initialised

Fixed drive bugs in lakeshore drivers.
r3071 | ffr | 2011-02-25 18:27:31 +1100 (Fri, 25 Feb 2011) | 2 lines
This commit is contained in:
Ferdi Franceschini
2011-02-25 18:27:31 +11:00
committed by Douglas Clowes
parent 009fdbfc29
commit 7371a561d9
30 changed files with 10384 additions and 75 deletions

View File

@@ -15,7 +15,6 @@ config/nexus/nxscripts_common_1.tcl
config/commands/commands_common.tcl
config/motors/sct_positmotor_common.tcl
config/environment/sct_protek_common.tcl
config/environment/sct_mcr500_rheometer.tcl
config/environment/temperature/sct_julabo_lh45.tcl
config/environment/temperature/sct_lakeshore_340.tcl
config/environment/temperature/sct_lakeshore_336.tcl

View File

@@ -0,0 +1,81 @@
## RHEOMETER CONTROL
proc rhCallBack {rootPath} {
# if rhSpeed >= trigger then start histmem and pop trigger and time
if {[hval $rootPath/runexp] != 1} {
return idle
}
set trigList [hval $rootPath/triggerList]
if {$trigList == "EMPTY"} {
hset $rootPath/acqTime "EMPTY"
hset $rootPath/runexp 0
return idle
}
set acqTime [hval /sics/rhSpeed/acqTime]
if {$acqTime == "EMPTY"} {
broadcast "You must set acquisition time"
return idle
}
set rhSpeed [hval $rootPath]
set trigLevel [lindex $trigList 0]
if {$rhSpeed >= $trigLevel } {
set listLen [llength $trigList]
if {$listLen > 1} {
# If the rhSpeed has jumped over a number of trigger values then skip over those elements in the list
for {set tlIndex 1} {$tlIndex < $listLen} {incr tlIndex} {
set trigLevel [lindex $trigList $tlIndex]
if {$rhSpeed < $trigLevel } {
break
}
}
}
histmem pause
broadcast [info level 0] [hval $rootPath] trigger a [lindex $acqTime 0] second acquisition, sicstime [sicstime]
histmem mode time
histmem preset [lindex $acqTime 0]
histmem start
if {$listLen > 1} {
# Pop trigger
hset $rootPath/triggerList [lrange $trigList $tlIndex end]
} else {
hset $rootPath/triggerList "EMPTY"
hset $rootPath/acqTime "EMPTY"
hset $rootPath/runexp 0
}
if { $acqTime != "EMPTY" && [llength $acqTime] > 1} {
hset $rootPath/acqTime [lrange $acqTime 1 end]
}
}
return idle
}
##
# @brief Pop trigger and acquisition time
proc rheometer_savehmmdata {rootPath} {
set si [hval $rootPath/saveIndex]
broadcast [info level 0]: save data index = $si, sicstime [sicstime]
save $si
if {[hval $rootPath/runexp] == 0} {
hset $rootPath/saveIndex 0
newfile clear
} else {
incr si
hset $rootPath/saveIndex $si
}
}
publish rheometer_savehmmdata user
proc add_rheo {IP} {
MakeProtek rhTorque $IP 4002
MakeProtek rhSpeed $IP 4001 1.0 0.0 0.5 "rhCallBack /sics/rhSpeed"
hfactory /sics/rhSpeed/saveIndex plain user int
hset /sics/rhSpeed/saveIndex 0
hfactory /sics/rhSpeed/triggerList plain user text
hset /sics/rhSpeed/triggerList "EMPTY"
hfactory /sics/rhSpeed/acqTime plain user text
hset /sics/rhSpeed/acqTime "EMPTY"
hfactory /sics/rhSpeed/runexp plain user float
hset /sics/rhSpeed/runexp 0
scriptcallback connect hmm COUNTEND "rheometer_savehmmdata /sics/rhSpeed"
}

View File

@@ -251,11 +251,6 @@ proc rdPwdAck {} {
hset $vs_root/status "busy"
statemon start nvs_speed
statemon start nvs_lambda
if {[sct writestatus] == "start"} {
# Called by drive adapter
hsetprop $vs_root/setspeed driving 1
hsetprop $vs_root/setLambda driving 1
}
return $nextState
}
@@ -305,6 +300,7 @@ proc rdPwdAck {} {
set state [lindex [hval $statuspath] $paramindex(state) end]
set aspeed [lindex [hval $statuspath] $paramindex(aspeed) end]
if {[string match {*CONTROL*} $state] || $aspeed != 0} {
sct driving 0
error "Not allowed while the velocity selector is running"
}
return OK
@@ -314,6 +310,7 @@ proc is_Speed_in_blocked_range {speed} {
variable blocked_speeds
foreach {min max} $blocked_speeds {
if {$min <= $speed && $speed <= $max} {
sct driving 0
error "Speed of $speed rpm is within the blocked range of $min to $max rpm"
}
}
@@ -358,6 +355,7 @@ proc get_nearest_allowed_speed {speed} {
set speed [sct target]
set ttang [lindex [hval $statuspath] $paramindex(ttang) end]
if {$ttang > 90} {
sct driving 0
error "ERROR: You must first initialise the turntable"
}
@@ -372,6 +370,7 @@ proc checkBlockedWavelengths {statuspath} {
set lambda [sct target]
set ttang [lindex [hval $statuspath] $paramindex(ttang) end]
if {$ttang > 90} {
sct driving 0
error "ERROR: You must first initialise the turntable"
}
set angle [lindex [hval $statuspath] $paramindex(ttang) end]
@@ -424,11 +423,6 @@ proc halt {root} {
hset $vs_root/status "busy"
statemon start nvs_speed
statemon start nvs_lambda
if {[sct writestatus] == "start"} {
# Called by drive adapter
hsetprop $vs_root/setLambda driving 1
hsetprop $vs_root/setspeed driving 1
}
return $nextState
}