fabsenet / adrilight

An Ambilight clone for Windows based sources - HTPC or just a normal PC
MIT License
155 stars 40 forks source link

Translation to French and WS2811 support #45

Open morgeek opened 6 years ago

morgeek commented 6 years ago

Hey I can provide translation to French.

In the past I managed to make WS2811 work flawlessly with your app. It is still working like a charm !

I will try to make the V2 work with WS2811 again and report here my results.

morgeek commented 6 years ago

I have to specify that I do not have an official arduino but a CH340G clone, but I never had any issue with them. Also from what I have read online WS2811 is the same WS2812B BUT in a larger package (less LED per meter) from a programing point of view it should not matter.

So far after editing the Arduino code to fit my WS2811 needs.

I managed to load the rainbow effect, but when I launch the new app it worked once but the arduino goes to sleep few minutes after. ON and OFF with a nice dimming effect, so the new code is working !

I see the preview fine, eveything seems OK, it does works once for few minutes, LED are in sync then freezes and the app crashes when I hit the send signal button. I have to reboot everything and unplug the arduino to get it to work again.

I've looked into the logs and saw few odd things : It seems my arduino loses connection with the PC temporarly, maybe due to a faulty Arduino or USB port.

2018-05-23 12:01:20.1411 DEBUG adrilight.App adrilight 2.0.3: Main() started. 
2018-05-23 12:01:20.5661 INFO adrilight.SpotSet SpotSet created. 
2018-05-23 12:01:20.6071 INFO adrilight.SerialStream SerialStream created. 
2018-05-23 12:01:20.6221 INFO adrilight.ViewModel.SettingsViewModel SelectedViewPart is now Physical LED Setup 
2018-05-23 12:01:20.6221 INFO adrilight.ViewModel.SettingsViewModel IsPreviewTabOpen is now False 
2018-05-23 12:01:20.6411 INFO adrilight.DesktopDuplicatorReader DesktopDuplicatorReader created. 
2018-05-23 12:01:20.8651 INFO adrilight.ViewModel.SettingsViewModel IsSettingsWindowOpen is now True 
2018-05-23 12:01:27.6366 INFO adrilight.ViewModel.SettingsViewModel SelectedViewPart is now White Balance 
2018-05-23 12:01:27.6366 INFO adrilight.ViewModel.SettingsViewModel IsPreviewTabOpen is now False 
2018-05-23 12:01:28.5246 INFO adrilight.ViewModel.SettingsViewModel SelectedViewPart is now General Setup 
2018-05-23 12:01:28.5246 INFO adrilight.ViewModel.SettingsViewModel IsPreviewTabOpen is now False 
2018-05-23 12:01:30.1608 INFO adrilight.ViewModel.SettingsViewModel SelectedViewPart is now Preview Results 
2018-05-23 12:01:30.1608 DEBUG adrilight.DesktopDuplicatorReader starting the capturing 
2018-05-23 12:01:30.1608 INFO adrilight.ViewModel.SettingsViewModel IsPreviewTabOpen is now True 
2018-05-23 12:01:30.1608 DEBUG adrilight.DesktopDuplicatorReader Started Desktop Duplication Reader. 
2018-05-23 12:01:30.2957 DEBUG adrilight.DesktopDuplicatorReader The frame size changed from x to 1920x1080 
2018-05-23 12:01:30.3307 INFO adrilight.ViewModel.SettingsViewModel PreviewImageSource created. 
2018-05-23 12:01:30.9747 INFO adrilight.ViewModel.SettingsViewModel SelectedViewPart is now Serial Communication Setup 
2018-05-23 12:01:30.9747 DEBUG adrilight.DesktopDuplicatorReader stopping the capturing 
2018-05-23 12:01:30.9747 INFO adrilight.ViewModel.SettingsViewModel IsPreviewTabOpen is now False 
2018-05-23 12:01:31.0187 DEBUG adrilight.DesktopDuplicatorReader Stopped Desktop Duplication Reader. 
2018-05-23 12:01:38.2010 DEBUG adrilight.SerialStream starting the serial stream 
2018-05-23 12:01:38.2070 DEBUG adrilight.SerialStream Start called. 
2018-05-23 12:01:38.2070 DEBUG adrilight.DesktopDuplicatorReader starting the capturing 
2018-05-23 12:01:38.2070 DEBUG adrilight.DesktopDuplicatorReader Started Desktop Duplication Reader. 
2018-05-23 12:01:38.2320 DEBUG adrilight.SerialStream Exception catched. System.IO.IOException: Un périphérique attaché au systeme ne fonctionne pas correctement.

   a System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
   a System.IO.Ports.SerialStream.EndWrite(IAsyncResult asyncResult)
   a System.IO.Ports.SerialStream.Write(Byte[] array, Int32 offset, Int32 count, Int32 timeout)
   a System.IO.Ports.SerialPort.Write(Byte[] buffer, Int32 offset, Int32 count)
   a adrilight.SerialStream.DoWork(Object tokenObject)
2018-05-23 12:01:38.7567 DEBUG adrilight.SerialStream Exception catched. System.IO.IOException: Un périphérique attaché au systeme ne fonctionne pas correctement.

a System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
   a System.IO.Ports.SerialStream.EndWrite(IAsyncResult asyncResult)
   a System.IO.Ports.SerialStream.Write(Byte[] array, Int32 offset, Int32 count, Int32 timeout)
   a System.IO.Ports.SerialPort.Write(Byte[] buffer, Int32 offset, Int32 count)
   a adrilight.SerialStream.DoWork(Object tokenObject)
2018-05-23 12:10:07.6866 INFO adrilight.ViewModel.SettingsViewModel IsSettingsWindowOpen is now False 
2018-05-23 12:10:07.7106 DEBUG adrilight.App Application exit! `

It says the arduino does not work properly. I have others to try. Weird that it works for a moment and it is not as fast as the previous version, maybe the speed on the serial port is an issue here.

 Sent 7936 frames already. 2 were completely black. 
2018-05-23 12:39:53.3743 DEBUG adrilight.SerialStream Sent 8192 frames already. 2 were completely black. 
2018-05-23 12:39:54.8303 DEBUG adrilight.DesktopDuplicatorReader The frames are null since 23/05/2018 10:39:54 
2018-05-23 12:39:55.3023 DEBUG adrilight.DesktopDuplicatorReader There is again a frame which is not null! 
2018-05-23 12:39:59.7393 DEBUG adrilight.SerialStream Sent 8448 frames already. 2 were completely black. 
2018-05-23 12:40:06.0613 DEBUG adrilight.SerialStream Sent 8704 frames already. 2 were completely black. 
2018-05-23 12:40:12.4053 DEBUG adrilight.SerialStream Sent 8960 frames already. 2 were completely black. 
2018-05-23 12:40:18.6312 DEBUG adrilight.SerialStream Sent 9216 frames already. 2 were completely black. 
2018-05-23 12:40:24.7432 DEBUG adrilight.SerialStream Sent 9472 frames already. 2 were completely black. 
2018-05-23 12:40:24.8412 DEBUG adrilight.DesktopDuplicatorReader The frames are null since 23/05/2018 10:40:24 
2018-05-23 12:40:25.3032 DEBUG adrilight.DesktopDuplicatorReader There is again a frame which is not null! 
2018-05-23 12:40:30.7802 DEBUG adrilight.SerialStream Sent 9728 frames already. 2 were completely black. 
2018-05-23 12:40:36.8222 DEBUG adrilight.SerialStream Sent 9984 frames already. 2 were completely black. 
2018-05-23 12:40:42.8032 DEBUG adrilight.SerialStream Sent 10240 frames already. 2 were completely black. 
2018-05-23 12:40:48.9822 DEBUG adrilight.SerialStream Sent 10496 frames already. 2 were completely black. 
2018-05-23 12:40:54.9871 DEBUG adrilight.SerialStream Sent 10752 frames already. 2 were completely black. 
2018-05-23 12:40:55.5021 DEBUG adrilight.SerialStream Exception catched. System.IO.IOException: Un périphérique attaché au systeme ne fonctionne pas correctement.

   a System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
   a System.IO.Ports.SerialStream.EndWrite(IAsyncResult asyncResult)
   a System.IO.Ports.SerialStream.Write(Byte[] array, Int32 offset, Int32 count, Int32 timeout)
   a System.IO.Ports.SerialPort.Write(Byte[] buffer, Int32 offset, Int32 count)
   a adrilight.SerialStream.DoWork(Object tokenObject)
2018-05-23 12:40:55.8321 DEBUG adrilight.DesktopDuplicatorReader The frames are null since 23/05/2018 10:40:55 
2018-05-23 12:40:56.3081 DEBUG adrilight.DesktopDuplicatorReader There is again a frame which is not null! 
2018-05-23 12:41:01.6871 DEBUG adrilight.SerialStream Sent 11008 frames already. 2 were completely black. 
2018-05-23 12:41:08.0161 DEBUG adrilight.SerialStream Sent 11264 frames already. 2 were completely black. 
2018-05-23 12:41:14.0911 DEBUG adrilight.SerialStream Sent 11520 frames already. 2 were completely black. 
2018-05-23 12:41:20.3441 DEBUG adrilight.SerialStream Sent 11776 frames already. 2 were completely black.

adrilight settings lightning mode Lighting mode it work without a hitch ! And adjustable white balance also ! preview

Any help welcome ! Any thoughts on where i should modify something ?

UPDATE 1 : So I have changed USB port/ COM Port nothing changed, the problem was my Arduino clone. From my conclusion the issue is the high speed needed to refresh the LED at a fast speed. As Fabian specified on the release page, not all Arduino clone are equal !

I have just tried another Arduino, and it works much better and the connection does not drop !

UPDATE 2 : I sort of got it to work, but there is a problem, the bottom left corner is my starting point, colors are okay at the starting point and fails in the middle of the bottom bar until the end

zaphi commented 6 years ago

did you try to set the LED count to count/3. if your stripe has 90 LED´s you should set it to 30 to work fine

morgeek commented 6 years ago

In the past I used to divide the led count by 3 but I'm not sure as I was not keeping track of code changes and it was working perfectly with the previous version of adrilight.

I tried with the new software and no luck.

I'll start from scratch over the weekend and report back.

fabsenet commented 6 years ago

if you have a LED strip where every 3 LEDs react as one, you must describe it to adrilight with all number devided by 3! In arduino and and in the windows version. if nothing shows up, you probably messed up the total led count between windows and arduino. they must match EXACTLY or it will not work.

fabsenet commented 6 years ago

forget everything about 3 leds and

reduce the absolute black threshold!

morgeek commented 6 years ago

Started from scratch,

Changed the number of LED to match my hardware 186 LED. NUM_LEDS (2x60+2x33) is now NUM_LEDS 186

From there the Arduino reboots and display the rainbow animation. New code is loaded and working.

Test 1. Launching Adrilight 2.0.4 Setup horizontal led count : 62 Setup vertical led count : 33 Complete LED count: 186 Absolute black threshold to 0 Both lighting effects Linear and non-linear work.

Send random colors works. Led are not aligned. FAIL

Test 2. Code on Arduino is unchanged still 186 But taking the /3 approach due to my ws2811

Launching Adrilight 2.0.4 Setup horizontal led count : 21 Setup vertical led count : 11 Complete LED count: 62 Absolute black threshold to 0

Send random colors does not work. Nothing light up. FAIL

Test 3. Changing Arduino code to 62 Still taking the /3 approach due to my ws2811.

Launching Adrilight 2.0.4 Setup horizontal led count : 21 Setup vertical led count : 11 Complete LED count: 62 Absolute black threshold to 0 Both lighting effects Linear and non-linear work ! Send random colors works! Aligned perfectly !

SUCCESS

Problem was (a rookie mistake) the numbers of led must be /3 everywhere !

I don't think that was the case in the previous versions of the Arduino code I modified. Maybe got lucky when I modified in the past. But at the time I didn't take any notes of my changes in the code.

I'm running it on an i5 4690k Clocked at 4.3GHz and it is using up to 20% when I'm gaming at 1080p@60fps also running it on another computer MUCH smaller CPU Celeron N3450 but with the same number of LED and it is barely working I think it has too many led for such a small CPU.

Thanks for the help. Still available for FR translation.

dinodona commented 6 years ago

Hi @morgeek so the mistake was on the arduino code itself right or is it a bug in adrilight ? You divided all by 3, in arduino code & adrilight ?

Is it possible to take a look at your config file for arduino ? I also didn't keep track of changes, and I'm not able to get my WS2811 strip to be aligned anymore...

Thx

fabsenet commented 6 years ago

@dinodona :

dinodona commented 6 years ago

My setup, for now :

Real Setup : X = 33 ( Mirror X ) / Y = 18

Arduino Code : LED Count = (2x33+2x18)

Adrilight Setup : LED Setup : X = 34 / Y = 19 ( to bypass corner limitations right ? )

EDIT @fabsenet : By dividing all numbers by 3, both on Arduino/Adrilight, it works perfectly with WS2811