Moved to hipadaba directory.
r1242 | ffr | 2006-11-07 12:20:07 +1100 (Tue, 07 Nov 2006) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
a8ba8b89cb
commit
899aaa90d5
@@ -1,9 +0,0 @@
|
||||
server_config.tcl
|
||||
utility.tcl
|
||||
troubleShoot.tcl
|
||||
dmc2280_util.tcl
|
||||
hipadaba_support.tcl
|
||||
motorinfo.tcl
|
||||
ParList.tcl
|
||||
getDMCprog.tcl
|
||||
putDMCprog.tcl
|
||||
@@ -1,41 +0,0 @@
|
||||
set countParList [list \
|
||||
setpreset \
|
||||
getpreset \
|
||||
setexponent \
|
||||
getexponent \
|
||||
setmode \
|
||||
getmode \
|
||||
setexponent \
|
||||
getcounts \
|
||||
getmonitor \
|
||||
count \
|
||||
status \
|
||||
gettime \
|
||||
getthreshold \
|
||||
setthreshold \
|
||||
send \
|
||||
]
|
||||
|
||||
set motParList [list \
|
||||
accesscode \
|
||||
failafter \
|
||||
fixed \
|
||||
hardlowerlim \
|
||||
hardupperlim \
|
||||
ignorefault \
|
||||
interruptmode \
|
||||
maxretry \
|
||||
movecount \
|
||||
precision \
|
||||
sign \
|
||||
softlowerlim \
|
||||
softupperlim \
|
||||
softzero \
|
||||
accel \
|
||||
decel \
|
||||
home \
|
||||
maxaccel \
|
||||
maxdecel \
|
||||
maxspeed \
|
||||
speed \
|
||||
]
|
||||
Binary file not shown.
@@ -1,105 +0,0 @@
|
||||
#!/bin/sh
|
||||
# $Revision: 1.6 $
|
||||
# $Date: 2006-10-31 03:55:24 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
# Deploys SICServer and configuration files to
|
||||
# an instrument control computer.
|
||||
# It requires a MANIFEST.TXT file for each instrument
|
||||
|
||||
usage()
|
||||
{
|
||||
echo deploySICS.sh copies SICS and the files listed
|
||||
echo in the MANIFEST.TXT files to the IC host.
|
||||
echo -e "Usage:\t./deploySICS.sh INSTRUMENT [TARGET_HOST TARGET_DIR]";
|
||||
echo -e "\t./deploySICS.sh test/INSTRUMENT [TARGET_HOST TARGET_DIR]";
|
||||
echo -e "\twhere INSTRUMENT can be hrpd, echidna, hipd, wombat ...";
|
||||
echo -e "\tTARGET_HOST can be a remote host or 'localhost'";
|
||||
echo -e "\twill create last directory in TARGET_DIR if necessary";
|
||||
}
|
||||
|
||||
if [ $# -eq 0 -o $# -eq 2 -o $# -gt 3 ]
|
||||
then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
INSTRUMENT=$1
|
||||
|
||||
SRCDIR=./
|
||||
DESTDIR=${3:-/usr/local/}
|
||||
mkdir -p ~/tmp/$DESTDIR
|
||||
rm -fr ~/tmp/$DESTDIR/*
|
||||
|
||||
# Set the destination host and the
|
||||
# instrument src directory
|
||||
case $INSTRUMENT in
|
||||
hrpd|echidna)
|
||||
DESTHOST=${2:-ics1-echidna.nbi.ansto.gov.au}
|
||||
INSTSRC=hrpd;;
|
||||
hipd|wombat)
|
||||
DESTHOST=${2:-ics1-wombat.nbi.ansto.gov.au}
|
||||
INSTSRC=hipd;;
|
||||
qld|koala)
|
||||
DESTHOST=${2:-ics1-koala.nbi.ansto.gov.au}
|
||||
INSTSRC=qld;;
|
||||
reflectometer|platypus)
|
||||
DESTHOST=${2:-ics1-platypus.nbi.ansto.gov.au}
|
||||
INSTSRC=reflectometer;;
|
||||
rsd|kowari)
|
||||
DESTHOST=${2:-ics1-kowari.nbi.ansto.gov.au}
|
||||
INSTSRC=qld;;
|
||||
sans|quokka)
|
||||
DESTHOST=${2:-ics1-quokka.nbi.ansto.gov.au}
|
||||
INSTSRC=sans;;
|
||||
tas|taipan)
|
||||
DESTHOST=${2:-ics1-taipan.nbi.ansto.gov.au}
|
||||
INSTSRC=tas;;
|
||||
test/*)
|
||||
#copy TEST_SICS/fakeDMC
|
||||
#TESTSRC=TEST_SICS
|
||||
cp -a TEST_SICS/* ~/tmp/$DESTDIR
|
||||
rm -fr $(find ~/tmp/$DESTDIR -name CVS)
|
||||
DESTHOST=$2
|
||||
INSTSRC=$(basename $INSTRUMENT);;
|
||||
esac
|
||||
|
||||
echo $DESTHOST
|
||||
if [ $DESTHOST = "localhost" ]
|
||||
then
|
||||
EXTRACT="tar vxz -C /"
|
||||
else
|
||||
EXTRACT="ssh $DESTHOST tar vxz -C /"
|
||||
fi
|
||||
|
||||
if [ ! -e $SRCDIR/MANIFEST.TXT ]
|
||||
then
|
||||
echo "$SRCDIR/MANIFEST.TXT not found"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e $INSTSRC/MANIFEST.TXT ]
|
||||
then
|
||||
echo "$INSTSRC/MANIFEST.TXT not found"
|
||||
echo "You must list the files required for $INSTRUMENT in the manifest"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get list of files to copy
|
||||
COMMON=$(for f in $(cat $SRCDIR/MANIFEST.TXT); do echo -n "$SRCDIR/$f "; done)
|
||||
INSTSPEC=$(for f in $(cat $INSTSRC/MANIFEST.TXT); do echo -n "$INSTSRC/$f "; done)
|
||||
|
||||
mkdir -p ~/tmp/$DESTDIR/sics/{server,data,log,tmp}
|
||||
cp $COMMON $INSTSPEC ~/tmp/$DESTDIR/sics/server
|
||||
cp ../SICServer ~/tmp/$DESTDIR/sics/server
|
||||
|
||||
# Create a manifest of the files installed on the IC host
|
||||
echo "Date: $(date -Iminutes)" > ~/tmp/$DESTDIR/sics/server/MANIFEST.TXT
|
||||
echo -e "The following files were installed by $USER\n" >> ~/tmp/$DESTDIR/sics/server/MANIFEST.TXT
|
||||
cat $SRCDIR/MANIFEST.TXT $INSTSRC/MANIFEST.TXT >> ~/tmp/$DESTDIR/sics/server/MANIFEST.TXT
|
||||
|
||||
cd ~/tmp/
|
||||
|
||||
# Strip leading / from DESTDIR and extract to destination
|
||||
tar -cz ${DESTDIR:1} | $EXTRACT
|
||||
@@ -1,71 +0,0 @@
|
||||
# $Revision: 1.4 $
|
||||
# $Date: 2006-10-09 03:12:08 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
# globals controller, channel
|
||||
|
||||
# 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 dmc_connect {contName {host ""} {port ""}} {
|
||||
upvar #0 $contName controller;
|
||||
global channel;
|
||||
|
||||
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?\n
|
||||
NOTE: You can only have a maximum of eight connections per motor controller.\n
|
||||
If there are other programs (eg SICS) connected to the controller then all\n
|
||||
of the available connections may have been used up."
|
||||
}
|
||||
set controller(socket) $con
|
||||
set channel($contName) $con
|
||||
set channel($con) $contName
|
||||
set channel($controller(host)) $con
|
||||
fconfigure $con -buffering line -translation crlf -blocking true
|
||||
}
|
||||
|
||||
proc dmc_close {dmc_socket} {
|
||||
close $dmc_socket;
|
||||
}
|
||||
|
||||
# Send a dmc2280 command
|
||||
proc dmc_sendCmd {dmc_socket cmd} {
|
||||
global channel
|
||||
set contName $channel($dmc_socket);
|
||||
upvar #0 $contName controller
|
||||
puts $dmc_socket $cmd
|
||||
set status [read $dmc_socket 1]
|
||||
if {$status == "?"} {
|
||||
puts $dmc_socket "TC 1"
|
||||
set status [read $dmc_socket 1]
|
||||
if {$status == "?"} {
|
||||
error "error: dmc command $cmd failed"
|
||||
} else {
|
||||
set dmcError [dmc_receive $dmc_socket]
|
||||
set errInfo "DM2280 controller $contName
|
||||
host $controller(host)
|
||||
port $controller(port)"
|
||||
error "DMC2280 ERROR $dmcError: when running command $cmd\n$errInfo"
|
||||
}
|
||||
} else {
|
||||
return $status
|
||||
}
|
||||
}
|
||||
|
||||
# Receive a dmc2280 command
|
||||
proc dmc_receive {dmc_socket} {
|
||||
global channel
|
||||
set contName $channel($dmc_socket);
|
||||
upvar #0 $contName controller
|
||||
gets $dmc_socket line
|
||||
# Consume the following colon
|
||||
read $dmc_socket 1
|
||||
return $line
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
#TODO Version stamp this code and write the version number to the generated code
|
||||
# axis = A B C D E F
|
||||
# encodercounts = number of encoder counts per revolution
|
||||
# quadcounts = number of quadrature counts per revolution
|
||||
# tolquadcounts = tolerance in quadrature counts
|
||||
proc genMOVE {axis encodercounts quadcounts tolquadcounts} {
|
||||
puts "NO CLOSE MOTION LOOP FOR ${axis} AXIS
|
||||
NO If the motor is within ${axis}TOLQC quadrature counts of the target
|
||||
NO position then adjust it.
|
||||
${axis}DIFF=${axis}QTARGET - _TP${axis}
|
||||
IF ( ((100*${axis}TOLQC) > @ABS\[${axis}DIFF\]) & (@ABS\[${axis}DIFF\] > ${axis}TOLQC) )
|
||||
${axis}SHLDFIX=1
|
||||
ELSE
|
||||
${axis}SHLDFIX=0
|
||||
ENDIF
|
||||
IF (${axis}FIXPOS=1)
|
||||
${axis}OLDQT=${axis}QTARGET
|
||||
${axis}count=10
|
||||
SH${axis}
|
||||
#${axis}LOOP
|
||||
NO Abort if target position changes
|
||||
IF (${axis}OLDQT <> ${axis}QTARGET)
|
||||
JP#${axis}ENDCLP
|
||||
ENDIF
|
||||
${axis}count=${axis}count-1
|
||||
PR${axis}=${encodercounts}*(${axis}DIFF/${quadcounts})
|
||||
IF (_SP${axis}>${axis}MINSP)
|
||||
SP${axis}=@ABS\[_PR${axis}\]/2.0
|
||||
IF (_SP${axis} < ${axis}MINSP)
|
||||
SP${axis}=${axis}MINSP
|
||||
ENDIF
|
||||
IF (_SP${axis} > ${axis}MAXSP)
|
||||
SP${axis}=${axis}MAXSP
|
||||
ENDIF
|
||||
ENDIF
|
||||
BG${axis}
|
||||
MC${axis}
|
||||
${axis}DIFF=${axis}QTARGET - _TP${axis}
|
||||
IF ( ((100*${axis}TOLQC) > @ABS\[${axis}DIFF\]) & (@ABS\[${axis}DIFF\] > ${axis}TOLQC) )
|
||||
JP#${axis}LOOP,${axis}count>0
|
||||
ENDIF
|
||||
#${axis}ENDCLP
|
||||
NO Restore speed to maximum
|
||||
${axis}FIXPOS=0
|
||||
${axis}SHLDFIX=0
|
||||
SP${axis}=${axis}MAXSP
|
||||
ENDIF"
|
||||
}
|
||||
|
||||
|
||||
# Generate subroutine to start the servo loop thread
|
||||
puts "#CLSLOOP"
|
||||
set tolquadcounts 1
|
||||
set encodercounts 25000
|
||||
set quadcounts 8192
|
||||
puts "NO Initilise tolerance, max and min speeds
|
||||
ATOLQC=100
|
||||
AMAXSP=${encodercounts}
|
||||
AMINSP=100*(${encodercounts}/93207)
|
||||
AFIXPOS=0"
|
||||
foreach {axis} {B C D E F} {
|
||||
puts "${axis}TOLQC=${tolquadcounts}
|
||||
${axis}MAXSP=${encodercounts}
|
||||
${axis}MINSP=100*(${encodercounts}/$quadcounts)
|
||||
${axis}FIXPOS=0"
|
||||
}
|
||||
foreach {axis} {A B C D E F} {
|
||||
puts "${axis}DIFF=${axis}QTARGET - _TP${axis}
|
||||
IF ( ((100*${axis}TOLQC) > @ABS\[${axis}DIFF\]) & (@ABS\[${axis}DIFF\] > ${axis}TOLQC) )
|
||||
${axis}SHLDFIX=1
|
||||
ELSE
|
||||
${axis}SHLDFIX=0
|
||||
ENDIF"
|
||||
}
|
||||
puts "XQ#SERVOLP,1
|
||||
EN"
|
||||
# Generate servo loop
|
||||
puts "#SERVOLP"
|
||||
genMOVE A $encodercounts -93165 $tolquadcounts
|
||||
foreach {axis} {B C D E F} {
|
||||
genMOVE $axis $encodercounts $quadcounts $tolquadcounts
|
||||
}
|
||||
puts "JP#SERVOLP"
|
||||
@@ -1,30 +0,0 @@
|
||||
proc move_away_from_switch {axis} {
|
||||
puts "NOTE Move slit forward 10mm if it is against the reverse limit switch
|
||||
IF ((_TS${axis} & 4) = 0)
|
||||
SH${axis}
|
||||
PR${axis}=200000
|
||||
BG${axis}
|
||||
ENDIF"
|
||||
}
|
||||
|
||||
puts "#HOME"
|
||||
foreach {axis} {E F G H} {
|
||||
move_away_from_switch $axis
|
||||
}
|
||||
puts "AM"
|
||||
puts "NOTE Drive all slits into reverse limit switch"
|
||||
puts "SH
|
||||
JG ,,,,-25000,-25000,-25000,-25000
|
||||
BGEFGH
|
||||
AM"
|
||||
puts "NOTE Move away from switches by 2mm and drive back slowly"
|
||||
puts "PR ,,,,40000,40000,40000,40000
|
||||
JG ,,,,-5000,-5000,-5000,-5000
|
||||
BGEFGH
|
||||
AM"
|
||||
puts "NOTE Move forward from switch by 2mm and set zero"
|
||||
puts "PR ,,,,40000,40000,40000,40000
|
||||
BGEFGH
|
||||
AM
|
||||
DP ,,,,0,0,0,0"
|
||||
puts "EN"
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/tclsh
|
||||
# DMC2280 uses cont-Z (hex 1a) as the EOF char
|
||||
# Usage:
|
||||
# ./getDMCprog.tcl -host dmcIP -port dmcPort > dmcprog.txt
|
||||
# To fetch the code from the dmc2280 controller at dmcIP and
|
||||
# write it to dmcprog.txt, dmcPort should be 1034.
|
||||
# Note: Your computer must be on the same NBI vlan as the dmc
|
||||
# controller for this to work. However you can use ssh port
|
||||
# forwarding to work remotely.
|
||||
|
||||
# On your computer run the following ssh command,
|
||||
# ssh -L 1034:dmcIP:1034 sicsHostIP -lroot
|
||||
# Then send the code with
|
||||
# ./getDMCprog.tcl -host localhost -port 1034 > dmcprog.txt
|
||||
|
||||
array set args $argv
|
||||
|
||||
set con4 [socket $args(-host) $args(-port)]
|
||||
fconfigure $con4 -buffering line -translation crlf -eofchar \x1a
|
||||
|
||||
proc Echo {chan } {
|
||||
global forever
|
||||
|
||||
if {[eof $chan]} {
|
||||
# A rude exit works best. Closing the socket and terminating the forever loop is unreliable
|
||||
exit
|
||||
#close $chan
|
||||
#set forever done
|
||||
} else {
|
||||
puts [gets $chan]
|
||||
}
|
||||
}
|
||||
|
||||
fileevent $con4 readable [list Echo $con4]
|
||||
puts $con4 UL
|
||||
vwait forever
|
||||
@@ -1,30 +0,0 @@
|
||||
source ParList.tcl
|
||||
|
||||
proc makeHdbCounter {root treename sicsname} {
|
||||
global countParList;
|
||||
append Name $root "/" $treename
|
||||
eval hmake $Name spy none
|
||||
foreach par $countParList {
|
||||
set parName [format "%s/%s" $Name $par]
|
||||
eval hmakescript $parName \"$sicsname $par\" \"$sicsname $par\" float
|
||||
}
|
||||
}
|
||||
proc makeHdbMotor {root treename sicsname} {
|
||||
global motParList;
|
||||
append motName $root "/" $treename
|
||||
eval hmake $motName spy none
|
||||
eval hmakescript "$motName/position" \"$sicsname\" \"run $sicsname\" float
|
||||
foreach par $motParList {
|
||||
set parName [format "%s/%s" $motName $par]
|
||||
eval hmakescript $parName \"$sicsname $par\" \"$sicsname $par\" float
|
||||
}
|
||||
}
|
||||
proc makeHdbVirtMotor {root treename sicsname} {
|
||||
append motName $root "/" $treename
|
||||
eval hmake $motName spy none
|
||||
eval hmakescript "$motName/position" \"$sicsname\" \"run $sicsname\" float
|
||||
}
|
||||
#------------------------------------------------------------------------
|
||||
proc hdbReadOnly {} {
|
||||
error "Parameter is READ ONLY"
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Creates a tarball containing a SICS server distribution for a given instrument.
|
||||
serverHome=Server
|
||||
mkdir -p INST_TMP/SICS
|
||||
rm -fr INST_TMP/SICS/*
|
||||
mkdir INST_TMP/SICS/log
|
||||
mkdir INST_TMP/SICS/tmp
|
||||
mkdir INST_TMP/SICS/$serverHome
|
||||
mkdir INST_TMP/SICS/data
|
||||
touch INST_TMP/SICS/data/DataNumber
|
||||
cp $serverHome/${serverHome}Configuration.tcl INST_TMP/SICS/$serverHome
|
||||
cp $serverHome/${serverHome}.hdd INST_TMP/SICS/$serverHome
|
||||
cp ../SICServer INST_TMP/SICS/$serverHome
|
||||
cp dmc2280.tcl INST_TMP/SICS/$serverHome
|
||||
cp ../../sycFormat.tcl INST_TMP/SICS/$serverHome
|
||||
cd INST_TMP
|
||||
tar -czf ../$serverHome.tgz SICS
|
||||
cd -
|
||||
rm -fr INST_TMP
|
||||
@@ -1,82 +0,0 @@
|
||||
package require Tk
|
||||
|
||||
proc unknown {args} {}
|
||||
|
||||
# Check that the current position matches the configured home position
|
||||
proc checkHome {motor} {
|
||||
global channel
|
||||
upvar #0 $motor motName
|
||||
upvar #0 ${motor}_status motStatus
|
||||
set chan $channel($motName(host))
|
||||
if {[info exists motName(absenc)] && $motName(absenc) == 1} {
|
||||
dmc_sendCmd $chan "TP$motName(axis)"
|
||||
set homeIndex absenchome
|
||||
} else {
|
||||
dmc_sendCmd $chan "TD$motName(axis)"
|
||||
set homeIndex motorhome
|
||||
}
|
||||
set home [dmc_receive $chan]
|
||||
set motStatus(position) $home
|
||||
set motStatus(home) $motName($homeIndex)
|
||||
if {$home == $motName($homeIndex)} {
|
||||
set motStatus(homeTest) TEST_PASSED
|
||||
} else {
|
||||
set motStatus(homeTest) TEST_FAILED
|
||||
}
|
||||
return $motStatus(homeTest)
|
||||
}
|
||||
|
||||
# This implementation of the "Motor" command stores the
|
||||
# configured motor parameters in an array named
|
||||
# after the motor.
|
||||
proc Motor {name type par} {
|
||||
global motors
|
||||
upvar #0 $par arr
|
||||
upvar #0 $name param_arr
|
||||
upvar #0 ${name}_status status
|
||||
array set param_arr [array get arr]
|
||||
array set status [list position "" home "" upperLim "" lowerLim "" homeTest NOTDONE limitTest NOTDONE]
|
||||
lappend motors $name
|
||||
}
|
||||
|
||||
# Returns the test result status colour for the gui
|
||||
proc color {status} {
|
||||
switch $status {
|
||||
TEST_PASSED {return green}
|
||||
TEST_FAILED {return red}
|
||||
default {return lightgrey}
|
||||
}
|
||||
}
|
||||
|
||||
# You can easily test the home position of individual motors
|
||||
# with this gui
|
||||
# Click on the button to run the checkHome command, the position
|
||||
# (in encoder counts or motor steps) will be displayed with
|
||||
# green if the configured home matches the reported position,
|
||||
# red otherwise.
|
||||
proc testgui {} {
|
||||
package require Tk
|
||||
global motors
|
||||
toplevel .w
|
||||
frame .w.top
|
||||
|
||||
foreach m $motors {
|
||||
global ${m}_status
|
||||
set info($m) [frame .w.top.f$m]
|
||||
|
||||
set testResult $info($m).e$m
|
||||
button $info($m).$m -text $m -command "$testResult configure -background \[color \[checkHome $m\]\]"
|
||||
entry $testResult -textvariable ${m}_status(position)
|
||||
pack $info($m).$m -side left
|
||||
pack $info($m).e$m -side left
|
||||
}
|
||||
|
||||
set n 0
|
||||
foreach m $motors {
|
||||
set r [expr $n % 20]
|
||||
set c [expr $n / 20]
|
||||
grid $info($m) -row $r -column $c
|
||||
incr n
|
||||
}
|
||||
pack .w.top
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
#!/usr/bin/tclsh
|
||||
# NOTE: If any threads are running this will fail, kill all threads
|
||||
# by sending an HX command to the controller.
|
||||
# DMC2280 uses cont-Z (hex 1a) as the EOF char
|
||||
# Usage:
|
||||
# ./putDMCprog.tcl -host dmcIP -port dmcPort -file dmcprog.txt
|
||||
# To send the code in dmcprog.txt to the dmc2280 controller at
|
||||
# dmCIP:dmcPort, dmcPort should be 1034.
|
||||
# Note: Your computer must be on the same NBI vlan as the dmc
|
||||
# controller for this to work. However you can use ssh port
|
||||
# forwarding to work remotely.
|
||||
|
||||
# On your computer run the following ssh command,
|
||||
# ssh -L 1034:dmcIP:1034 sicsHostIP -lroot
|
||||
# Then send the code with
|
||||
# ./putDMCprog.tcl -host localhost -port 1034 -file dmcprog.txt
|
||||
|
||||
# NOTE:
|
||||
# It takes the controller about 0.5msec to process a command
|
||||
# so we sleep 1msec between sends to guarantee the DMC2280 FIFO doesn't overflow.
|
||||
|
||||
array set cmdln_opts $argv
|
||||
|
||||
set dmcIP $cmdln_opts(-host)
|
||||
set dmcPORT $cmdln_opts(-port)
|
||||
set controller [socket $dmcIP $dmcPORT]
|
||||
fconfigure $controller -buffering line -translation crlf -eofchar \x1a
|
||||
|
||||
# sleep time msec
|
||||
proc sleep {time} {
|
||||
global end
|
||||
after $time set end 1
|
||||
vwait end
|
||||
}
|
||||
sleep 500
|
||||
puts "Opening $cmdln_opts(-file)"
|
||||
set fh [open $cmdln_opts(-file)]
|
||||
|
||||
puts -nonewline $controller "DL;"
|
||||
sleep 500
|
||||
while {[gets $fh line] >=0} {
|
||||
puts "Sending $line"
|
||||
sleep 50
|
||||
puts $controller $line
|
||||
}
|
||||
|
||||
sleep 500
|
||||
puts $controller "\x1a"
|
||||
sleep 500
|
||||
|
||||
puts "\nBIG IMPORTANT NOTE"
|
||||
puts "If the transfer succeeded you must burn the program manually."
|
||||
puts "eg, Using telnet do,"
|
||||
puts "telnet $dmcIP $dmcPORT"
|
||||
puts "After connecting press enter and you should see a ':' prompt."
|
||||
puts "Enter LS to list the program, if it's OK you can burn it as follows."
|
||||
puts "Enter BP at the prompt, after a while the ':' prompt returns"
|
||||
puts "You must then restart the #AUTO routine by entering,"
|
||||
puts "XQ#AUTO"
|
||||
puts "then you can exit with ^], end enter quit"
|
||||
@@ -1,49 +0,0 @@
|
||||
# SICS common configuration
|
||||
|
||||
# $Revision: 1.7 $
|
||||
# $Date: 2006-10-26 00:29:48 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
#set sicsroot /usr/local/sics
|
||||
set sicsroot ../
|
||||
ServerOption LogFileBaseName $sicsroot/log/serverlog
|
||||
|
||||
installprotocolhandler
|
||||
|
||||
source utility.tcl
|
||||
|
||||
ServerOption statusfile $sicsroot/log/status.tcl
|
||||
ServerOption RedirectFile $sicsroot/log/stdout
|
||||
ServerOption LogFileDir $sicsroot/log
|
||||
ServerOption QuieckPort [portnum $quieckport ]
|
||||
ServerOption ServerPort [portnum $serverport ]
|
||||
ServerOption InterruptPort [portnum $interruptport ]
|
||||
ServerOption TelWord sicslogin
|
||||
ServerOption TelnetPort [portnum $telnetport ]
|
||||
ServerOption ReadUserPasswdTimeout 600000
|
||||
ServerOption AcceptTimeOut 10
|
||||
ServerOption ReadTimeOut 10
|
||||
SicsUser manager ansto 1
|
||||
SicsUser user sydney 2
|
||||
SicsUser spy 007 3
|
||||
MakeDataNumber SicsDataNumber $sicsroot/data/DataNumber
|
||||
VarMake SicsDataPath Text Internal
|
||||
SicsDataPath $sicsroot/data/
|
||||
SicsDataPath lock
|
||||
VarMake SicsDataPrefix Text Internal
|
||||
SicsDataPrefix ansto
|
||||
SicsDataPrefix lock
|
||||
VarMake SicsDataPostFix Text Internal
|
||||
SicsDataPostFix .hdf
|
||||
SicsDataPostFix lock
|
||||
VarMake Title Text User
|
||||
VarMake Sample Text User
|
||||
VarMake User Text User
|
||||
VarMake starttime Text User
|
||||
VarMake currentfile Text User
|
||||
VarMake batchroot Text User
|
||||
MakeDrive
|
||||
|
||||
# Useful for making configurable batch files.
|
||||
publish set user
|
||||
@@ -1,128 +0,0 @@
|
||||
#!/usr/bin/env tclsh
|
||||
|
||||
# $Revision: 1.6 $
|
||||
# $Date: 2006-10-09 03:12:08 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
# Load troubleshooting setup
|
||||
source dmc2280_util.tcl
|
||||
source troubleshoot_setup.tcl
|
||||
source motorinfo.tcl
|
||||
|
||||
if { $argc > 0 } {
|
||||
set configFileName [lindex $argv 0]
|
||||
}
|
||||
|
||||
namespace eval sics_config {
|
||||
proc loadConfig {fName} {
|
||||
variable ContList
|
||||
if [info exists ContList] {unset ContList}
|
||||
# Temporarily define unknown proc to skip undefined procs
|
||||
rename ::unknown _unknown
|
||||
proc ::unknown {args} {}
|
||||
if [catch {uplevel #0 source $fName} errMsg] {
|
||||
rename ::unknown ""
|
||||
rename _unknown ::unknown
|
||||
error $errMsg
|
||||
} else {
|
||||
rename ::unknown ""
|
||||
rename _unknown ::unknown
|
||||
}
|
||||
if [catch {set ContList [uplevel #0 info vars dmc2280_controller*]} result] {error $result}
|
||||
if {[llength $ContList] == 0} {error "Error: There are no dmc2280_controllerN(host/port) arrays in the $fName configuration file"}
|
||||
#Add the controller to the sics_config namespace
|
||||
foreach c $ContList {upvar #0 $c cont; puts "$c IP:port = $cont(host):$cont(port)"}
|
||||
}
|
||||
|
||||
proc subExists {contName sub} {
|
||||
upvar #0 $contName controller
|
||||
if [catch {::dmc_sendCmd $controller(socket) "LS $sub,0"} errMsg] {
|
||||
error "Subroutine $sub does not exist on controller $contName"
|
||||
}
|
||||
::dmc_receive $controller(socket)
|
||||
}
|
||||
|
||||
# Returns -1 if thread is not running, line number if it is
|
||||
proc checkThread {contName thnum} {
|
||||
upvar #0 $contName controller
|
||||
::dmc_sendCmd $controller(socket) "MG _XQ$thnum"
|
||||
set reply [::dmc_receive $controller(socket) ]
|
||||
if {$reply == -1} {
|
||||
error "Thread $thnum not running on controller $contName"
|
||||
}
|
||||
return $reply
|
||||
}
|
||||
|
||||
# GUI STUFF
|
||||
package require Tk
|
||||
variable ContList
|
||||
global ldFrame
|
||||
set ldFrameName ".loadFile"
|
||||
set ldFrame(button) $ldFrameName.ldConf
|
||||
set ldFrame(entry) $ldFrameName.ldEntry
|
||||
|
||||
|
||||
proc ::guiLoadC {} {
|
||||
::sics_config::loadConfig [eval $::sics_config::ldFrame(entry) get]
|
||||
}
|
||||
|
||||
proc ::guiConnect {w cont} {
|
||||
::dmc_connect $cont
|
||||
$w configure -activebackground green
|
||||
$w configure -background green
|
||||
}
|
||||
|
||||
proc ::guiCheckSubs {w cont} {
|
||||
global contSubs
|
||||
foreach sub $contSubs($cont) {
|
||||
::sics_config::subExists $cont $sub
|
||||
}
|
||||
$w configure -activebackground green
|
||||
$w configure -background green
|
||||
}
|
||||
|
||||
proc ::guiCheckThreads {w cont} {
|
||||
global contThreads
|
||||
foreach thr $contThreads($cont) {
|
||||
::sics_config::checkThread $cont $thr
|
||||
}
|
||||
$w configure -activebackground green
|
||||
$w configure -background green
|
||||
}
|
||||
|
||||
frame $ldFrameName
|
||||
pack $ldFrameName
|
||||
button $ldFrame(button) -text "Load config" -command {guiLoadC; ::sics_config::mkGui}
|
||||
entry $ldFrame(entry) -textvariable configFileName -width -1
|
||||
pack $ldFrame(button) -side left
|
||||
pack $ldFrame(entry) -side left
|
||||
|
||||
|
||||
proc mkGui {} {
|
||||
variable ContList
|
||||
lappend Headings $ContList
|
||||
frame .t -bg black
|
||||
table .t $ContList
|
||||
pack .t
|
||||
testgui
|
||||
}
|
||||
proc table {w headings args} {
|
||||
set r 0
|
||||
|
||||
foreach name $headings {
|
||||
lappend Header [label $w.$name -text $name]
|
||||
}
|
||||
foreach name $headings {
|
||||
lappend Connect [button $w.connect$name -text connect -command "guiConnect $w.connect$name $name"]
|
||||
lappend CheckSubs [button $w.chkSubs$name -text "Check subs" -command "guiCheckSubs $w.chkSubs$name $name"]
|
||||
lappend CheckThreads [button $w.chkThrs$name -text "Check threads" -command "guiCheckThreads $w.chkThrs$name $name"]
|
||||
}
|
||||
eval grid $Header -sticky news -padx 1 -pady 1
|
||||
eval grid $Connect -sticky news -padx 1 -pady 1
|
||||
eval grid $CheckSubs -sticky news -padx 1 -pady 1
|
||||
eval grid $CheckThreads -sticky news -padx 1 -pady 1
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
# Some useful functions for SICS configuration.
|
||||
|
||||
# $Revision: 1.3 $
|
||||
# $Date: 2006-10-15 23:36:36 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
# Utility fucntion for setting the home and upper and lower
|
||||
# limits for a motor
|
||||
proc setHomeandRange {args} {
|
||||
set usage "
|
||||
Usage: setHomeandRange -motor motName -home homeVal -lowrange low -uprange high
|
||||
eg
|
||||
setHomeandRange -motor mchi -home 90 -lowrange 5 -uprange 7
|
||||
this sets the home position to 90 degreess for motor mchi
|
||||
with the lower limit at 85 and the upper limit at 97
|
||||
"
|
||||
if {$args == ""} {clientput $usage; return}
|
||||
array set params $args
|
||||
set motor $params(-motor)
|
||||
set home $params(-home)
|
||||
set lowlim [expr $home - $params(-lowrange)]
|
||||
set uplim [expr $home + $params(-uprange)]
|
||||
|
||||
uplevel 1 "$motor hardlowerlim $lowlim"
|
||||
uplevel 1 "$motor hardupperlim $uplim"
|
||||
uplevel 1 "$motor softlowerlim $lowlim"
|
||||
uplevel 1 "$motor softupperlim $uplim"
|
||||
uplevel 1 "$motor home $home"
|
||||
}
|
||||
|
||||
# Use this to create an array of named parameters to initialise motors.
|
||||
proc params {args} {
|
||||
upvar 1 "" x;
|
||||
if [info exists x] {unset x}
|
||||
foreach {k v} $args {set x([string tolower $k]) $v}
|
||||
}
|
||||
|
||||
# Parse motor readings for virtual motor scripts.
|
||||
proc SplitReply { text } {
|
||||
set l [split $text =]
|
||||
return [lindex $l 1]
|
||||
}
|
||||
|
||||
# Sets motor position reading to pos by adjusting the softzero
|
||||
proc setpos {motor pos} {
|
||||
set currPos [SplitReply [$motor]]
|
||||
set oldZero [SplitReply [$motor softzero]]
|
||||
set newZero [expr $currPos - $pos + $oldZero]
|
||||
uplevel #0 "$motor softzero $newZero"
|
||||
}
|
||||
publish setpos user
|
||||
publish SplitReply user
|
||||
Reference in New Issue
Block a user