Don't allow change of direction if the fermimotor speed != 0.
Added an "idle" subcommand so the speed can be set to zero without delevitating. Also added alarm reset command.
This commit is contained in:
@@ -307,9 +307,19 @@ namespace eval ::chopper {
|
|||||||
variable ch2_gains
|
variable ch2_gains
|
||||||
variable ch3_gains
|
variable ch3_gains
|
||||||
|
|
||||||
|
set currspeed [hval $hpath/$node/rotation_speed]
|
||||||
|
set currdir [hval $hpath/$node/motdir]
|
||||||
if {$target >= 0} {
|
if {$target >= 0} {
|
||||||
|
if {$currdir != $CW && $currspeed != 0} {
|
||||||
|
clientput "ERROR: Tried to change direction when speed != 0. Set motor to idle first."
|
||||||
|
return -code error
|
||||||
|
}
|
||||||
set dir $CW
|
set dir $CW
|
||||||
} else {
|
} else {
|
||||||
|
if {$currdir != $CCW && $currspeed != 0} {
|
||||||
|
clientput "ERROR: Tried to change direction when speed != 0. Set motor to idle first."
|
||||||
|
return -code error
|
||||||
|
}
|
||||||
set dir $CCW
|
set dir $CCW
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +351,7 @@ namespace eval ::chopper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc get_setRefDelay {hpath node addr name {target_ ""}} {
|
proc get_setRefDelay {hpath node addr name {target ""}} {
|
||||||
global SCode
|
global SCode
|
||||||
if {$target == ""} {
|
if {$target == ""} {
|
||||||
set delay [hval $hpath/$node/ref_delay]
|
set delay [hval $hpath/$node/ref_delay]
|
||||||
@@ -379,12 +389,15 @@ namespace eval ::chopper {
|
|||||||
|
|
||||||
proc imot_SRun {hpath node addr name target} {
|
proc imot_SRun {hpath node addr name target} {
|
||||||
global SCode
|
global SCode
|
||||||
|
set catch_status [ catch {
|
||||||
setSpeed $hpath $node $addr $name $target
|
setSpeed $hpath $node $addr $name $target
|
||||||
hset $hpath/$node/control/start 1
|
hset $hpath/$node/control/start 1
|
||||||
hsetprop $hpath/$node/control timecheck -1
|
hsetprop $hpath/$node/control timecheck -1
|
||||||
set readtime [hgetpropval $hpath read_time]
|
set readtime [hgetpropval $hpath read_time]
|
||||||
hsetprop $hpath lastupdate $readtime
|
hsetprop $hpath lastupdate $readtime
|
||||||
return $SCode(OKOK)
|
return $SCode(OKOK)
|
||||||
|
} message ]
|
||||||
|
handle_exception $catch_status $message
|
||||||
}
|
}
|
||||||
|
|
||||||
proc imot_SStatus {hpath node addr name} {
|
proc imot_SStatus {hpath node addr name} {
|
||||||
@@ -409,7 +422,7 @@ namespace eval ::chopper {
|
|||||||
set locked $up_to_speed
|
set locked $up_to_speed
|
||||||
} else {
|
} else {
|
||||||
# PHASE mode
|
# PHASE mode
|
||||||
set locked [expr $up_to_speed && $phase_locked]
|
set locked $phase_locked
|
||||||
}
|
}
|
||||||
if {$locked} {
|
if {$locked} {
|
||||||
if {$timecheck == -1} {
|
if {$timecheck == -1} {
|
||||||
@@ -546,6 +559,12 @@ namespace eval ::chopper {
|
|||||||
return $SCode(OKOK)
|
return $SCode(OKOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc reset {hpath node addr name} {
|
||||||
|
global SCode
|
||||||
|
hset $hpath/$node/control/reset 1
|
||||||
|
return $SCode(OKOK)
|
||||||
|
}
|
||||||
|
|
||||||
proc idle {hpath node addr name} {
|
proc idle {hpath node addr name} {
|
||||||
global SCode
|
global SCode
|
||||||
hset $hpath/$node/control/idle_toggle 1
|
hset $hpath/$node/control/idle_toggle 1
|
||||||
|
|||||||
Reference in New Issue
Block a user