Update LedMatrix.cpp

I have a few MAX7219 modules that use a different column assignment and the 2 already implemented orientations did not work for me.

After these changes DisplayRotate 1 and DisplayRotate 3 commands do what they are supposed to do.
This commit is contained in:
CCTweaker 2022-07-08 11:42:55 +03:00 committed by GitHub
parent 324e4e1084
commit 5aadcc7b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -330,7 +330,22 @@ void LedMatrix::refresh()
}
else // ORIENTATION_TURN_RIGHT || ORIENTATION_TURN_LEFT
{
// not implemented yet
col = addr % modulesPerRow;
pixelRow = (addr / modulesPerRow) * 8 + ledRow;
bufPos = pixelRow * modulesPerRow + col;
if (moduleOrientation == ORIENTATION_TURN_RIGHT)
{
// ORIENTATION_TURN_RIGHT
deviceDataBuff[addr] = buffer[bufPos];
deviceRow = ledRow;
}
else
{
// ORIENTATION_TURN_LEFT
deviceDataBuff[maxDevices - 1 - addr] = revereBitorder(buffer[bufPos]);
deviceRow = 7 - ledRow; // upside down
}
}
}
setRow_allDevices(deviceRow, deviceDataBuff);