hyperion-project / hyperion.ng

The successor to Hyperion aka Hyperion Next Generation
https://hyperion-project.org/
MIT License
3.11k stars 384 forks source link

adalight LightBerry APA102 - stops working when turned off for+- 10 seconds #1135

Closed starkillerOG closed 3 years ago

starkillerOG commented 3 years ago

Bug report

I have a adalight lightberry APA102 led strip that is connected through USB to the RPi 3B. Yust updated to the latest hyperion ng (coming from old hyperion).

When I boot up the RPi3 everything works fine and the Ambilight works perfect. When I turn off the APA102 strip through remote -> LED Device ->off they turn off fine If I then quickly (within +- 10seconds) turn them back ON, they come back on and everything works fine. (can repeat On/Off a lot of times and just works)

BUT: If I leave the APA102 LED strip off for longer than +-10 seconds, I cannot get them to come back on. The only way to get it working again that I figured out is reboot the whole RPi3.

I also get some timeout error in the debug log when they refuse to turn back on.

Steps to reproduce

1) boot hyperion ng with adalight APA102 LED strip 2) turn led device off 3) wait 30 seconds 4) try to turn them back on

What is expected?

They schould just turn on, even if they have been off for a while

What is actually happening?

They do not turn on and I see a timeout error in the log

System

Hyperion Server:

Hyperion Server OS:

Debug Log (error is at 2021-01-03T17:07:58.776Z):

2021-01-03T17:06:20.579Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) LED device: disabled
 2021-01-03T17:06:20.611Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:93:close()) Flush was successful
 2021-01-03T17:06:20.611Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:95:close()) Close UART: ttyACM0
 2021-01-03T17:06:24.173Z [hyperiond LEDDEVICE] (INFO) Opening UART: ttyACM0
 2021-01-03T17:06:24.173Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:141:tryOpen()) _rs232Port.open(QIODevice::ReadWrite): ttyACM0, Baud rate [115200]bps
 2021-01-03T17:06:24.229Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:146:tryOpen()) portName:          ttyACM0
 2021-01-03T17:06:24.230Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:147:tryOpen()) systemLocation:    /dev/ttyACM0
 2021-01-03T17:06:24.231Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:148:tryOpen()) description:       Arduino Leonardo
 2021-01-03T17:06:24.232Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:149:tryOpen()) manufacturer:      Arduino LLC
 2021-01-03T17:06:24.233Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:150:tryOpen()) productIdentifier: 0x8036
 2021-01-03T17:06:24.234Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:151:tryOpen()) vendorIdentifier:  0x2341
 2021-01-03T17:06:24.235Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:152:tryOpen()) serialNumber:      
 2021-01-03T17:06:24.238Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:173:tryOpen()) delayAfterConnect for 100 ms - start
 2021-01-03T17:06:24.340Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:180:tryOpen()) delayAfterConnect for 100 ms - finished
 2021-01-03T17:06:24.340Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) LED device: enabled
 2021-01-03T17:06:26.428Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) LED device: disabled
 2021-01-03T17:06:26.458Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:93:close()) Flush was successful
 2021-01-03T17:06:26.459Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:95:close()) Close UART: ttyACM0
 2021-01-03T17:06:42.119Z [hyperiond LEDDEVICE] (INFO) Opening UART: ttyACM0
 2021-01-03T17:06:42.119Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:141:tryOpen()) _rs232Port.open(QIODevice::ReadWrite): ttyACM0, Baud rate [115200]bps
 2021-01-03T17:06:42.231Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:146:tryOpen()) portName:          ttyACM0
 2021-01-03T17:06:42.232Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:147:tryOpen()) systemLocation:    /dev/ttyACM0
 2021-01-03T17:06:42.233Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:148:tryOpen()) description:       Arduino Leonardo
 2021-01-03T17:06:42.234Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:149:tryOpen()) manufacturer:      Arduino LLC
 2021-01-03T17:06:42.234Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:150:tryOpen()) productIdentifier: 0x8036
 2021-01-03T17:06:42.234Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:151:tryOpen()) vendorIdentifier:  0x2341
 2021-01-03T17:06:42.235Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:152:tryOpen()) serialNumber:      
 2021-01-03T17:06:42.237Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:173:tryOpen()) delayAfterConnect for 100 ms - start
 2021-01-03T17:06:42.338Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:180:tryOpen()) delayAfterConnect for 100 ms - finished
 2021-01-03T17:06:42.339Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) LED device: enabled
 2021-01-03T17:06:45.829Z [hyperiond WEBSOCKET] (DEBUG) (JsonAPI.cpp:1054:handleLoggingCommand()) log streaming activated for client ::ffff:192.168.1.10
 2021-01-03T17:06:45.877Z [hyperiond WEBSOCKET] (DEBUG) (JsonAPI.cpp:1063:handleLoggingCommand()) log streaming deactivated for client  ::ffff:192.168.1.10
 2021-01-03T17:07:19.191Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) LED device: disabled
 2021-01-03T17:07:19.252Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:93:close()) Flush was successful
 2021-01-03T17:07:19.253Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:95:close()) Close UART: ttyACM0
 2021-01-03T17:07:57.526Z [hyperiond LEDDEVICE] (INFO) Opening UART: ttyACM0
 2021-01-03T17:07:57.526Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:141:tryOpen()) _rs232Port.open(QIODevice::ReadWrite): ttyACM0, Baud rate [115200]bps
 2021-01-03T17:07:57.616Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:146:tryOpen()) portName:          ttyACM0
 2021-01-03T17:07:57.618Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:147:tryOpen()) systemLocation:    /dev/ttyACM0
 2021-01-03T17:07:57.619Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:148:tryOpen()) description:       Arduino Leonardo
 2021-01-03T17:07:57.620Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:149:tryOpen()) manufacturer:      Arduino LLC
 2021-01-03T17:07:57.620Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:150:tryOpen()) productIdentifier: 0x8036
 2021-01-03T17:07:57.620Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:151:tryOpen()) vendorIdentifier:  0x2341
 2021-01-03T17:07:57.621Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:152:tryOpen()) serialNumber:      
 2021-01-03T17:07:57.623Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:173:tryOpen()) delayAfterConnect for 100 ms - start
 2021-01-03T17:07:57.724Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:180:tryOpen()) delayAfterConnect for 100 ms - finished
 2021-01-03T17:07:57.724Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) LED device: enabled
 2021-01-03T17:07:58.776Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:218:writeBytes()) Timeout after 1000ms: 0 frames already dropped
 2021-01-03T17:08:03.978Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:218:writeBytes()) Previous line repeats 5 times
 2021-01-03T17:08:03.981Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:93:close()) Flush was successful
 2021-01-03T17:08:03.981Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:95:close()) Close UART: ttyACM0
 2021-01-03T17:08:12.192Z [hyperiond WEBSOCKET] (DEBUG) (JsonAPI.cpp:1054:handleLoggingCommand()) log streaming activated for client ::ffff:192.168.1.10
