mirror of
https://github.com/thelastoutpostworkshop/ESP32ManyRoundScreenTest.git
synced 2025-09-26 23:09:22 +08:00
currentScreenIndex
This commit is contained in:
parent
a89fe7ba3e
commit
815dd72095
@ -27,6 +27,7 @@
|
|||||||
const int NUM_DISPLAYS = 6;
|
const int NUM_DISPLAYS = 6;
|
||||||
// Add more CS pins if you have more displays, each display must have a dedicated pin
|
// Add more CS pins if you have more displays, each display must have a dedicated pin
|
||||||
const int CS_PINS[NUM_DISPLAYS] = {19, 22, 21, 32, 33, 26};
|
const int CS_PINS[NUM_DISPLAYS] = {19, 22, 21, 32, 33, 26};
|
||||||
|
int currentScreenIndex = 0;
|
||||||
|
|
||||||
AnimatedGIF gif_1;
|
AnimatedGIF gif_1;
|
||||||
AnimatedGIF gif_2;
|
AnimatedGIF gif_2;
|
||||||
@ -81,9 +82,7 @@ void openGif(AnimatedGIF *gif, const uint8_t *gifImage, int gifSize)
|
|||||||
|
|
||||||
void playGif(AnimatedGIF *gif, int screenIndex)
|
void playGif(AnimatedGIF *gif, int screenIndex)
|
||||||
{
|
{
|
||||||
|
currentScreenIndex = screenIndex;
|
||||||
digitalWrite(CS_PINS[screenIndex], LOW); // Select the display
|
|
||||||
tft.startWrite();
|
|
||||||
int res = gif->playFrame(false, NULL);
|
int res = gif->playFrame(false, NULL);
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
{
|
{
|
||||||
@ -95,8 +94,7 @@ void playGif(AnimatedGIF *gif, int screenIndex)
|
|||||||
{
|
{
|
||||||
Serial.printf("Gif Error = %d on screen %d\n", gif->getLastError(), screenIndex);
|
Serial.printf("Gif Error = %d on screen %d\n", gif->getLastError(), screenIndex);
|
||||||
}
|
}
|
||||||
tft.endWrite();
|
|
||||||
digitalWrite(CS_PINS[screenIndex], HIGH); // Deselect the display
|
|
||||||
|
|
||||||
if (screenIndex == 0)
|
if (screenIndex == 0)
|
||||||
{
|
{
|
||||||
|
@ -14,6 +14,9 @@ bool dmaBuf = 0;
|
|||||||
// Draw a line of image directly on the LCD
|
// Draw a line of image directly on the LCD
|
||||||
void GIFDraw(GIFDRAW *pDraw)
|
void GIFDraw(GIFDRAW *pDraw)
|
||||||
{
|
{
|
||||||
|
digitalWrite(CS_PINS[currentScreenIndex], LOW); // Select the display
|
||||||
|
tft.startWrite();
|
||||||
|
|
||||||
uint8_t *s;
|
uint8_t *s;
|
||||||
uint16_t *d, *usPalette;
|
uint16_t *d, *usPalette;
|
||||||
int x, y, iWidth, iCount;
|
int x, y, iWidth, iCount;
|
||||||
@ -128,4 +131,6 @@ void GIFDraw(GIFDRAW *pDraw)
|
|||||||
iWidth -= iCount;
|
iWidth -= iCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tft.endWrite();
|
||||||
|
digitalWrite(CS_PINS[currentScreenIndex], HIGH); // Deselect the display
|
||||||
} /* GIFDraw() */
|
} /* GIFDraw() */
|
||||||
|
Loading…
Reference in New Issue
Block a user