mirror of
https://github.com/thelastoutpostworkshop/ESP32ManyRoundScreenTest.git
synced 2025-11-04 14:49:41 +08:00
FPS
This commit is contained in:
parent
231e81aeb7
commit
f00dd413fa
@ -37,6 +37,8 @@ AnimatedGIF gif_6;
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
|
||||
unsigned long lastFrameSpeed = 0;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -79,6 +81,7 @@ void openGif(AnimatedGIF *gif, const uint8_t *gifImage, int gifSize)
|
||||
|
||||
void playGif(AnimatedGIF *gif, int screenIndex)
|
||||
{
|
||||
|
||||
digitalWrite(CS_PINS[screenIndex], LOW); // Select the display
|
||||
tft.startWrite();
|
||||
int res = gif->playFrame(false, NULL);
|
||||
@ -88,9 +91,23 @@ void playGif(AnimatedGIF *gif, int screenIndex)
|
||||
gif->reset();
|
||||
gif->playFrame(false, NULL);
|
||||
}
|
||||
if(res == -1) {
|
||||
if (res == -1)
|
||||
{
|
||||
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 (lastFrameSpeed == 0)
|
||||
{
|
||||
lastFrameSpeed = millis();
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.printf("Screen 0 FPS=%f\n", (1000.0f / millis() - lastFrameSpeed));
|
||||
lastFrameSpeed = millis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user