Skip to content

P8 32x16 #763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ghost opened this issue Mar 1, 2025 · 9 comments
Open

P8 32x16 #763

ghost opened this issue Mar 1, 2025 · 9 comments

Comments

@ghost
Copy link

ghost commented Mar 1, 2025

dear mr
i need help about this panel

here is my code

#include "ESP32-HUB75-MatrixPanel-I2S-DMA.h"
#include "ESP32-VirtualMatrixPanel-I2S-DMA.h"

// Panel configuration
#define PANEL_RES_X 32 // Number of pixels wide of each INDIVIDUAL panel module.
#define PANEL_RES_Y 16 // Number of pixels tall of each INDIVIDUAL panel module.

#define NUM_ROWS 1 // Number of rows of chained INDIVIDUAL PANELS
#define NUM_COLS 1 // Number of INDIVIDUAL PANELS per ROW

#define SERPENT true
#define TOPDOWN false

// placeholder for the matrix object
MatrixPanel_I2S_DMA *dma_display = nullptr;

// placeholder for the virtual display object
VirtualMatrixPanel *FourScanPanel = nullptr;

void setup() {
delay(250);

Serial.begin(115200);
Serial.println(""); Serial.println(""); Serial.println("");
Serial.println("");
Serial.println("* 1/8 Scan Panel Demonstration *");
Serial.println("
");

HUB75_I2S_CFG mxconfig(
PANEL_RES_X*2, // DO NOT CHANGE THIS
PANEL_RES_Y/2, // DO NOT CHANGE THIS
NUM_ROWS * NUM_COLS // DO NOT CHANGE THIS
);

mxconfig.clkphase = false; // Change this if you see pixels showing up shifted wrongly by one column the left or right.

//mxconfig.driver = HUB75_I2S_CFG::FM6126A; // in case that we use panels based on FM6126A chip, we can set it here before creating MatrixPanel_I2S_DMA object

// Create our matrix object
dma_display = new MatrixPanel_I2S_DMA(mxconfig);

// Adjust default brightness to about 75%
dma_display->setBrightness8(96); // range is 0-255, 0 - 0%, 255 - 100%

// Allocate memory and start DMA display
if (!dma_display->begin())
Serial.println("****** !KABOOM! I2S memory allocation failed ***********");

dma_display->clearScreen();
delay(500);

// Create FourScanPanel object based on our newly created dma_display object
FourScanPanel = new VirtualMatrixPanel((*dma_display), NUM_ROWS, NUM_COLS, PANEL_RES_X, PANEL_RES_Y);

// THE IMPORTANT BIT BELOW!
FourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_16PX_HIGH);

}

void loop() {

for (int i = 0; i < FourScanPanel->height(); i++)
{
for (int j = 0; j < FourScanPanel->width(); j++)
{
FourScanPanel->drawPixel(j, i, FourScanPanel->color565(255, 0, 0));
delay(30);
}
}

delay(2000);
dma_display->clearScreen();

} // end loop

WhatsApp.Video.2025-03-01.at.11.24.22.mp4
@board707
Copy link
Contributor

board707 commented Mar 1, 2025

Please add the line

FourScanPanel->setPixelBase(8);

after

// THE IMPORTANT BIT BELOW!
FourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_16PX_HIGH);

and show the video

Note: this is not a solution, just another test.

@ghost
Copy link
Author

ghost commented Mar 1, 2025

C:\Users\LENOVO\Downloads\fix\fix\fix.ino:57:16: error: 'class VirtualMatrixPanel' has no member named 'setPixelBase'
FourScanPanel->setPixelBase(8);
^~~~~~~~~~~~

exit status 1

Compilation error: 'class VirtualMatrixPanel' has no member named 'setPixelBase'

sorry some error

@board707
Copy link
Contributor

board707 commented Mar 1, 2025

You need to update library to the last commit.
Then use an example VirtualMatrixPanel

@ghost
Copy link
Author

ghost commented Mar 2, 2025

sorry sir i really stumble using new library
can we try old library ?

@ghost
Copy link
Author

ghost commented Mar 2, 2025

/* Use a custom Virtual Display class to re-map co-ordinates such that they draw
correctly on a 32x16 1/4 Scan panel (or chain of such panels).
*/
#include "ESP32-VirtualMatrixPanel-I2S-DMA.h"

/* ================================================== */
// Define custom class derived from VirtualMatrixPanel
class EightPxBasePanel : public VirtualMatrixPanel
{
public:
using VirtualMatrixPanel::VirtualMatrixPanel; // inherit VirtualMatrixPanel's constructor(s)

protected:

VirtualCoords getCoords(int16_t x, int16_t y);  // custom getCoords() method for specific pixel mapping

};

inline VirtualCoords EightPxBasePanel ::getCoords(int16_t x, int16_t y) {

coords = VirtualMatrixPanel::getCoords(x, y); // first call base class method to update coords for chaining approach

if ( coords.x == -1 || coords.y == -1 ) { // Co-ordinates go from 0 to X-1 remember! width() and height() are out of range!
return coords;
}
uint8_t pxbase = 8; // pixel base
if ((coords.y & 4) == 0)
{
coords.x = (coords.x / pxbase) * 2 * pxbase + pxbase + 7 - (coords.x & 0x7); // 1st, 3rd 'block' of 8 rows of pixels, offset by panel width in DMA buffer
}
else
{
coords.x += (coords.x / pxbase) * pxbase; // 2nd, 4th 'block' of 8 rows of pixels, offset by panel width in DMA buffer
}

coords.y = (coords.y >> 3) * 4 + (coords.y & 0b00000011);

return coords;
}

