Color888 function in RGBmatrixPanel not working as expected

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
3li
 
Posts: 6
Joined: Wed Jul 22, 2015 10:26 pm

Color888 function in RGBmatrixPanel not working as expected

Post by 3li »

Not too long ago I purchased a 32x32 RGB Matrix (https://www.adafruit.com/products/2026) and it works great; however, I seem to be completely incapable of using the Color888 properly. To give an example, if I want to go from a black/blank to red screen using Color444 I would use:

Code: Select all

for(int i=0; i<16; i++) {
  matrix.fillScreen( matrix.Color444( i, 0, 0));
  delay(100);
}
This works as expected. It slowly turns on the red channel in 16 steps. If I apply the same idea to Color888 using the for loop:

Code: Select all

for(int i=0; i<256; i++) {
  matrix.fillScreen( matrix.Color888( i, 0, 0));
  delay(100);
}
I do not get the same type of 256 step turn on one would expect. Instead, the panel only updates when i%8 == 0 and is at a max brightness when i%24 == 0 (i.e. the panel cycles from off to max 64 times over the loop) treating red as a 4 bit color. I run into a similar issue if I do the loop with only turning green or blue on. The green seems to update every i%4 == 0 with a max brightness at i%60 == 0, while the blue updates every i%16 == 0 with a max brightness at i==240. This behavior is very far from what I expected, assuming Color888 was designed to take in a 8 bit value for each channel like its 4 bit counterpart Color444.

Can anyone offer some insight as to why Color888 behaves this way (if it is indeed supposed to)? I can obviously get by with Color444, but I'd really like to understand whats going on here to get the most out of the panel. Cheers!

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Color888 function in RGBmatrixPanel not working as expec

Post by pburgess »

Looks like a math goof in the Color888 function. Just fixed it, please fetch latest from Github or Arduino library manager.

User avatar
3li
 
Posts: 6
Joined: Wed Jul 22, 2015 10:26 pm

Re: Color888 function in RGBmatrixPanel not working as expec

Post by 3li »

Thanks!

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”