Feature request: Setting all tile states at once (SetTileState)

Hi,

I am pretty new to LIFX developing and so far I have been using the awesome lifxlan python library by Meghan Clark) to integrate my LIFX Tile set into my home automation system. Besides using slow effects on the tiles for entertainment purposes I also wanted the tiles to be able to show certain alert messages from my home automation system (i.e. when a doorbell is pressed, etc.)

So I created a scroller to be able to scroll a text over a tile setup. I started out with a 2x1 tile setup (x 16, y 8 pixels) and this worked like a charm. It scrolled perfectly with 100ms ‘shifts’. Then I wanted to extend to a 2x2 tile setup (16x16) as this allows for better text (and icon) visibility which is needed due to the white plexiglass ‘fuzzy’ effect.

This poses a problem as it needs to do 4x SetState64 per 100ms, which means 25ms per packet. This exceeds the maximum allowed packet rate as the maximum is 50ms per packet. This was visible because the last 2 tiles were ‘lagging’ behind causing a ‘tear’ in the text. I softened this a bit by using a higher ‘duration’ interval, but it is still not ‘smooth’. Dropping to a lower ‘shift’ ratio would cause the texts to be too slow so I need at least 100ms interval updates for the whole tile set.

Since the UDP protocol allows for larger packets I think it would really be beneficial to have SetTileState API calls that allow for larger than 1 tile updates (128, 256, etc.). This will also allow far more intricate effects to be made and extend the Tile usage possibilities. Yes, I’m pleading my own case :slight_smile: but still I think this would be very cool to be able to send all tile states every 50ms. Imagine moving start field effects, of dropping snowflakes, etc. etc.

Is there any thoughts on implementing this in the near future ? Or is there another channel to request features like this ?

Kind regards,
Shoenix/Martijn Schoemaker

Have a try with photons and see if that performs any better.

$ <install python3.6 or python3.7>
$ <create and activate a virtualenv>
$ pip3 install lifx-photons-core
$ lifx lan:tile_marquee -- '{"text": "hello there"}'

https://delfick.github.io/photons-core/tile_animations.html

Thanksfor your suggestion, I will try that. I already made some optimizations to the lifxlan library though and it’s pushing out the UDP packets as expected without much delay. For now it seems it’s just the ‘framerate’ I want with 4 tiles at 100ms updates is the bottleneck. But I’ll dive into photons to see it there’s a trick to it :slight_smile:

I think photons might be a bit more performant because I’m using asyncio rather than threads.

Also I’ve put a lot of effort into optimising how photons does tile animations.

I’m even working on that exact problem at the moment so that they work better on bad networks.

(on a side note, you may also notice when you ctrl-c the animations, it’ll complain a lot about cancelled messages and stuff, the next version of photons should get rid of this unnecessary output)

I second this request! But I have had decent success in driving more tiles using python’s socket lib. My latest efforts can drive 10 tiles (two controllers) and redraw them all in under 100ms. I am building 10 SetTileState64 messages and sending sending them out in a burst then sleeping for 75ms. I can drop it down to 50ms sleep time but occasionally some of the tiles will lag at that rate. Here is a video demo using two tile sets to display animated GIFs: https://www.youtube.com/watch?v=laHwXjT8Lgg

1 Like

With some changes I’ve got in a branch I’ve got my most cpu intensive animation (tile_falling) down to 44% CPU on a raspberry Pi controlling two tile sets (10 individual tiles) at the same time which is kinda cool (before my changes it was 64% CPU !)

lifx lan:tile_falling -- '{"combine_tiles": true, "line_hues": "rainbow", "line_tip_hues": null}'
1 Like

Meanwhile, I’ve released a new version of photons (0.22.1) which comes with half the CPU usage during tile animations and a bunch of other changes

1 Like