Commit 8d21a72c authored by dave griffiths's avatar dave griffiths

gpio/osc/jellyfish comms

parent a6b73d60
......@@ -6,7 +6,7 @@ driver.init()
print(driver.read_all())
def send_weave_structure(blocks):
def send_weave_structure(blocks,last):
weave = [blocks[0],blocks[1],blocks[2],blocks[3],
blocks[8],blocks[9],blocks[10],blocks[11],
blocks[16],blocks[17],blocks[18],blocks[19],
......@@ -14,10 +14,14 @@ def send_weave_structure(blocks):
conv = reduce(lambda r,e: r+"0 " if e==0 else r+"1 ",
weave,"")
osc.Message("/eval",["(with-primitive warp \n (write-into-executable! \n warp-draft-start \n (list "+conv+")))\n"+
"(with-primitive weft \n (write-into-executable! \n weft-draft-start \n (list "+conv+")))"]).sendlocal(8000)
if last!=conv:
last=conv
osc.Message("/eval",["(with-primitive warp \n (set-draft! \n warp-draft-start \n (list "+conv+")))\n"+
"(with-primitive weft \n (set-draft! \n weft-draft-start \n (list "+conv+")))"]).sendlocal(8000)
return last
last = ""
while 1:
send_weave_structure(driver.read_all())
time.sleep(1)
last=send_weave_structure(driver.read_all(),last)
time.sleep(0.5)
......@@ -242,12 +242,12 @@
(define weft-draft-start 15)
(define warp-draft-start 14)
(define (write-into-executable! start data)
(define (set-draft! start data)
(when (not (null? data))
(pdata-set! "x" start
(if (zero? (car data))
(vector 0 0 0) (vector 1 0 0)))
(write-into-executable! (+ start 1) (cdr data))))
(set-draft! (+ start 1) (cdr data))))
(msg "hello")
......@@ -257,7 +257,11 @@
(pdata-set!
"x" 11 (with-primitive
weft
(pdata-ref "x" 12))))
(pdata-ref "x" 12)))
(pdata-set!
"x" 12 (with-primitive
weft
(pdata-ref "x" 13))))
(with-primitive
weft
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment