Use dmc2280_util.tcl
r1094 | ffr | 2006-08-31 16:29:04 +1000 (Thu, 31 Aug 2006) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
ccd6337687
commit
3f02061d09
@@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env tclsh
|
||||
|
||||
# $Revision: 1.1 $
|
||||
# $Date: 2006-08-25 02:39:50 $
|
||||
# $Revision: 1.2 $
|
||||
# $Date: 2006-08-31 06:29:04 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
# Load troubleshooting setup
|
||||
source dmc2280_util.tcl
|
||||
source troubleshoot_setup.tcl
|
||||
|
||||
namespace eval sics_config {
|
||||
@@ -29,45 +30,6 @@ proc loadConfig {fName} {
|
||||
foreach c $ContList {upvar #0 $c cont; puts "$c IP:port = $cont(host):$cont(port)"}
|
||||
}
|
||||
|
||||
|
||||
# Open a communications channel to a dmc2280 motor controller
|
||||
# contName: controller name, eg dmc2280_controller1
|
||||
# The host and port in the SICS configuration file will be used by default
|
||||
proc connect {contName {host ""} {port ""}} {
|
||||
global channel
|
||||
upvar #0 $contName controller
|
||||
|
||||
if {$host == ""} {set host $controller(host)}
|
||||
if {$port == ""} {set port $controller(port)}
|
||||
|
||||
if [catch {socket $host $port} con] {
|
||||
error "Failed to connect to $contName IP($host) port($port)\n\
|
||||
$con\n
|
||||
Is the motor controller switched on? Are the network cables plugged in?"
|
||||
}
|
||||
set channel($contName) $con
|
||||
fconfigure $channel($contName) -buffering line -translation crlf -blocking true
|
||||
}
|
||||
|
||||
# Send a dmc2280 command
|
||||
proc sendCmd {chan cmd} {
|
||||
puts $chan $cmd
|
||||
set status [read $chan 1]
|
||||
if {$status == "?"} {
|
||||
error "error: dmc command $cmd failed"
|
||||
} else {
|
||||
return $status
|
||||
}
|
||||
}
|
||||
|
||||
# Receive a dmc2280 command
|
||||
proc receive {chan} {
|
||||
gets $chan line
|
||||
# Consume the following colon
|
||||
read $chan 1
|
||||
return $line
|
||||
}
|
||||
|
||||
proc subExists {cont sub} {
|
||||
global channel
|
||||
if [catch {sendCmd $channel($cont) "LS $sub,0"} errMsg] {
|
||||
|
||||
Reference in New Issue
Block a user