mclarkk / lifxlan

Python library for accessing LIFX devices locally using the official LIFX LAN protocol.
MIT License
503 stars 115 forks source link

Understanding Tile.get_canvas_dimensions() expected output #144

Closed netmanchris closed 3 years ago

netmanchris commented 4 years ago

I've got four set's of Tiles put together in a 4x5 canvas ( 4 high x 5 long ).

When executing the .get_canvas_dimensions method, I would have expected that the canvas dimensions of all 4 tilechains should be identical as they are all 5 tiles long. In theory, the canvas dimensions should be 8x40. ( 8 high, 40 wide ). Each individual tile should be 8x8. I'm operating under the mental model where the 8x8 should be constant considering these are physical attributes of the device.

Any help would be greatly appreciated understanding how this is working. Here's a quick screen output of the get_canvas_dimensions method.

More than happy to provide more info if someone can help me correct my mental model.


for tc in canvas:
    print (tc.get_label())
    print (tc.get_canvas_dimensions())
T1
    (32, 8)
T2
    (16, 8)
T3
    (48, 8)
T4
   (32, 8)
​```
mclarkk commented 4 years ago

The canvas dimensions should be the dimensions of the bounding rectangle for the whole shape of the TileChain, in the x (width) and y (height) dimension. Your intuition is right in that the dimensions should all be (40, 8).

The dimensions are calculated using the x, y info that the Tiles themselves provide, so the first thing to check is whether your Tile lights have been configured to understand the configuration of the chain.

If no, then you have to use the app to configure the Tile locations by dragging the squares around into the configuration on the wall.

If yes, then the next thing to do is to pick a particular chain and print out the info about the tiles, with

for tile in tc.get_tile_info():
    print(tile)

This should show you what information the chain's controller is providing about each of the tiles.