chiark
/
gitweb
/
~ijackson
/
trains.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
76488d1
)
fixes from live bessar
author
ian
<ian>
Fri, 10 Mar 2006 20:00:39 +0000
(20:00 +0000)
committer
ian
<ian>
Fri, 10 Mar 2006 20:00:39 +0000
(20:00 +0000)
hostside/gui-displayer
patch
|
blob
|
history
hostside/stopgap-controller
patch
|
blob
|
history
diff --git
a/hostside/gui-displayer
b/hostside/gui-displayer
index 30751b3abcd5f522fc7de644b9b2bce981100254..ea03098a2f737d9001705a126b1265d483a745ce 100755
(executable)
--- a/
hostside/gui-displayer
+++ b/
hostside/gui-displayer
@@
-1,4
+1,4
@@
-#!/usr/bin/wish8.
2
+#!/usr/bin/wish8.
3
proc widgets {} {
global widg_pipe
proc widgets {} {
global widg_pipe
diff --git
a/hostside/stopgap-controller
b/hostside/stopgap-controller
index bfed27853760e36d1ab6dcdcb4808425268c2116..e331b7da6d45a4971aedc6998120657d6384385e 100755
(executable)
--- a/
hostside/stopgap-controller
+++ b/
hostside/stopgap-controller
@@
-1,4
+1,4
@@
-#!/usr/bin/tclsh8.
2
+#!/usr/bin/tclsh8.
3
# used like this:
# liberator:hostside> ssh bessar 'cd things/trains-bessar/hostside && ./stopgap-controller' | ./gui-displayer -
# used like this:
# liberator:hostside> ssh bessar 'cd things/trains-bessar/hostside && ./stopgap-controller' | ./gui-displayer -
@@
-15,7
+15,7
@@
set ch(scale) 1
set ch(minint) 5000
set ch(minint) 5000
-set pointprobs {0 0x0
10 0x080 0x0f
0 0x100}
+set pointprobs {0 0x0
20 0x080 0x0e
0 0x100}
set pointprobix 0
set pointabs 1 ;# 0 or 1
set pointprobix 0
set pointabs 1 ;# 0 or 1
@@
-33,8
+33,8
@@
set segs {xx yy}
set segsasgot {xx yy}
set pq {} ;# unset: cdu charged and waiting
set speeddirn ff7f
set segsasgot {xx yy}
set pq {} ;# unset: cdu charged and waiting
set speeddirn ff7f
-#unset askspeedix
-set askspeeds {1
0
30 50 80 100 126}
+set askspeedix -1
+set askspeeds {1 30 50 80 100 126}
#set speeddirn ffff80c3fbcced7f
#set speeddirn_fixed {speed126 2 80 0}
set speeddirn_fixed {}
#set speeddirn ffff80c3fbcced7f
#set speeddirn_fixed {speed126 2 80 0}
set speeddirn_fixed {}
@@
-379,9
+379,13
@@
proc onreadp {} {
}
proc newspeeddirn {} {
}
proc newspeeddirn {} {
- global loco
+ global loco askspeedix
+ set maxspeed [expr {$askspeedix == -1 ? 126.0 : 50.0}]
+ set minspeed 26.0
set b1 0x[randbyte]
set b1 0x[randbyte]
- set speed [expr {round(($b1 * $b1) / 65535.0 * 100.0 + 26.0)}]
+ set speed [expr {
+ round(($b1 * $b1) / 65535.0 * ($maxspeed - $minspeed) + $minspeed)
+ }]
set b2 0x[randbyte]
set dirn [expr {$b2 / 128}]
set dirn 0
set b2 0x[randbyte]
set dirn [expr {$b2 / 128}]
set dirn 0
@@
-546,7
+550,8
@@
proc updownfromlist {wholelistv ixv updown} {
}
proc ask_speed {updown} {
}
proc ask_speed {updown} {
- global speeddirn_fixed loco
+ global speeddirn_fixed loco askspeedix
+ if {$askspeedix < 0} { unset askspeedix }
set speed [updownfromlist askspeeds askspeedix $updown]
set speeddirn_fixed [list speed126 $loco $speed 0]
maybechange speeddirn 1
set speed [updownfromlist askspeeds askspeedix $updown]
set speeddirn_fixed [list speed126 $loco $speed 0]
maybechange speeddirn 1
@@
-554,8
+559,8
@@
proc ask_speed {updown} {
proc ask_randspeed {} {
global speeddirn_fixed askspeedix
proc ask_randspeed {} {
global speeddirn_fixed askspeedix
+ set askspeedix [expr {$askspeedix == -1 ? -2 : -1}]
catch { unset speeddirn_fixed }
catch { unset speeddirn_fixed }
- catch { unset askspeedix }
maybechange speeddirn 1
}
maybechange speeddirn 1
}
@@
-583,12
+588,11
@@
proc ask_show {} {
global loco stateshowpipe pointprob pointabs askspeedix
upvar #0 funcsr$loco fr
upvar #0 funcsl$loco fl
global loco stateshowpipe pointprob pointabs askspeedix
upvar #0 funcsr$loco fr
upvar #0 funcsl$loco fl
- if {[info exists askspeedix]} { set spd $askspeedix } { set spd r }
puts -nonewline $stateshowpipe [format \
"\nL$loco P%03x%s F%03x S%s" \
$pointprob [lindex {R A} $pointabs] \
[expr {[lindex $fr 0] | [lindex $fl 0]}] \
puts -nonewline $stateshowpipe [format \
"\nL$loco P%03x%s F%03x S%s" \
$pointprob [lindex {R A} $pointabs] \
[expr {[lindex $fr 0] | [lindex $fl 0]}] \
- $
spd
]
+ $
askspeedix
]
}
setup
}
setup