chadharrington / all_spark_cube

All files related to the All Spark Cube built by Adaptive Computing and friends
MIT License
10 stars 0 forks source link

Sending single voxel lights up wrong led & sometimes wrong color #2

Closed spuder closed 10 years ago

spuder commented 10 years ago

If you light up a single led, you get the following unexpected behavior.

from all_spark_cube_client import *
HOST = '192.x.x.x'
PORT='12345'

client = CubeClient(HOST,PORT)
client.set_data(0, [255, 0, 0])

Expected: Led 0 => Red Actual: Led 0 => Green

client.set_data(0, [0, 255, 0])

Expected: Led 0 => Green Actual: Led 0 => Blue

client.set_data(0, [0, 0, 255])

Expected: Led 0 => Blue Actual: Led 0 => Off

client.set_data(1, [255, 0, 0])

Expected: Led 1 => Blue Actual: Led 0 => green

client.set_data(16, [255, 0, 0])

Expected: Led 16 => Red Actual: Led 5 => green

client.set_data(0, [255, 255, 0])

Expected: Led 0 => Yellow (red + green) Actual: Led 0 => Purple (red + blue)

client.set_data(0, [255, 255, 255])

Expected: Led 0 => White Actual: Led 0 => Purple (same as 255,255,0)

chadharrington commented 10 years ago

I rewrote the server and driver code in C just before Christmas. It looks like I may have introduced a bug in doing the rewrite. I will investigate this the next time I am in the office (Jan 23rd).

Chad Harrington chad.harrington@gmail.com

On Wed, Jan 15, 2014 at 10:13 PM, Spencer notifications@github.com wrote:

If you light up a single led, you get the following unexpected behavior.

from all_spark_cube_client import * HOST = '192.x.x.x' PORT='12345'

client = CubeClient(HOST,PORT)

client.set_data(0, [255, 0, 0])

Expected: Led 0 => Red Actual: Led 0 => Green

client.set_data(0, [0, 255, 0])

Expected: Led 0 => Green Actual: Led 0 => Blue

client.set_data(0, [0, 0, 255])

Expected: Led 0 => Blue Actual: Led 0 => Off

client.set_data(1, [255, 0, 0])

Expected: Led 1 => Blue Actual: Led 0 => green

client.set_data(16, [255, 0, 0])

Expected: Led 16 => Red Actual: Led 5 => green

client.set_data(0, [255, 255, 0])

Expected: Led 0 => Yellow (red + green) Actual: Led 0 => Purple (red + blue)

client.set_data(0, [255, 255, 255])

Expected: Led 0 => White Actual: Led 0 => Purple (same as 255,255,0)

— Reply to this email directly or view it on GitHubhttps://github.com/chadharrington/all_spark_cube/issues/2 .

chadharrington commented 10 years ago

The problem was in cube_server.cpp. The network protocol sends the data as an array of signed 16 bit numbers. This is because thrift doesn't support unsigned types and we need to send unsigned 8 bit numbers. I forgot to convert back to unsigned chars in the server-side code. The code is now fixed and seems to be working properly on the cube. I will close this issue for now. Reopen if you find the fix is not working.