Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address up to 256 LED per channel #2

Open
wants to merge 5 commits into
base: pro
Choose a base branch
from
Open

Conversation

areid-van
Copy link

Not sure if this is of interest to you, but I've adapted the pro firmware to support up to 256 LED on a single strip. I added two features to accomplish this:

  1. a new report that allows sending data for 128 LED (384 bytes). This strains the memory on the t85, so I also tried to save a few bytes of memory elsewhere
  2. a new mode that uses only 12 bits per LED (16 levels for each color) for WS2812. This doubles the amount of LED you can address for each report mode.

I've also adapted the python api to support these features and can submit a PR if you like. The updated firmware should be backwards compatible with old API code since it only adds new modes. I tested this on a BS-pro that I built as well as a Flex I bought from you.

128 LED push the memory limits of the t85, so have removed a few globals
where possible
This allows the device to address twice as many LED. Useful for large number
of LED where the device would otherwise run out of memory
@@ -48,6 +48,8 @@ void ws2812_setleds_pin(struct cRGB *ledarray, uint16_t number_of_leds,uint8_t p

void ws2812_sendarray (uint8_t *array,uint16_t length);
void ws2812_sendarray_mask(uint8_t *array,uint16_t length, uint8_t pinmask);
void ws2812_sendarraylow_mask(uint8_t *array,uint16_t length, uint8_t pinmask);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple variants of the sendarray function to send low and high 4 bits

main.cpp Outdated
'\x96', '\x81', '\x01', // REPORT_COUNT (385)
'\x09', '\x00', // USAGE (Undefined)
'\xb2', '\x02', '\x01', // FEATURE (Data,Var,Abs,Buf)
'\xc0' // END_COLLECTION
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes c+11 warnings and adds report_id 10

@arvydas
Copy link
Owner

arvydas commented Sep 8, 2017

Thanks for submitting this! I will give it a go and run tests on my rig. What OS have you been testing this on?

@areid-van
Copy link
Author

I've mainly been testing on a Raspberry PI using the Python API. I can send a PR with my changes to the Python API. I've got a WS2812 strip with 300 LED and it's controlling up to 256 nicely. For the 12 bit mode I've only tried it with reports 6-10. Not sure it will work well with report 5.

I did find that compiling the firmware using the avr-gcc (4.8.1) that is available in the raspbian repos doesn't work the best. It works, but the device seems a bit flaky and I see some errors from the driver under dmesg. I get good results compiling with the avr-gcc (4.9.2) from the Atmel website on Windows or Linux. I get that same flaky behavior with the unmodified pro firmware too, so it seems related to the compiler version and not my changes.

Report 20 allows setting the repeat on the frame. Default is one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants