Comments (6)
I am also a little perplexed over this. What if you try to set the layout with one phone, and then start the app on another phone? Will the other phone realize there is a mapping, or start from scratch?
I had hoped that the app would take the layout from the device - why otherwise store it there?
On the other hand, there are some clues: Older firmware (such as 2.2.1) lack the possibility to store layout on the leds, but nevertheless mapping works. Thus, the app must have the possibility to cache the layout, and thus really doesn't need the values stored on the device. Also, later firmware (eg 2.7.1) lacks the aspect ratio in the info stored on the device, whereas diagonal patterns still come out ok, so again this information must be cached on the phone.
The layout stored on the device appears at least to be used for the preset effects, which actually change immediately when you upload a new layout. Again, the aspect ratio is a mystery, because what I can see the aspect ratio of these effects also come out right (initially, but comes out wrong when a new layout with a different aspect is uploaded), although the initial aspect ratio presumably is not known to the device. Maybe someone would have to sniff the traffic a little during mapping, to understand better what is happening.
Luckily for me, I don't suffer much from this problem since I only program the leds from python. But it is sure annoying if you wanted to use this trick of getting/setting layout to correct a few positions for which mapping failed, to enhance the effects downloadable by the app.
from xled.
The app definitely will see the layout if it was mapped by another phone.
I've mapped with an iPhone and then read the layout with an Android phone and vice-versa. Although, I've found that I have to close the app and re-launch it to update the layout.
However, aspectXY is not being returned by get_led_layout(). And the coordinates are always scaled to exactly fit inside the bounding box (-1, 0) (1, 1), meaning I can't infer the aspect ratio from the layout coordinates that were recorded by a phone using the current version of the xled library.
Yet somehow the aspect ratio is transferred from the iPhone to the Android app and I don't know how yet. I'm considering writing a restful MIM to record what the phones are doing exactly. Maybe there's a new restful resource that isn't documented yet?
Do you have the latest versions of the app and the latest firmware on your Twinkly?
My setup:
Device Info
product_name: Twinkly
hardware_version: 100
product_code: TWS600STP
Firmware Version
version: 2.8.3
Android Twinkly verson 3.3.4
iPhone Twinkly version - latest as of 12/8/21. (my wife's phone - sorry, I can't get the version right now)
from xled.
Very interesting results, @chadlester .
The aspect ratio is not returned by get_led_layout, because the rest interface seems to not convey this information any more. So it is a mystery how it gets between the phones. One more experiment that could shed some light on this is the following:
- Somehow, reset the mapping on both phones, so no information about layout is there from the start
- Map a layout with one phone
- Use the below snippet of python code to rotate the layout 90 degrees
- Check with the other phone which layout it has received
So if a pattern with horizontal lines comes out as vertical lines when installed from the other phone, then it must have retrieved the layout from the device. But if it still comes out as horizontal lines, then the phone must have got the layout by some other means.
Noteworthy fact: The phone needs to be connected to an external network when doing advanced mapping of the leds. I noticed this when using ap-mode on the leds and the phone was set to no-data-traffic. Why is that so? Is something stored in the cloud?
(I can't easily do the experiment myself, otherwise I would have, but we have only one phone here on which the app works.)
from xled.control import ControlInterface
def rotate90(coords):
return [{'x': 1.0-2*ele['y'], 'y': (ele['x']+1.0)/2, 'z': ele['z']}
for ele in coords]
ctr = ControlInterface("ip-address-of-device")
layout = ctr.get_led_layout()._data
ctr.set_led_layout(layout['source'], rotate90(layout['coordinates']), layout['synthesized'])
from xled.
I'm trying to make similar adjustments as the original poster. There is one stray led bulb in my current mapping that is cutting the aspect ratio of my tree in half. I can't redo the mapping within the app because the tree is already decorated and many of the bulbs are now obscured, however I was able to load the layout into Houdini using xled and then reposition the bulb in question before remapping the entire layout to fit in the 0-1 range for Y again. I sent the updated layout back to the two grouped light strands and the information does seem to reflect the changes whenever I pull the layout back again (even after restarting the devices), but the app and any FX that I make with it still use the old layout.
Could it be possible that the led mapping used in the Twinkly app is actually pulled from the cloud for the account associated with the device(s)? Just a guess, but I noticed if you share a device with another account, only the original account that was used to set up the lights can make modifications to the led layout within the app. If that is the case, is there an unofficial cloud API we could use to make these sort of changes propagate correctly?
from xled.
Hi @chadlester
No progress here. I could not repeat what you did, using just my single android phone.
I made a mapping with the app, I closed the app (in different ways, see below), changed the mapping through xled according to my post above which rotates it 90 degrees, and then started the app again. Whatever I do it refuses to use the xled-mapping.
You say you stopped the app. The only way I know is to go into settings and force-stop it. It did not help, it still remembered the old layout when started again. Then I tried removing the device in he app, and then adding it again. Then for sure it had forgotten the old layout, but instead of retrieving any layout from the device it installed the default linear layout on the device. How exactly did you "stop the app"?
Or maybe two phones are needed for the transfer of layouts to work. Supporting @RossGGG 's assumption that they are communicating through the Twinkly account. Its just a matter of how much is cached at the account (which phones are connected to the device, and the layout aspect?) and how much on the device (if anything at all?).
If anyone wants to repeat it (maybe with two phones), the experiment was done like this in detail:
First I mapped a "simple" 2D layout with the app, and then closed the app. I then let the leds show the preset effect with blue and red bands colliding (preset effect no 2, called "UpDown" in the app). I did it through xled_plus by calling ctr.show_effect(2)
, but with just xled you can do ctr.set_mode('effect')
followed by ctr.set_led_effects_current(2)
. Then I rotated the layout through my piece of code posted above on Dec 10. This has the visual effect that the red and blue bands that sweep vertically over the lights, immediately change direction to sweep horizontally instead. Then I started the app, and select the "UpDown" effect. It tentatively shows it before pressing apply, but then again with vertical sweeping. No difference if I apply it, still vertical (but the mode is set to 'movie' if I apply it. During preview, the mode is 'rt'.) When returning to 'effect' mode ctr.set_mode('effect')
the new layout is still there though and the sweeping colors go horizontally. But with all effects set through the app the old layout is used.
My system details for comparison:
Model TWS250STP-B
Firmware 2.8.3
Android app version 3.3.6
from xled.
I have looked into this with latest app to this date (3.3.8, build 5983) and Model TWS250STP-BEU with older firmware 2.6.2.
Anytime a device is added to the app its layout is set to default values.
When layout is mapped:
- it not only gets updated on the device itself,
- but it is also saved into app's private space (
/data/user/0/com.twinkly/files/layouts/<UUID>.json
) - and sent to Twinkly's servers (
https://api.twinkly.com/v2/objects
but if you were wondering about details, that's outside ofxled
andxled-docs
scope).
So @Anders-Holst is correct in his first post here - its cached.
If you manage to remove app's layout data, on next start app syncs this from the server, not from device(s).
Similarly when app is uninstalled and installed again, it fetches information from Twinkly's servers.
Long story short, I don't see a way to update layout without use of the app. 😞
from xled.
Related Issues (20)
- Xled_plus - use xled to produce various effects HOT 3
- Documentation is rendered incorrectly (inconsistently) on read the docs HOT 2
- xled on not working HOT 4
- xled sometimes hangs, probably when network is flaky HOT 8
- cli --hostname argument does nothing (broadcast ping gets used regardless)
- music dongle support? HOT 1
- ControlInterface wrapper to help with timeouts
- Turn device on doesn't work after factory reset HOT 3
- Discovery when multiple interfaces are present HOT 3
- Add support for new WiFi configuration encryption HOT 1
- Error: Only one usage of each socket address HOT 4
- Validation error HOT 2
- What should I put in octet-stream in uploading movie? HOT 22
- `python setup.py install`/`develop` need manual intervention to install dependencies
- Move this repository to xled organization HOT 4
- "get" Commands Not Functioning As Expected HOT 12
- Example of movie file/stream? HOT 4
- What about adding a Discussion forum for xled in github? HOT 7
- AttributeError: module 'xled' has no attribute 'security' HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xled.