RomRider commented 3 years ago

For me with 2.0.0-alpha9, it just doesn't work at all anymore with adalight (not even the startup effect) Timeouts on the serial line. Rolling back to 2.0.0-alpha8 and the problem disappears.

starkillerOG commented 3 years ago

@RomRider Do you use the "LightBerry APA102 Mode" or not? (I do have the "LightBerry APA102 Mode" checked)

RomRider commented 3 years ago

Yes, I use it.

Lord-Grey commented 3 years ago

Does the problem occur, if you set delayAfterConnect = 0?

starkillerOG commented 3 years ago

@Lord-Grey The problem is there if: delayAfterConnect = 0 and Refresh time = 1000ms delayAfterConnect = 100 and Refresh time = 0ms

I did not test yet: delayAfterConnect = 0 and Refresh time = 0ms

Lord-Grey commented 3 years ago

@starkillerOG I did test with a standard image of https://github.com/hyperion-project/hyperion.ng/tree/master/assets/firmware/arduino/adalight and I cannot reproduce the issue.

Which image are you using, or is this a ready made device?

In the adalight_lightberry_apa102 image, I see that there is a switch-off by the device itself after 15s:

// If no serial data is received for a while, the LEDs are shut off // automatically. This avoids the annoying "stuck pixel" look when // quitting LED display programs on the host computer. static const unsigned long serialTimeout = 15000; // 15 seconds

https://github.com/hyperion-project/hyperion.ng/tree/master/assets/firmware/arduino/adalight_lightberry_apa102

It looks like that when hyperion reopens the session, here it does not catch-up. Would you be able to test with the "classic" adalight image?

In addition, what is your configured latchtime? Maybe you can share a screenshot of your device's configuration.

starkillerOG commented 3 years ago

@Lord-Grey This is a ready made device from lightberry: https://lightberry.eu/ although I think they stopped producing and selling.

Therefore I have never put firmware on the little USB to LED strip box... I am experianced with flashing new firmware on ESP8266 chips but I don't really want to start flashing that USB to LED box since it just worked and was part of a kit I bought.

