simracer-cz / iFlag

Race marshalling light board for iRacing.com motorsport simulation.
GNU General Public License v2.0
63 stars 23 forks source link

ws2812 #3

Open marco0904 opened 4 years ago

marco0904 commented 4 years ago

Hello, since in Italy it is not possible to find the rgb shields, I was wondering if it was possible to make everything work with an 8x8 matrix with ws2812 led. Thanks in advance for your reply and the time taken.

dmberrycom commented 4 years ago

It's possible if you modify the Arduino source. I've taken a look at the source and have been able to modify it to use the ws2812led via the FastLed library. I don't have an 8x8 matrix lying around so doing my testing on a continuous strip at the moment. looks too be working as expected but would like to test with one of the 8x8 matrix displays before sharing. Have one coming in the post this week so should be able to share an update in a few days.

marco0904 commented 4 years ago

I have an 8x8 matrix and I have tried but I have problems completing the modification, surely because I'm not very good with programming, so I'm waiting for your update. In the meantime, if I can help you, just ask.

dmberrycom commented 4 years ago

I've got an 8x8 neopixel matrix now so I am beginning to work through this.

Status/Work & Challenges, I've found to date are as follows.

WS2812 Support - Mostly working

Here I've used the FastLed library to support the WS2812 display. This also has the added benefit that you can also build out support for other display types that are supported by FastLed with only minor changes.

Pixel Coordinates - Complete

The colorduino uses an x,y co-ordinate system for absolute pixel positioning, with the 8x8 neopixel they are referenced as a set of sequential pixel numbers 0-63 (8x8). Code for handling this is complete

Order of pixels in row reversed - Complete

The sequence of pixels in each row is the opposite to colorduino, so each row is displayed backward resulting in a mirror image. After a fair bit of head scratching and silly mistakes I've resolved that today.

Animations/Conditions with multiple frames - Still working through.

At the moment any status that has an animation is only displaying one of the frames, the colorduino library has a framebuffer of some description implemented in the library so I need to figure out how I can translate that into a system that works with FastLed

On a side note there is also a "decolorduinization" branch that is changing the pixel drawing functions to be separate to the colorduino drawing methods, which I think is a nicer approach and probably easier to add other display support to, I've also converted the core functionality to use this build aswell but have a problem with that branch were the odd pixel has the the wrong colour/state

If I can sort the animations of the master version or the corrupt data on the "decolorduinization" then it should be fully working.

Borkuz commented 3 years ago

Any news on the port to use the ws2812?

simracer-cz commented 3 years ago

@dmberrycom Excited to see your initiative! Please let me know if there's anything you would need from me and which is not sufficiently covered by the documentation. I'll do my best to assist you :)

jupiispa commented 2 years ago

Any updates on the ws2812 port @dmberrycom and @simracer-cz? Is there an active branch somewhere to test?

dmberrycom commented 2 years ago

From my side, I never got the animations working correctly, but also around the same time I moved over to developing for embedded processors based on the ARM architecture focusing on the STM32 platform.

If at all useful I still have the source from the modifications I had done back in October 2020 and could publish them as-is If someone has a desire to take this forward. Just let me know and I'll be happy to push it.