Chore: commit modifications
This commit is contained in:
parent
95dccdcc38
commit
2e1436f32f
1 changed files with 205 additions and 203 deletions
|
@ -159,7 +159,6 @@ private:
|
|||
int16_t virtualResX; ///< Display width as combination of panels
|
||||
int16_t virtualResY; ///< Display height as combination of panels
|
||||
|
||||
|
||||
int16_t _virtualResX; ///< Display width as modified by current rotation
|
||||
int16_t _virtualResY; ///< Display height as modified by current rotation
|
||||
|
||||
|
@ -201,11 +200,12 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t virt_x, int16_t virt_
|
|||
#endif
|
||||
|
||||
// Do we want to rotate?
|
||||
switch (_rotate) {
|
||||
case 0: //no rotation, do nothing
|
||||
switch (_rotate)
|
||||
{
|
||||
case 0: // no rotation, do nothing
|
||||
break;
|
||||
|
||||
case (1): //90 degree rotation
|
||||
case (1): // 90 degree rotation
|
||||
{
|
||||
int16_t temp_x = virt_x;
|
||||
virt_x = virt_y;
|
||||
|
@ -213,14 +213,14 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t virt_x, int16_t virt_
|
|||
break;
|
||||
}
|
||||
|
||||
case (2): //180 rotation
|
||||
case (2): // 180 rotation
|
||||
{
|
||||
virt_x = virtualResX - 1 - virt_x;
|
||||
virt_y = virtualResY - 1 - virt_y;
|
||||
break;
|
||||
}
|
||||
|
||||
case (3): //270 rotation
|
||||
case (3): // 270 rotation
|
||||
{
|
||||
int16_t temp_x = virt_x;
|
||||
virt_x = virtualResX - 1 - virt_y;
|
||||
|
@ -359,12 +359,12 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t virt_x, int16_t virt_
|
|||
// Q: 1 row!? Why?
|
||||
// A: In cases people are only using virtual matrix panel for panels of non-standard scan rates.
|
||||
default:
|
||||
coords.x = virt_x; coords.y = virt_y;
|
||||
coords.x = virt_x;
|
||||
coords.y = virt_y;
|
||||
break;
|
||||
|
||||
} // end switch
|
||||
|
||||
|
||||
/* START: Pixel remapping AGAIN to convert TWO parallel scanline output that the
|
||||
* the underlying hardware library is designed for (because
|
||||
* there's only 2 x RGB pins... and convert this to 1/4 or something
|
||||
|
@ -376,9 +376,11 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t virt_x, int16_t virt_
|
|||
if (panel_scan_rate == FOUR_SCAN_64PX_HIGH)
|
||||
{
|
||||
// https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA/issues/345#issuecomment-1510401192
|
||||
if ((virt_y & 8) != ((virt_y & 16) >> 1)) { virt_y = (virt_y & 0b11000) ^ 0b11000 + (virt_y & 0b11100111); }
|
||||
if ((virt_y & 8) != ((virt_y & 16) >> 1))
|
||||
{
|
||||
virt_y = ((virt_y & 0b11000) ^ 0b11000) + (virt_y & 0b11100111);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Convert Real World 'VirtualMatrixPanel' co-ordinates (i.e. Real World pixel you're looking at
|
||||
on the panel or chain of panels, per the chaining configuration) to a 1/8 panels
|
||||
|
@ -434,9 +436,11 @@ inline void VirtualMatrixPanel::drawPixel(int16_t x, int16_t y, uint16_t color)
|
|||
int16_t scaled_x_start_pos = x * _scale_factor;
|
||||
int16_t scaled_y_start_pos = y * _scale_factor;
|
||||
|
||||
for (int16_t x = 0; x < _scale_factor; x++) {
|
||||
for (int16_t y = 0; y < _scale_factor; y++) {
|
||||
VirtualCoords result = this->getCoords(scaled_x_start_pos+x, scaled_y_start_pos+y);
|
||||
for (int16_t x = 0; x < _scale_factor; x++)
|
||||
{
|
||||
for (int16_t y = 0; y < _scale_factor; y++)
|
||||
{
|
||||
VirtualCoords result = this->getCoords(scaled_x_start_pos + x, scaled_y_start_pos + y);
|
||||
// Serial.printf("Requested virtual x,y coord (%d, %d), got phyical chain coord of (%d,%d)\n", x,y, coords.x, coords.y);
|
||||
this->display->drawPixel(result.x, result.y, color);
|
||||
}
|
||||
|
@ -482,7 +486,7 @@ inline void VirtualMatrixPanel::fillScreen(CRGB color)
|
|||
|
||||
inline void VirtualMatrixPanel::setRotation(uint8_t rotate)
|
||||
{
|
||||
if(rotate < 4 && rotate >= 0)
|
||||
if (rotate < 4 && rotate >= 0)
|
||||
_rotate = rotate;
|
||||
|
||||
// Change the _width and _height variables used by the underlying adafruit gfx library.
|
||||
|
@ -491,7 +495,8 @@ inline void VirtualMatrixPanel::setRotation(uint8_t rotate)
|
|||
int8_t rotation;
|
||||
#endif
|
||||
rotation = (rotate & 3);
|
||||
switch (rotation) {
|
||||
switch (rotation)
|
||||
{
|
||||
case 0: // nothing
|
||||
case 2: // 180
|
||||
_virtualResX = virtualResX;
|
||||
|
@ -513,8 +518,6 @@ inline void VirtualMatrixPanel::setRotation(uint8_t rotate)
|
|||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
inline void VirtualMatrixPanel::setPhysicalPanelScanRate(PANEL_SCAN_RATE rate)
|
||||
|
@ -524,9 +527,8 @@ inline void VirtualMatrixPanel::setPhysicalPanelScanRate(PANEL_SCAN_RATE rate)
|
|||
|
||||
inline void VirtualMatrixPanel::setZoomFactor(int scale)
|
||||
{
|
||||
if(scale < 5 && scale > 0)
|
||||
if (scale < 5 && scale > 0)
|
||||
_scale_factor = scale;
|
||||
|
||||
}
|
||||
|
||||
#ifndef NO_GFX
|
||||
|
|
Loading…
Add table
Reference in a new issue