chiark / gitweb /
fixes from bessar fettling session
[trains.git] / hostside / stopgap-controller
index 8f89014266a1690a171dcb6f4cfaf3a217a3c982..0c4f3342c2e3846e6b58429e665cecfc22a77c45 100755 (executable)
@@ -41,8 +41,9 @@ 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"
+    gui "EOE"
     if {[info exists watchdog]} { gui "P 1" }
     gui_polarity
     foreach seg [array names segdetect] {
@@ -90,7 +91,7 @@ proc fail {m} {
     catch { after cancel $watchdog; unset watchdog }
     puts "failing $m"
     tellpic 9801 ;# 16ms
-    after 10000 fail_now
+    after 1000 fail_now
     fileevent $p readable {}
 }
 
@@ -143,6 +144,12 @@ proc pt_ifthenmust {ifpoint ifposwant thenpoint thenpos} {
     pt_must $thenpoint $thenpos
 }
 
+proc badwatchdog {} {
+    global pq
+    puts "watchdog - oh well"
+    if {![info exists pq]} { set pq {} }
+}
+
 proc pm_charged {} {
     global pq
     if {[llength $pq]} {
@@ -315,6 +322,7 @@ proc frompic {m} {
        01 - 02 { tellnmra $m }
        09 { fp $m; pm_hello }
        07 { puts "short circuit"; exit 1 }
+       0d { fp $m; badwatchdog }
        28 { fp $m; pm_charged }
        9[0-7] { fp $m; pm_maydetect 0 $v }
        9? { fp $m; pm_maydetect 1 $v }
@@ -458,7 +466,7 @@ 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}
+    global speeddirn_fixed; set speeddirn_fixed {speed126 2 10}
 }
 proc ask_randspeed {} {
     global speeddirn_fixed; catch { unset speeddirn_fixed }