|
|
@ -190,16 +190,30 @@ try: |
|
|
|
|
|
|
|
|
|
|
|
r = b'' |
|
|
|
r = b'' |
|
|
|
for w in wiis: |
|
|
|
for w in wiis: |
|
|
|
if w.pos_x is None: |
|
|
|
if m[0] == ord('w'): |
|
|
|
v = -128 |
|
|
|
# Return weight |
|
|
|
|
|
|
|
v = 0 |
|
|
|
|
|
|
|
if w.weight is not None: |
|
|
|
|
|
|
|
v = round(w.weight) |
|
|
|
|
|
|
|
r += struct.pack('b', v) |
|
|
|
|
|
|
|
elif m[0] == ord('b'): |
|
|
|
|
|
|
|
# Return battery |
|
|
|
|
|
|
|
v = 0 |
|
|
|
|
|
|
|
if w.board.battery is not None: |
|
|
|
|
|
|
|
v = round(w.board.battery*100) |
|
|
|
|
|
|
|
r += struct.pack('b', v) |
|
|
|
else: |
|
|
|
else: |
|
|
|
v = int(round(w.pos_x*100)) |
|
|
|
# Return balance |
|
|
|
r += struct.pack('b', v) |
|
|
|
if w.pos_x is None: |
|
|
|
if w.pos_y is None: |
|
|
|
v = -128 |
|
|
|
v = -128 |
|
|
|
else: |
|
|
|
else: |
|
|
|
v = int(round(w.pos_x*100)) |
|
|
|
v = int(round(w.pos_y*100)) |
|
|
|
r += struct.pack('b', v) |
|
|
|
r += struct.pack('b', v) |
|
|
|
if w.pos_y is None: |
|
|
|
|
|
|
|
v = -128 |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
v = int(round(w.pos_y*100)) |
|
|
|
|
|
|
|
r += struct.pack('b', v) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
sock.send(r) |
|
|
|
sock.send(r) |
|
|
|