@@ -206,7 +206,7 @@ class iUhrType {
206206
207207 virtual const bool hasSpecialWordBeen () { return false ; }
208208
209- virtual const uint16_t getFrontMatrixIndex (const uint8_t row, uint8_t col) {
209+ virtual const uint16_t getFrontMatrixIndex (uint8_t row, uint8_t col) {
210210
211211 uint8_t newColsWordMatrix = colsWordMatrix ();
212212 uint16_t numPixelsWordMatrix = rowsWordMatrix () * colsWordMatrix ();
@@ -216,10 +216,28 @@ class iUhrType {
216216 numPixelsWordMatrix = rowsWordMatrix () * newColsWordMatrix;
217217 col *= 2 ;
218218 }
219- if (row % 2 != 0 ) {
220- col = newColsWordMatrix - col - 1 ;
219+
220+ uint16_t returnValue;
221+ if (G.layoutVariant [FlipHorzVert] == false ) {
222+ if (G.layoutVariant [MeanderRows] && (row % 2 != 0 )) {
223+ col = newColsWordMatrix - col - 1 ;
224+ }
225+ returnValue = col + (row * newColsWordMatrix);
226+ if (G.layoutVariant [ExtraLedPerRow]) {
227+ returnValue += row;
228+ numPixelsWordMatrix += rowsWordMatrix () - 1 ;
229+ }
230+ } else {
231+ if (G.layoutVariant [MeanderRows] && (col % 2 == 0 )) {
232+ row = rowsWordMatrix () - 1 - row;
233+ }
234+ returnValue =
235+ row + rowsWordMatrix () * (newColsWordMatrix - 1 - col);
236+ if (G.layoutVariant [ExtraLedPerRow]) {
237+ returnValue += colsWordMatrix () - 1 - col;
238+ numPixelsWordMatrix += colsWordMatrix () - 1 ;
239+ }
221240 }
222- uint16_t returnValue = col + (row * newColsWordMatrix);
223241
224242 if (returnValue > numPixelsWordMatrix) {
225243 Serial.println (
@@ -235,6 +253,13 @@ class iUhrType {
235253 if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
236254 numPixelsWordMatrix = rowsWordMatrix () * (colsWordMatrix () * 2 - 1 );
237255 }
256+ if (G.layoutVariant [ExtraLedPerRow]) {
257+ if (G.layoutVariant [FlipHorzVert] == false ) {
258+ numPixelsWordMatrix += rowsWordMatrix () - 1 ;
259+ } else {
260+ numPixelsWordMatrix += colsWordMatrix () - 1 ;
261+ }
262+ }
238263
239264 for (uint8_t i = 0 ; i < 4 ; i++) {
240265 switch (col) {
0 commit comments