You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried this example with ESP32-8048S070. but it does not show anything other than a black screen.
I confirm that the jpg file on SD card is accessible from the sketch, but the jpegDrawCallback function never run (I uncomment the Serial.printf line).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I have tried this example with ESP32-8048S070. but it does not show anything other than a black screen.
I confirm that the jpg file on SD card is accessible from the sketch, but the jpegDrawCallback function never run (I uncomment the Serial.printf line).
Any suggestion??
`#define JPEG_FILENAME "/octocat.jpg"
#include <Arduino_GFX_Library.h>
#define TFT_BL 2
Arduino_ESP32RGBPanel *rgbpanel = new Arduino_ESP32RGBPanel(41, 40, 39, 42, 14, 21, 47, 48, 45, 9 , 46, 3, 8, 16, 1, 15, 7, 6, 5, 4, 0, 180, 30, 16, 0, 12, 13, 10);
Arduino_RGB_Display *gfx = new Arduino_RGB_Display(800, 480, rgbpanel);
#include <LittleFS.h>
#include <SD.h>
#include "JpegFunc.h"
// pixel drawing callback
static int jpegDrawCallback(JPEGDRAW *pDraw) {
//Serial.println("Draw pos = " + String(pDraw->x) + "," + String(pDraw->y) + ". size = " + String(pDraw->iWidth) + " x " + String(pDraw->iHeight));
Serial.println("jpegDrawCallback");
gfx->draw16bitBeRGBBitmap(pDraw->x, pDraw->y, pDraw->pPixels, pDraw->iWidth, pDraw->iHeight);
return 1;
}
void setup() {
Serial.begin(115200);
Serial.println("JPEG Image Viewer");
if (!gfx->begin()) {
Serial.println("gfx->begin() failed!");
}
gfx->fillScreen(BLACK);
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
Serial.println("2: !SD.begin()");
if (!SD.begin()) {
Serial.println(F("ERROR: File System Mount Failed!"));
gfx->println(F("ERROR: File System Mount Failed!"));
}
else {
File root = SD.open("/");
if(!root){
Serial.println("Failed to open directory");
return;
}
if(!root.isDirectory()){
Serial.println("Not a directory");
return;
}
File file = root.openNextFile();
while(file) {
if(file.isDirectory()) {
}
else {
if (((String)("/") + (String)file.name()) == (String)JPEG_FILENAME) {
Serial.print(" FILE: ");
Serial.print(file.name());
Serial.print(" SIZE: ");
Serial.println(file.size());
}
else {
Serial.print((((String)("/") + (String)file.name())).c_str());
Serial.println(".");
Serial.print(JPEG_FILENAME);
Serial.println(".");
}
}
file = root.openNextFile();
}
unsigned long start = millis();
jpegDraw(
JPEG_FILENAME,
jpegDrawCallback,
true /* useBigEndian /,
0 / x /,
0 / y /,
gfx->width() / widthLimit /,
gfx->height() / heightLimit */
);
Serial.printf("Time used: %lu\n", millis() - start);
}
delay(5000);
}
void loop() {
}`
Beta Was this translation helpful? Give feedback.
All reactions