From: ian Date: Thu, 5 Jan 2006 00:58:42 +0000 (+0000) Subject: gui-display on bessar wip X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=5ddbb8fac827a1d83aec45cbd0b79cd44a2a9b40;p=trains.git gui-display on bessar wip --- diff --git a/hostside/gui-displayer b/hostside/gui-displayer index 828314f..93320b7 100755 --- a/hostside/gui-displayer +++ b/hostside/gui-displayer @@ -1,4 +1,4 @@ -#!/usr/bin/wish +#!/usr/bin/wish8.2 proc widgets {} { global widg_pipe diff --git a/hostside/gui-plan.c b/hostside/gui-plan.c index 73bdbee..6ae3c58 100644 --- a/hostside/gui-plan.c +++ b/hostside/gui-plan.c @@ -104,7 +104,7 @@ static int lstrpdbsearch(const char *str, int l, min= 0; maxe= n_items; for (;;) { - if (min >= maxe) badcmd(0,"unknown %s",what); + if (min >= maxe) badcmd(0,"unknown %s `%.*s'",what,l,str); try= min + (maxe - min) / 2; try_item= (const char*)items + itemsz * try; try_name= *(const char *const *)try_item; diff --git a/hostside/stopgap-controller b/hostside/stopgap-controller index 065db6b..dd955a4 100755 --- a/hostside/stopgap-controller +++ b/hostside/stopgap-controller @@ -25,9 +25,10 @@ set nmradiv 0 set segs {xx yy} set segsasgot {xx yy} set pq {} ;# unset: cdu charged and waiting -#set speeddirn ff7f -set speeddirn ffff80c3fbcced7f +set speeddirn ff7f +#set speeddirn ffff80c3fbcced7f #set speeddirn_fixed {speed126 2 80 0} +set speeddirn_fixed {} set funcs ff7f # unset pointpos($point) # unset segdetect($seg) ;# unset: shown D0; {}: shown D1; or: after id, D1->0 @@ -39,8 +40,8 @@ proc gui {m} { proc gui_init {} { global watchdog polarity segdetect gui "M A2 0" - gui "M A5 0 J" - gui "M A6 0 J" +# gui "M A5 0 J" +# gui "M A6 0 J" if {[info exists watchdog]} { gui "P 1" } gui_polarity foreach seg [array names segdetect] { @@ -383,6 +384,7 @@ proc maybechange {thing} { } else { debug "fixed $thing $fixed" set l $fixed + if {![llength $l]} { return 0 } } set bin [eval exec ./hostside-old -s/dev/stdout $l] binary scan $bin H* x @@ -404,7 +406,11 @@ proc changewhat {} { proc onreadcmd {} { if {[gets stdin l] < 0} { - if {[eof stdin]} { fileevent stdin readable {} } + if {[eof stdin]} { + puts stderr "stopgap-controller got eof, quitting" + puts "GUI exit 0" + exit 0 + } return } eval $l @@ -443,6 +449,20 @@ proc setup_complete {} { tellpic 0a } + +#---------- +# for keyboard control + +proc ask_fast {} { + global speeddirn_fixed; set speeddirn_fixed {speed126 2 126 0} +} +proc ask_slow {} { + global speeddirn_fixed; set speeddirn_fixed {speed126 2 126 10} +} +proc ask_randspeed {} { + global speeddirn_fixed; catch { unset speeddirn_fixed } +} + setup gui_init vwait end