/* ================================================== */
// Panel configuration
#define PANEL_RES_X 32 // Number of pixels wide of each INDIVIDUAL panel module.
#define PANEL_RES_Y 16 // Number of pixels tall of each INDIVIDUAL panel module.

#define NUM_ROWS 1 // Number of rows of chained INDIVIDUAL PANELS
#define NUM_COLS 1 // Number of INDIVIDUAL PANELS per ROW

// ^^^ NOTE: DEFAULT EXAMPLE SETUP IS FOR A CHAIN OF TWO x 1/8 SCAN PANELS

// Change this to your needs, for details on VirtualPanel pls read the PDF!
#define SERPENT true
#define TOPDOWN false
#define VIRTUAL_MATRIX_CHAIN_TYPE CHAIN_TOP_RIGHT_DOWN

// placeholder for the matrix object
MatrixPanel_I2S_DMA *dma_display = nullptr;

// placeholder for the virtual display object
EightPxBasePanel *FourScanPanel = nullptr;

/******************************************************************************
Setup!
******************************************************************************/
void setup()
{
delay(250);

Serial.begin(115200);
Serial.println(""); Serial.println(""); Serial.println("");
Serial.println("");
Serial.println("* 1/8 Scan Panel Demonstration *");
Serial.println("
");

/*
// 62x32 1/8 Scan Panels don't have a D and E pin!

   HUB75_I2S_CFG::i2s_pins _pins = {
    R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN,
    A_PIN, B_PIN, C_PIN, D_PIN, E_PIN,
    LAT_PIN, OE_PIN, CLK_PIN
   };

*/
HUB75_I2S_CFG mxconfig(
PANEL_RES_X * 2, // DO NOT CHANGE THIS
PANEL_RES_Y / 2, // DO NOT CHANGE THIS
NUM_ROWS * NUM_COLS // DO NOT CHANGE THIS
//,_pins // Uncomment to enable custom pins
);

mxconfig.clkphase = false; // Change this if you see pixels showing up shifted wrongly by one column the left or right.

//mxconfig.driver = HUB75_I2S_CFG::FM6126A; // in case that we use panels based on FM6126A chip, we can set it here before creating MatrixPanel_I2S_DMA object

// OK, now we can create our matrix object
dma_display = new MatrixPanel_I2S_DMA(mxconfig);

// let's adjust default brightness to about 75%
dma_display->setBrightness8(40); // range is 0-255, 0 - 0%, 255 - 100%

// Allocate memory and start DMA display
if ( not dma_display->begin() )
Serial.println("****** !KABOOM! I2S memory allocation failed ***********");

dma_display->clearScreen();
delay(500);

// create FourScanPanellay object based on our newly created dma_display object
FourScanPanel = new EightPxBasePanel ((*dma_display), NUM_ROWS, NUM_COLS, PANEL_RES_X, PANEL_RES_Y, VIRTUAL_MATRIX_CHAIN_TYPE);

// THE IMPORTANT BIT BELOW!
// FOUR_SCAN_16PX_HIGH
// FOUR_SCAN_32PX_HIGH
// **** You don't need to set PhysicalPanelScanRate when use your own virtual panel class
//FourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_16PX_HIGH);
}

// Test the pixel mapping - fill the panel pixel by pixel
void loop() {

for (int i = 0; i < FourScanPanel->height(); i++)
{
for (int j = 0; j < FourScanPanel->width(); j++)
{

  FourScanPanel->drawPixel(j, i, FourScanPanel->color565(255, 0, 0));
  delay(30);
}

}

delay(2000);
dma_display->clearScreen();

} // end loop

i'm still using this and here we what i gote

WhatsApp.Video.2025-03-02.at.12.03.20.mp4

@ghost
Copy link
Author

ghost commented Mar 5, 2025

dear mr @board707, I'm sorry can you help me ?

@board707
Copy link
Contributor

board707 commented Mar 5, 2025

Hi
Please show the video after changing the getCoords( method like below:

inline VirtualCoords EightPxBasePanel ::getCoords(int16_t x, int16_t y) {

coords = VirtualMatrixPanel::getCoords(x, y); // first call base class method to update coords for chaining approach

if ( coords.x == -1 || coords.y == -1 ) { // Co-ordinates go from 0 to X-1 remember! width() and height() are out of range!
return coords;
}
uint8_t pxbase = 8; // pixel base
if ((coords.y & 4) == 0)
{
coords.x += (((coords.x / pxbase) + 1) * pxbase);
}
else
{
coords.x += (coords.x / pxbase) * pxbase; // 2nd, 4th 'block' of 8 rows of pixels, offset by panel width in DMA buffer
}

coords.y = (coords.y >> 3) * 4 + (coords.y & 0b00000011);

return coords;
}

@ghost
Copy link
Author

ghost commented Mar 6, 2025

here is video

WhatsApp.Video.2025-03-06.at.09.39.59.mp4

@board707
Copy link
Contributor

board707 commented Mar 7, 2025

Thank you for the video.
Unfortunately, the picture on the video is not what I expected. It seems that the first portion of pixels somehow jumps to the previous line. It shouldn't be like that.
Try changing the parameters of the pulse duration on the matrix, which ones exactly - I can't tell you, here it's better for you to contact the author, @mrcodetastic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant