From 5aadcc7b36b6798cc9099ed825394e4cbaf256f9 Mon Sep 17 00:00:00 2001 From: CCTweaker <19865794+cctweaker@users.noreply.github.com> Date: Fri, 8 Jul 2022 11:42:55 +0300 Subject: [PATCH] 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. --- lib/lib_display/LedControl/src/LedMatrix.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/lib_display/LedControl/src/LedMatrix.cpp b/lib/lib_display/LedControl/src/LedMatrix.cpp index fb23fbc26..12ce04e1d 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.cpp +++ b/lib/lib_display/LedControl/src/LedMatrix.cpp @@ -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);