Open penandlim opened 5 years ago
Thanks for opening your first issue here! :tada:
Thx for the report. I will try to have a look asap.
I just checked with my controller and it works just like your expected behaviour. The following code
device = Controller(api, "192.168.2.37")
device.turn_on()
device.set_rgbww(255, 255, 255, 0, 0)
device.set_function(FunctionId.RED_STROBE_FLASH, 255)
results in a strobe that flashes multiple times per second (I would guess around 5 fps). Which hardware do you use?
My hardware is from https://www.amazon.com/gp/product/B075X8TJCD/. Bought it about a week ago. I'm also using the controller with one 5050 rgb strip and one 2835 warm white strip (cool white channel is unused.)
I tested other functions (RED_GRADUAL_CHANGE, etc) and timed how long one cycle takes. At speed = 255, it takes about 15 seconds inbetween fading into red which similar to setting speed to 50% on S panel.
These are some of the packets captured and compared.
device.set_function(FunctionId.RED_STROBE_FLASH , 0)
Data: 6131ff0fa0
device.set_function(FunctionId.RED_STROBE_FLASH , 255)
Data: 6131000fa1
Using android app:
Set Red strobe flash to speed: 0% on S panel
Data: 61311f0fc0
Set Red strobe flash to speed: 18% on S panel
Data: 6131190fba
Set Red strobe flash to speed: 38% on S panel
Data: 6131130fb4
Set Red strobe flash to speed: 54% on S panel
Data: 61310e0faf
Set Red strobe flash to speed: 73% on S panel
Data: 6131090faa
Set Red strobe flash to speed: 87% on S panel
Data: 6131040fa5
Set Red strobe flash to speed: 100% on S panel
Data: 6131010fa2
Setting speed to 254 results in same packets as 100% on S panel. Seems like 254 is max speed for me and 255 actually slows down the functions for some reason.
Looking at your package captures it looks like a value of 1F (so 255 - 31 = 224) seems to equal 0% and 01 (255 - 1 = 254) equals 100% speed. It might be that I got this wrong but since it does work on my controller I guess there are different firmwares in the wild.
Looking at the lib my work is based on it seems I really got it wrong: https://github.com/sidoh/ledenet_api/blob/b6f0c5cba03c535cdc877ac2f9787e88763d16be/lib/ledenet/function_speed.rb#L6 I will do some additional testing and release a fix when I find the time to do so. This would also explain why I thought the speed curve is exponential.
GitHubAn API for the LEDENET Magic UFO LED WiFi Controller - sidoh/ledenet_api
@penandlim I tested the 255/254 values and it indeed seems like it does not make a difference. However values lower than 224 do increase the latency so 1F does not seem to be the real limit. Could you test that on your device? If so I would like to keep those values even though they might not be very useful to most users.
Describe the bug Maximum speed for strobe flash function is a lot slower than what the official app allows you to set.
To Reproduce Steps to reproduce the behavior:
device.set_function(FunctionId.RED_STROBE_FLASH, 255)
Expected behavior
device.set_function(FunctionId.RED_STROBE_FLASH, 255)
should be as fast as what the official app (5-10 flashes per second). But instead I get about 1 flash per 3 seconds ish.