The 15 seconds switch off you mention sounds really like the issue I am experiancing! It can verry well be 15 seconds (instead of the 10 seconds I mentioned, never actually timed it but just guessed).

If you want I can time it and see if it is indeed exactly 15 seconds?

Latch time is 30 ms. What does Latch time do, I just left it at ist default....

starkillerOG commented 3 years ago

This is my config at the moment, but I have been playing around with the settings to see if I could make it work, not sure what the correct settings actually are.... afbeelding

Lord-Grey commented 3 years ago

@starkillerOG Thanks for providing feedback.

I don't really want to start flashing that USB to LED box since it just worked and was part of a kit I bought.

I am not asking you to flash a bought device. :-) I only wanted to check, if it was a custom one. Seems I need to find another way reproducing it...

What does Latch time do, I just left it at ist default....

Latch time is the time-frame a device requires until the next update can be processed. During that time-frame any updates done are skipped.

Lord-Grey commented 3 years ago

Do you which lighberry firmware version you have?

http://update.lightberry.eu/

In addition, could you set the delay after connect to 6000ms and test again? It looks like that with later firmware versions there was delay introduced. I assume that causes the problem that the writes by hyperion fail after reopening...

starkillerOG commented 3 years ago

@Lord-Grey Thank you so much for your help! I actually do not know for sure which firmware version I have, but I think the updated one.

But for sure I can update my module with the latest firmware from http://update.lightberry.eu/ if you want?

I am going to test with the 6000ms delay now, will report in a bit!

starkillerOG commented 3 years ago

@Lord-Grey I just tested with the delay after connect of 6000 ms, unfortunately that did not help. It took 6 seconds for the device to respond to a turn on (obvious) but besides that the behaviour was the same, fast turn off/on works but if you keep it off to long it stops working.

I now took a timer and started measuring, started the timer when I turned it OFF and stopped it when I turned it back ON: 10 seconds --> works 11 seconds --> works 12 seconds --> works 13 seconds --> works 14 seconds --> works 15 seconds --> it failed

So you were exactly right, the problem indeed occurs when you turn it off for longer then 15 seconds.

starkillerOG commented 3 years ago

@Lord-Grey I just updated the firmware of the little USB to LED converter box. I updated to v1.1 APA102USB: http://update.lightberry.eu/download/LightberryHDUSBAPA1021.1_delay.zip

That fixed the problem for me :) Now it just keeps working also when you turn it off for a longer time. Not sure which firmware I was running, but probably some old one, I looked at my board and it is from 2015, so quite a while ago..

This is a picture of my board: 20210110_121819

starkillerOG commented 3 years ago

@Lord-Grey Thank you for all your help, you are awesom! Since the issue was resolved by updating the firmware, I will close this issue.

Lord-Grey commented 3 years ago

@starkillerOG Great that it is working now!!!

Tonio16 commented 3 years ago

@Lord-Grey Thank you for all your help, you are awesom! Since the issue was resolved by updating the firmware, I will close this issue.

Hello Starkiller

Would wou mind to share your conf for the usb grabber. I didn’t succeed to have an equivalent of hyperion with hyperion.ng and my lightberry.

Tx

Antoine

starkillerOG commented 3 years ago

@Tonio16 here is my config: 1 2

Tonio16 commented 3 years ago

Thanks a lot.

Antoine

XVII commented 3 years ago

Great, I had the same kit... thanks for your investigation!

durag5 commented 2 years ago

@Lord-Grey I just updated the firmware of the little USB to LED converter box. I updated to v1.1 APA102USB: http://update.lightberry.eu/download/LightberryHDUSBAPA1021.1_delay.zip

That fixed the problem for me :) Now it just keeps working also when you turn it off for a longer time. Not sure which firmware I was running, but probably some old one, I looked at my board and it is from 2015, so quite a while ago..

This is a picture of my board: 20210110_121819

@starkillerOG sorry to Necro this thread but just upgraded to hyperion.ng and have the same issue. All the firmware upgrade info is now gone. Do you still have the file and brief explanation how to flash it? I will get the info posted to the forums for future users.

Edit: found the instructions @ http://web.archive.org/web/20210802025348/http://update.lightberry.eu/

Do you happen to have the file?

And the link works on that site. Sorry for the Necro! All good now.

starkillerOG commented 2 years ago

@durag5 This is the file that I used: LightberryHDUSBAPA1021.1_delay.zip

No problem, hope everything is working for you again.

Tonio16 commented 11 months ago

Hello

Is the adalight lightberry apa102 setup in hyperio ln working for you? I have no effect on my leds with it and no clue how to solve this.

