Flipping the display

I copied the SmartMatrix Shield using discrete components and using the Smart Matrix library (demo program). All is working now on my 16x32 high-intensity display, thanks in large part to Louis Beaudoin who helped decipher the use of a flip flop on the V4 shield.
My problem now, and this appeared before with Adafruit GFX graphics, is the text display. Mine is “backwards” because of the origin I selected as row 0, column 0. (top right instead of top left). Eg the word HELLO, starts at far right, with an H, a backward E, L,L, and O (which of course looks the same).
This is not a Rotation fix…it’s more a right-to-left flip. I recall having to go into the .h file for RGBMatrixPanel (Adafruit) to change some variable…not sure where to find it, if it’s available,in Smart Matrix libraries.
Anyone know?

That feature isn’t available in SmartMatrix Library as it’s not needed for HUB75 panels. Have a look at the MultiRowRefreshMapping example and the documentation in the wiki though, you can likely make a custom mapping to reverse the orientation of your display

Thanks Louis. I’ll work on that. It isn’t a priority at this time, more interested in bitmaps so I’m working with your bitmap example. So far so good.
If I look at the scrolling text with a mirror, it comes out okay…

Louis, I’m trying to run the MultiRowRefreshMapping example on my commercial “Adafruit” HUB75 16z32 LED panel, per suggestion above. I don’t understand quite what is going on. Whether I have MOD4Scan or MOD2Scan (W=128, H=4 per comments), this is what happens:
Row0 lights 0-31 in Red. 30 seconds later,
Row1 lights 0-31 in Yellow. 30 seconds later,
Row 8 lights 0-31 in Magenta , 30 seconds later,
Row 9 lights 0-31 in Cyan. 30 seconds or so later, the sequence repeats. What does this mean?
Since my display is 1:8, I expected TWO rows to light, eg Row 0 and Row8, then Row1 and Row2, etc. What am I missing? I want to work this out before I get to my own display which also HUB75, but different x,y origin

The instructions were designed for panels that actually wrap to display on multiple physical rows per color channel and per row address. (HUB75 panels have two color channels.) Your panel only uses one physical row per color channel and per row address. I think your mapping will be:

{
    {0, 31, -32},
    {0, 0, 0}   // last entry is all zeros
};

which should fill the pixels starting from column 31 and working backwards across 32 pixels. Hope that helps.

You should use SM_PANELTYPE_HUB75_16ROW_MOD8SCAN scan for reverse engineering your panel, because you have a MOD8 panel.

Yeah, I figured that when I read a line in the Mode_Map_Testing section where it stated that line for “common 16x32 panels”. So I really don’t have to do a “Reverse_Engineering” since all 32 of my pixels light up in sequence? I just have to change the SmartMatrix library ( to custom…)? Makes some sense.

I think I understand what your saying. My HUB75 panel has R1, G1,B1 which represents ONE color channel, and R2,G2,B2 that is the other color channel. When the address for Row 0 is activated, so is Row8 since they are wired together, Row1&Row9, etc. Row0 gets R1,G1,B1 data on it’s columns and Row 8 gets R2,G2,B2 data on it’s columns.
I took a video of the Adafruit panel and can see the Rows that are connected together.
I just modified a computer power supply and STUPIDLY put 12 volts to my 5 volt panel, blowing it up…so I’ll have to wait a couple days (for a new one) before continuing on.

Me again. Where do I put those parameters you provided? I went through the entire document on how to configure your own panels but I’m confused. do I just add those two lines to the first section of MatrixPanelMaps.cpp?
And in MatrixCommonHub75.h: is there any reason to change anything? My panel is already defined in there: SM_PanelType_Hub75_16Row_Mod8Scan. Or do I give it the name I gave in MatrixPanelMaps.cpp?
And for all the Convert_to… definitions, do I have to touch these at all? (If I do, where do I put in the data? Where the ? is?
And finally, You say to “Open PanelMaps.h” and “Add a new case for your panelType, returning your new panelMap”… What does this mean? Do I keep the case that is there and just add my own with the name I gave it above?
Can you give me examples of these procedures?

Here’s a commit where I added a new panel mapping, it shows all the places that need new lines added:

You’ll need a new name as you’re making a new custom mapping, add “_reversed” to the end or something

Thanks, just what I needed. Working on it.

My bad…I had copied PanelMaps.h over PanelMaps.cpp. I was wondering why the two were the same. This is all resulting from the two libraries I have that are causing confusion, SmartMatrix, and SmartMatrix-4.0.2. I do not have a SmartMatrixV3, only those two. When I rename SmartMatrix to SmartMatrixOld and recompile, I get many errors since the sketch is looking for SmartMatrix.
I select the library with "#include <SmartMatrix.h>. What should it be? I notice SmartMatrix.h is in BOTH libraries. How can the sketch differentiate?

Now when I recompile I get a slew of other errors. (I had to rename SmartMatrixOld back to SmartMatrix). If I can get the libraries sorted out, maybe I’ll have a better idea where the errors are coming from. These are the first few errors:

             from D:\ArduinoSketch\TESTS\TestPatternTeensyRectangles\TestPatternTeensyRectangles.ino:10:

D:\ArduinoSketch\libraries\SmartMatrix-4.0.2\src/MatrixTeensy3Hub75Calc_Impl.h: In instantiation of ‘static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::loadMatrixBuffers48(SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::rowDataStruct*, unsigned char, RGB_TEMP) [with RGB_TEMP = rgb24; int refreshDepth = 24; int matrixWidth = 32; int matrixHeight = 16; unsigned char panelType = 10u; long unsigned int optionFlags = 0ul; SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::rowDataStruct = SmartMatrixHub75Refresh<24, 32, 16, 10u, 0ul>::rowDataStruct]’:
D:\ArduinoSketch\libraries\SmartMatrix-4.0.2\src/MatrixTeensy3Hub75Calc_Impl.h:570:28: required from ‘static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::loadMatrixBuffers(unsigned char) [with int refreshDepth = 24; int matrixWidth = 32; int matrixHeight = 16; unsigned char panelType = 10u; long unsigned int optionFlags = 0ul]’
D:\ArduinoSketch\libraries\SmartMatrix-4.0.2\src/MatrixTeensy3Hub75Calc_Impl.h:152:113:

Share your MatrixPanelMaps.h file (ideally with a GitHub Gist) and I’ll see if I can spot it

Okay…I deleted SmartMatrix-4.0.2, after reading that the (3) and (4) libraries were NOW NAMED SmartMatrix, which is what I had installed. All my edits to the MatrixCommonHub75.h file had to be redone because I had put them in the 4.0.2 library. I was confused, because even though it was Using SmartMatrix library, the pragma message was stating it was 4.0.3!!
Now when I compile I get errors as before, that refer to MatrixTeensy3Hub75Calc_Impl.h I didn’t touch this file but assume it may be something I did wrong in MatrixCommonHub75.h.
I tried to put the error file on Gist but didn’t know how to save it before exiting, so I will put it here:

indent preformatted text by 4 spacesArduino: 1.8.13 (Windows 10), TD: 1.53, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"

In file included from D:\ArduinoSketch\TESTS\TestPatternTeensyRectangles\TestPatternTeensyRectangles.ino:5:0:

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixHardware_Teensy3_ShieldV4.h:29:17: note: #pragma message: MatrixHardware: SmartLED Shield for Teensy 3 (V4)

#pragma message “MatrixHardware: SmartLED Shield for Teensy 3 (V4)”

             ^

In file included from D:\ArduinoSketch\TESTS\TestPatternTeensyRectangles\TestPatternTeensyRectangles.ino:7:0:

D:\ArduinoSketch\libraries\SmartMatrix\src/SmartMatrix.h:40:21: note: #pragma message: SmartMatrix Library version 4.000.003

pragma message “SmartMatrix Library version 4.000.003”

                 ^

TestPatternTeensyRectangles: In function ‘void loop()’:

TestPatternTeensyRectangles:152: warning: variable ‘white’ set but not used

            rgb24 white ={0xff, 0xff, 0xff};

                  ^

In file included from D:\ArduinoSketch\libraries\SmartMatrix\src/SmartMatrix.h:213:0,

             from D:\ArduinoSketch\TESTS\TestPatternTeensyRectangles\TestPatternTeensyRectangles.ino:7:

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h: In instantiation of ‘static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::loadMatrixBuffers48(SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::rowDataStruct*, unsigned char, RGB_TEMP) [with RGB_TEMP = rgb24; int refreshDepth = 24; int matrixWidth = 32; int matrixHeight = 16; unsigned char panelType = 10u; long unsigned int optionFlags = 0ul; SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::rowDataStruct = SmartMatrixHub75Refresh<24, 32, 16, 10u, 0ul>::rowDataStruct]’:

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h:570:28: required from ‘static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::loadMatrixBuffers(unsigned char) [with int refreshDepth = 24; int matrixWidth = 32; int matrixHeight = 16; unsigned char panelType = 10u; long unsigned int optionFlags = 0ul]’

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h:152:113: required from ‘static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::matrixCalculations(bool) [with int refreshDepth = 24; int matrixWidth = 32; int matrixHeight = 16; unsigned char panelType = 10u; long unsigned int optionFlags = 0ul]’

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h:256:124: required from ‘void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin() [with int refreshDepth = 24; int matrixWidth = 32; int matrixHeight = 16; unsigned char panelType = 10u; long unsigned int optionFlags = 0ul]’

D:\ArduinoSketch\TESTS\TestPatternTeensyRectangles\TestPatternTeensyRectangles.ino:56:16: required from here

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h:353:49: error: storage size of ‘tempRow0’ isn’t constant

 static RGB_TEMP tempRow0[numPixelsPerTempRow];

                                             ^

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h:354:49: error: storage size of ‘tempRow1’ isn’t constant

 static RGB_TEMP tempRow1[numPixelsPerTempRow];

                                             ^

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h: In instantiation of ‘static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::loadMatrixBuffers48(SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::rowDataStruct*, unsigned char, RGB_TEMP) [with RGB_TEMP = rgb48; int refreshDepth = 24; int matrixWidth = 32; int matrixHeight = 16; unsigned char panelType = 10u; long unsigned int optionFlags = 0ul; SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::rowDataStruct = SmartMatrixHub75Refresh<24, 32, 16, 10u, 0ul>::rowDataStruct]’:

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h:572:28: required from ‘static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::loadMatrixBuffers(unsigned char) [with int refreshDepth = 24; int matrixWidth = 32; int matrixHeight = 16; unsigned char panelType = 10u; long unsigned int optionFlags = 0ul]’

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h:152:113: required from ‘static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::matrixCalculations(bool) [with int refreshDepth = 24; int matrixWidth = 32; int matrixHeight = 16; unsigned char panelType = 10u; long unsigned int optionFlags = 0ul]’

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h:256:124: required from ‘void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin() [with int refreshDepth = 24; int matrixWidth = 32; int matrixHeight = 16; unsigned char panelType = 10u; long unsigned int optionFlags = 0ul]’

D:\ArduinoSketch\TESTS\TestPatternTeensyRectangles\TestPatternTeensyRectangles.ino:56:16: required from here

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h:353:49: error: storage size of ‘tempRow0’ isn’t constant

 static RGB_TEMP tempRow0[numPixelsPerTempRow];

                                             ^

D:\ArduinoSketch\libraries\SmartMatrix\src/MatrixTeensy3Hub75Calc_Impl.h:354:49: error: storage size of ‘tempRow1’ isn’t constant

 static RGB_TEMP tempRow1[numPixelsPerTempRow];

                                             ^

Multiple libraries were found for “SPI.h”

Used: D:\ArduinoSketch\libraries\SPI

Not used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI

Not used: D:\ArduinoSketch\libraries\SPITeensy

Not used: D:\ArduinoSketch\libraries\SPI-master

Error compiling for board Teensy 3.2 / 3.1.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

I fixed it!! No more errors, clean build. I talked myself into revisiting MatrixCommonHub75.h
I had been doing a cut and paste of this line: (x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN_FEMod ? 16:0) |
because I was afraid of making a typo for the next entries. For …Offset, and Scanmod, the value should be 8, not 16.

On a roll, now I’ll see if it actually WORKS! I’ll start a new thread if it doesn’t.