Hi,
I hope you can help me with a problem I seem to be having with a p3 64x64 1/32 panel. I’m using a Teensy 4.1 with the SmartMatrix v5 shield, and I’m using PlatformIO with version 4.0.3 of the SmartMatrix library.
The panel worked straightaway with this configuration and I was able to draw on it very easily. It seems very stable and works almost as expected. The only issue I have is with the colour rendering. It seems that the MSB of all three RGB values is ignored, and bit 6 (of an 8-bit colour channel) effectively becomes the MSB instead. The effect is that at a value of 128, the colour turns off.
Here’s a demonstration of it:
The code that generated this is:
#include <MatrixHardware_Teensy4_ShieldV5.h> // SmartLED Shield for Teensy 4 (V5)
#include <SmartMatrix.h>
#define COLOR_DEPTH 24 // Choose the color depth used for storing pixels in the layers: 24 or 48 (24 is good for most sketches - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24)
const uint16_t kMatrixWidth = 64; // Set to the width of your display, must be a multiple of 8
const uint16_t kMatrixHeight = 64; // Set to the height of your display
const uint8_t kRefreshDepth = 36; // Tradeoff of color quality vs refresh rate, max brightness, and RAM usage. 36 is typically good, drop down to 24 if you need to. On Teensy, multiples of 3, up to 48: 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48. On ESP32: 24, 36, 48
const uint8_t kDmaBufferRows = 4; // known working: 2-4, use 2 to save RAM, more to keep from dropping frames and automatically lowering refresh rate. (This isn't used on ESP32, leave as default)
const uint8_t kPanelType = SMARTMATRIX_HUB75_64ROW_MOD32SCAN; // Choose the configuration that matches your panels. See more details in MatrixCommonHub75.h and the docs: https://github.com/pixelmatix/SmartMatrix/wiki
const uint32_t kMatrixOptions = (SM_HUB75_OPTIONS_C_SHAPE_STACKING | SM_HUB75_OPTIONS_BOTTOM_TO_TOP_STACKING); //(SM_HUB75_OPTIONS_NONE); // see docs for options: https://github.com/pixelmatix/SmartMatrix/wiki
const uint8_t kIndexedLayerOptions = (SM_INDEXED_OPTIONS_NONE);
const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);
const uint8_t kScrollingLayerOptions = (SM_SCROLLING_OPTIONS_NONE);
const rotationDegrees kRotation = rotation0;
const int defaultBrightness = (100*255)/100; // full (100%) brightness
//const int defaultBrightness = (15*255)/100; // dim: 15% brightness
const int defaultScrollOffset = 6;
const rgb24 defaultBackgroundColor = {0x00, 0, 0};
// Teensy 4.0 has the LED on pin 13
const int ledPin = 13;
SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions);
void setup() {
// initialize the digital pin as an output.
pinMode(ledPin, OUTPUT);
Serial.begin(115200);
matrix.addLayer(&backgroundLayer);
matrix.begin();
matrix.setBrightness(defaultBrightness);
matrix.setRotation(kRotation);
backgroundLayer.enableColorCorrection(true);
// clear screen
backgroundLayer.fillScreen(defaultBackgroundColor);
backgroundLayer.swapBuffers();
}
void loop() {
EVERY_N_MILLIS(50)
{
for(uint8_t i=0;i<kMatrixWidth;i++)
{
uint8_t v=i<<2;
backgroundLayer.drawPixel(2,i,{v,0,0});
backgroundLayer.drawPixel(10,i,{0,v,0});
backgroundLayer.drawPixel(20,i,{0,0,v});
}
backgroundLayer.swapBuffers(false);
}
}
I’ve tried using 48-bit colour depth, switching colour correction on/off (without colour correction, the gradient resets half way along the row rather than as shown in the picture), increased refresh depth to 48, reduced DmaBufferRows to 2, and none of these made a difference. I’ve been investigating inside the library to see if there was anything amiss, but I can’t seem to find a reason for this behaviour. I’ve also tried changing kMatrixOptions
to SM_HUB75_OPTIONS_NONE
, and that doesn’t help either (I will be using 4 panels connected together in the final project).
Does anyone have any thoughts on what might be causing this?
Thanks for looking.
welshcoder