I see the usb device, I chose adalight and lightberry. What should I try now?

I can see the grabber (a new one, not lightberry one) in the leds setup, so this part should be ok.

Regards

Antoine

starkillerOG commented 11 months ago

Yes it works for me. Unfortunately I am not an expert with the new hyperion NG. Are you able to set static colors using the webbrowser? When you reboot the hyperion device, do the LEDs flash red green blue during startup?

Tonio16 commented 11 months ago

Yes it works for me. Unfortunately I am not an expert with the new hyperion NG. Are you able to set static colors using the webbrowser? When you reboot the hyperion device, do the LEDs flash red green blue during startup?

Hello I have the red green blue flash at start.

If I look at the log I notice this point: Device disabled, device 'adalight' signals error: 'Permission error while locking the device' I will investigate this point.

2023-12-06T16:46:55.245Z [LEDDEVICE] (DEBUG) (LedDevice.cpp:215:init()) deviceConfig: [{"autoStart":true,"colorOrder":"rgb","currentLedCount":90,"delayAfterConnect":0,"enableAttempts":6,"enableAttemptsInterval":15,"hardwareLedCount":90,"latchTime":30,"output":"ttyACM0","rate":115200,"rateList":"115200","rewriteTime":1000,"streamProtocol":"1","white_channel_blue":255,"white_channel_calibration":false,"white_channel_green":255,"white_channel_limit":100,"white_channel_red":255}] 2023-12-06T16:46:55.245Z [LEDDEVICE] (DEBUG) (LedDevice.cpp:565:setLedCount()) LedCount set to 90 2023-12-06T16:46:55.246Z [LEDDEVICE] (DEBUG) (LedDevice.cpp:571:setColorOrder()) ColorOrder set to RGB 2023-12-06T16:46:55.246Z [LEDDEVICE] (DEBUG) (LedDevice.cpp:578:setLatchTime()) LatchTime set to 30ms 2023-12-06T16:46:55.247Z [LEDDEVICE] (DEBUG) (LedDevice.cpp:602:setRewriteTime()) Refresh interval = 1000ms 2023-12-06T16:46:55.249Z [LEDDEVICE] (DEBUG) (LedDevice.cpp:247:startRefreshTimer()) Device is not ready to start a refresh timer 2023-12-06T16:46:55.250Z [LEDDEVICE] (DEBUG) (LedDevice.cpp:584:setAutoStart()) AutoStart enabled 2023-12-06T16:46:55.250Z [LEDDEVICE] (DEBUG) (LedDevice.cpp:621:setEnableAttempts()) Max enable retries: 6, enable retry interval = 15s 2023-12-06T16:46:55.251Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:66:init()) DeviceName : ttyACM0 2023-12-06T16:46:55.252Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:68:init()) AutoDevice : 0 2023-12-06T16:46:55.252Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:69:init()) baudRate_Hz : 115200 2023-12-06T16:46:55.253Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:70:init()) delayAfCon ms: 0 2023-12-06T16:46:55.253Z [LEDDEVICE] (DEBUG) (LedDeviceAdalight.cpp:55:init()) Adalight driver uses LightBerry APA102 protocol 2023-12-06T16:46:55.254Z [LEDDEVICE] (DEBUG) (LedDeviceAdalight.cpp:122:prepareHeader()) Adalight header for 90 leds (size: 376): Ada 0x00 0x5a 0x0f 2023-12-06T16:46:55.254Z [LEDDEVICE] (INFO) Opening UART: ttyACM0 2023-12-06T16:46:55.255Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:167:tryOpen()) _rs232Port.open(QIODevice::ReadWrite): ttyACM0, Baud rate [115200]bps 2023-12-06T16:46:55.338Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:172:tryOpen()) portName: ttyACM0 2023-12-06T16:46:55.338Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:173:tryOpen()) systemLocation: /dev/ttyACM0 2023-12-06T16:46:55.339Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:174:tryOpen()) description: Arduino Leonardo 2023-12-06T16:46:55.339Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:175:tryOpen()) manufacturer: Arduino LLC 2023-12-06T16:46:55.340Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:176:tryOpen()) vendorIdentifier: 0x2341 2023-12-06T16:46:55.340Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:177:tryOpen()) productIdentifier: 0x8036 2023-12-06T16:46:55.341Z [LEDDEVICE] (DEBUG) (ProviderRs232.cpp:178:tryOpen()) serialNumber: 2023-12-06T16:46:55.345Z [LEDDEVICE] (ERROR) Device disabled, device 'adalight' signals error: 'Permission error while locking the device'