chiark / gitweb /
seems to work now
authorian <ian>
Sat, 31 Dec 2005 18:29:42 +0000 (18:29 +0000)
committerian <ian>
Sat, 31 Dec 2005 18:29:42 +0000 (18:29 +0000)
hostside/stopgap-controller

index e6e5eb60ebc1b846df8dbfacd30bff4b0a7bdc7f..ae8aa5c45bac29b86086eecd5aaabe134c7c0ee8 100755 (executable)
@@ -13,7 +13,9 @@ set ch(minint) 5000
 set always 0
 set nmrawhich 0
 
-set polarity 908000
+set polmsg(l) 908000
+set polmsg(x) 90f802
+set polmsg(y) 90807c
 set pname l
 set m {}
 set segs {xx yy}
@@ -35,7 +37,7 @@ proc gui_init {} {
     gui "M A5 0 J"
     gui "M A6 0 J"
     if {[info exists watchdog]} { gui "P 1" }
-    gui_polarity 0x$polarity
+#    gui_polarity 0x$polarity
     foreach seg [array names segdetect] {
        gui "D1 $seg"
     }
@@ -94,18 +96,14 @@ proc gui_polarity {diff} {
     }
 }
 
-proc polarity {newpname m} {
-    global pname polarity
-    debug "polarising $m"
-    if {![string compare $m $polarity]} return
-    tellpic $m
+proc polarity {newpname} {
+    global pname polmsg
+    debug "polarising $newpname"
+    if {![string compare $pname $newpname]} return
+    tellpic $polmsg($newpname)
+#    gui_polarity
     set pname $newpname
-    gui_polarity [expr "0x$m ^ 0x$polarity"]
-    set polarity $m
 }
-proc polarity_l {} { polarity l 908000 }
-proc polarity_p {} { polarity p 97ff79 }
-proc polarity_x {} { polarity x 97ff7f }
 
 proc pt_now {how point pos xtra} {
     set msg a0[lindex $point $pos]
@@ -221,17 +219,17 @@ proc pm_detect {seg} {
     }
     debug "pm_detect $seg ($segsasgot) ($segs) $pname$seg"
     switch -exact $pname$seg {
-       p07 - p06 { polarity_l }
-       p02 - p09 { polarity_x }
-       l16 - l1c - l10 - l1a { polarity_p }
-       l03 - l05 - l08 - l0b { polarity_x }
-       x07 - x06 { polarity_l }
-       x14 - x16 - x1c - x20 - x1c - x10 { polarity_p }
+       l16 - l1c - l08 - l0b { polarity y }
+       l10 - l1a - l03 - l05 { polarity x }
+       x07 - x04 - x0a { polarity l }
+       x16 - x1c - x14 - x0b { polarity y }
+       y06 - y04 - y0a { polarity l }
+       y20 - y10 - y1a - y05 { polarity x }
     }
     switch -exact $seg {
        04 - 0a { pt_must "00 01 X7" 1; pt_must "40 41 X8" 1 }
-       03 - 05 { pt_must "00 01 X7" 0 }
-       08 - 0b { pt_must "40 41 X8" 0 }
+       05 { pt_must "00 01 X7" 0 }
+       0b { pt_must "40 41 X8" 0 }
        16 - 1c { pt_must "02 03 A5" 0 }
        1a - 10 { pt_must "42 43 A6" 0 }
     }