Revision 210
Updated jumptable and Makefile for tooltron to work with bootloader
updated tooltron.py to handle NACKs
Fixed tooltron.py to send 'o' instead of 'O'
netprog.py | ||
---|---|---|
90 | 90 |
printMsg(msg) |
91 | 91 |
bus.write(msg) |
92 | 92 |
|
93 |
dCount = 0 |
|
94 |
|
|
93 | 95 |
def sendData(t, data): |
94 | 96 |
body = chr(1) + chr(t) + TT_PROGD + data |
95 | 97 |
n = len(data) |
... | ... | |
99 | 101 |
xor = 0 |
100 | 102 |
for c in body: |
101 | 103 |
xor = xor ^ ord(c) |
102 |
|
|
103 | 104 |
msg = '^' + body + chr(xor) |
104 | 105 |
printMsg(msg) |
105 | 106 |
bus.write(msg) |
... | ... | |
119 | 120 |
|
120 | 121 |
return TT_BAD |
121 | 122 |
if msg[0] != '^': |
122 |
print "did not get start delimeter! ",ord(msg[0]) |
|
123 |
print "did not get start delimeter! ",ord(msg[0])," packet size:",len(msg)
|
|
123 | 124 |
return TT_BAD |
124 | 125 |
src = msg[1] |
125 | 126 |
#print "src: ", ord(src) |
... | ... | |
166 | 167 |
r = readPacket() |
167 | 168 |
if r == TT_NACK: |
168 | 169 |
print "WARNING: got NACK, trying again" |
169 |
if r == TT_BOOT: |
|
170 |
elif r == TT_BOOT:
|
|
170 | 171 |
print "ERROR: got stray boot packet" |
171 | 172 |
#TODO: restart the whole state machine after the boot packet |
172 | 173 |
exit(-2) |
173 |
if r != TT_ACK: |
|
174 |
elif r != TT_ACK:
|
|
174 | 175 |
print "ERROR: got another packet:",r |
175 | 176 |
exit(-1) |
176 | 177 |
|
... | ... | |
189 | 190 |
r = readPacket() |
190 | 191 |
if r == TT_NACK: |
191 | 192 |
print "WARNING: got NACK, trying again" |
192 |
if r == TT_BOOT: |
|
193 |
elif r == TT_BOOT:
|
|
193 | 194 |
print "ERROR: got stray boot packet" |
194 | 195 |
#TODO: restart the whole state machine after the boot packet |
195 | 196 |
exit(-2) |
196 |
if r != TT_ACK: |
|
197 |
elif r != TT_ACK:
|
|
197 | 198 |
print "ERROR: got another packet:",r |
198 | 199 |
exit(-1) |
199 | 200 |
|
Also available in: Unified diff