Make use of LittleFS easier, add examples

Examples now divided into folders.
This commit is contained in:
Bodmer
2021-11-19 02:24:41 +00:00
parent f4c431e8f5
commit 4e7e327bdf
34 changed files with 5302 additions and 95 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,130 @@
// Example for library:
// https://github.com/Bodmer/TJpg_Decoder
// This example is for an ESP8266 or ESP32, it renders all Jpeg files
// found in LittleFS. The test images are in the sketch "data" folder
// (press Ctrl+K to see it). You can add more images of your own to
// the Data folder.
// You must upload the images to LittleFS using the ESP8266 or ESP32
// Arduino IDE Sketch Data Upload menu option.
// Include the jpeg decoder library
#include <TJpg_Decoder.h>
// Include LittleFS
#include <FS.h>
#include "LittleFS.h" // ESP32 only
// Include the TFT library https://github.com/Bodmer/TFT_eSPI
#include "SPI.h"
#include <TFT_eSPI.h> // Hardware-specific library
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
// Support funtion prototypes
bool tft_output(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t* bitmap);
void loadFile(const char *name);
//====================================================================================
// Setup
//====================================================================================
void setup()
{
Serial.begin(115200);
Serial.println("\n\n Testing TJpg_Decoder library");
// Initialise LittleFS
if (!LittleFS.begin()) {
Serial.println("LittleFS initialisation failed!");
while (1) yield(); // Stay here twiddling thumbs waiting
}
Serial.println("\r\nInitialisation done.");
// Initialise the TFT
tft.begin();
tft.setTextColor(0xFFFF, 0x0000);
tft.fillScreen(TFT_BLACK);
// The jpeg image can be scaled by a factor of 1, 2, 4, or 8
TJpgDec.setJpgScale(1);
// The byte order can be swapped (set true for TFT_eSPI)
TJpgDec.setSwapBytes(true);
// The decoder must be given the exact name of the rendering function above
TJpgDec.setCallback(tft_output);
}
//====================================================================================
// Loop
//====================================================================================
void loop()
{
File root = LittleFS.open("/");
while (File file = root.openNextFile()) {
String strname = file.name();
strname = "/" + strname;
Serial.println(file.name());
// If it is not a directory and filename ends in .jpg then load it
if (!file.isDirectory() && strname.endsWith(".jpg")) {
loadFile(strname.c_str());
}
}
}
//====================================================================================
// tft_output
//====================================================================================
// This next function will be called during decoding of the jpeg file to
// render each block to the TFT. If you use a different TFT library
// you will need to adapt this function to suit.
bool tft_output(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t* bitmap)
{
// Stop further decoding as image is running off bottom of screen
if ( y >= tft.height() ) return 0;
// This function will clip the image block rendering automatically at the TFT boundaries
tft.pushImage(x, y, w, h, bitmap);
// This might work instead if you adapt the sketch to use the Adafruit_GFX library
// tft.drawRGBBitmap(x, y, bitmap, w, h);
// Return 1 to decode next block
return 1;
}
//====================================================================================
// load_file
//====================================================================================
void loadFile(const char *name)
{
tft.fillScreen(TFT_RED);
// Time recorded for test purposes
uint32_t t = millis();
// Get the width and height in pixels of the jpeg if you wish
uint16_t w = 0, h = 0, scale;
TJpgDec.getFsJpgSize(&w, &h, name, LittleFS); // Note name preceded with "/"
tft.setRotation(w > h ? 1 : 0);
for (scale = 1; scale <= 8; scale <<= 1) {
if (w <= tft.width() * scale && h <= tft.height() * scale) break;
}
TJpgDec.setJpgScale(scale);
// Draw the image, top left at 0,0
TJpgDec.drawFsJpg(0, 0, name, LittleFS);
// How much time did rendering take
t = millis() - t;
char buf[80];
sprintf(buf, "%s %dx%d 1:%d %u ms", name, w, h, scale, t);
tft.setCursor(0, tft.height() - 8);
tft.print(buf);
Serial.println(buf);
delay(2000);
}

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,87 @@
// Example for library:
// https://github.com/Bodmer/TJpg_Decoder
// This example if for an ESP8266 or ESP32, it renders a Jpeg file
// that is stored in a LittleFS file. The test image is in the sketch
// "data" folder (press Ctrl+K to see it). You must upload the image
// to LittleFS using the ESP8266 or ESP32 Arduino IDE upload menu option.
// Include the jpeg decoder library
#include <TJpg_Decoder.h>
// Include LittleFS
#include <FS.h>
#include "LittleFS.h"
// Include the TFT library https://github.com/Bodmer/TFT_eSPI
#include "SPI.h"
#include <TFT_eSPI.h> // Hardware-specific library
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
// This next function will be called during decoding of the jpeg file to
// render each block to the TFT. If you use a different TFT library
// you will need to adapt this function to suit.
bool tft_output(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t* bitmap)
{
// Stop further decoding as image is running off bottom of screen
if ( y >= tft.height() ) return 0;
// This function will clip the image block rendering automatically at the TFT boundaries
tft.pushImage(x, y, w, h, bitmap);
// This might work instead if you adapt the sketch to use the Adafruit_GFX library
// tft.drawRGBBitmap(x, y, bitmap, w, h);
// Return 1 to decode next block
return 1;
}
void setup()
{
Serial.begin(115200);
Serial.println("\n\n Testing TJpg_Decoder library");
// Initialise LittleFS
if (!LittleFS.begin()) {
Serial.println("LittleFS initialisation failed!");
while (1) yield(); // Stay here twiddling thumbs waiting
}
Serial.println("\r\nInitialisation done.");
// Initialise the TFT
tft.begin();
tft.setTextColor(0xFFFF, 0x0000);
tft.fillScreen(TFT_BLACK);
tft.setSwapBytes(true); // We need to swap the colour bytes (endianess)
// The jpeg image can be scaled by a factor of 1, 2, 4, or 8
TJpgDec.setJpgScale(1);
// The decoder must be given the exact name of the rendering function above
TJpgDec.setCallback(tft_output);
}
void loop()
{
tft.fillScreen(TFT_RED);
// Time recorded for test purposes
uint32_t t = millis();
// Get the width and height in pixels of the jpeg if you wish
uint16_t w = 0, h = 0;
TJpgDec.getFsJpgSize(&w, &h, "/panda.jpg", LittleFS); // Note name preceded with "/"
Serial.print("Width = "); Serial.print(w); Serial.print(", height = "); Serial.println(h);
// Draw the image, top left at 0,0
TJpgDec.drawFsJpg(0, 0, "/panda.jpg", LittleFS);
// How much time did rendering take (ESP8266 80MHz 271ms, 160MHz 157ms, ESP32 SPI 120ms, 8bit parallel 105ms
t = millis() - t;
Serial.print(t); Serial.println(" ms");
// Wait before drawing again
delay(2000);
}

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,50 @@
/***************************************************************************************
** Function name: listLittleFS
** Description: Listing LittleFS files
***************************************************************************************/
void listLittleFS(void) {
Serial.println(F("\r\nListing LittleFS files:"));
static const char line[] PROGMEM = "=================================================";
Serial.println(FPSTR(line));
Serial.println(F(" File name Size"));
Serial.println(FPSTR(line));
fs::File root = LittleFS.open("/");
if (!root) {
Serial.println(F("Failed to open directory"));
return;
}
if (!root.isDirectory()) {
Serial.println(F("Not a directory"));
return;
}
fs::File file = root.openNextFile();
while (file) {
if (file.isDirectory()) {
Serial.print("DIR : ");
String fileName = file.name();
Serial.print(fileName);
} else {
String fileName = file.name();
Serial.print(" " + fileName);
// File path can be 31 characters maximum in LittleFS
int spaces = 33 - fileName.length(); // Tabulate nicely
if (spaces < 1) spaces = 1;
while (spaces--) Serial.print(" ");
String fileSize = (String) file.size();
spaces = 10 - fileSize.length(); // Tabulate nicely
if (spaces < 1) spaces = 1;
while (spaces--) Serial.print(" ");
Serial.println(fileSize + " bytes");
}
file = root.openNextFile();
}
Serial.println(FPSTR(line));
Serial.println();
delay(1000);
}

View File

@ -0,0 +1,125 @@
// Example for library:
// https://github.com/Bodmer/TJpg_Decoder
// This example is for an ESP8266 or ESP32, it fetches a Jpeg file
// from the web and saves it in a LittleFS file. You must have LittleFS
// space allocated in the IDE.
// Chenge next 2 lines to suit your WiFi network
#define WIFI_SSID "Your_SSID"
#define PASSWORD "Your password"
// Include the jpeg decoder library
#include <TJpg_Decoder.h>
// Include LittleFS
#include <FS.h>
#include "LittleFS.h"
// Include WiFi and http client
#ifdef ESP8266
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266WiFiMulti.h>
#include <WiFiClientSecureBearSSL.h>
#else
#include <WiFi.h>
#include <HTTPClient.h>
#endif
// Load tabs attached to this sketch
#include "List_LittleFS.h"
#include "Web_Fetch.h"
// Include the TFT library https://github.com/Bodmer/TFT_eSPI
#include "SPI.h"
#include <TFT_eSPI.h> // Hardware-specific library
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
// This next function will be called during decoding of the jpeg file to
// render each block to the TFT. If you use a different TFT library
// you will need to adapt this function to suit.
bool tft_output(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t* bitmap)
{
// Stop further decoding as image is running off bottom of screen
if ( y >= tft.height() ) return 0;
// This function will clip the image block rendering automatically at the TFT boundaries
tft.pushImage(x, y, w, h, bitmap);
// Return 1 to decode next block
return 1;
}
void setup()
{
Serial.begin(115200);
Serial.println("\n\n Testing TJpg_Decoder library");
// Initialise LittleFS
if (!LittleFS.begin()) {
Serial.println("LittleFS initialisation failed!");
while (1) yield(); // Stay here twiddling thumbs waiting
}
Serial.println("\r\nInitialisation done.");
// Initialise the TFT
tft.begin();
tft.fillScreen(TFT_BLACK);
// The jpeg image can be scaled by a factor of 1, 2, 4, or 8
TJpgDec.setJpgScale(1);
// The byte order can be swapped (set true for TFT_eSPI)
TJpgDec.setSwapBytes(true);
// The decoder must be given the exact name of the rendering function above
TJpgDec.setCallback(tft_output);
WiFi.begin(WIFI_SSID, PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println();
// This is for demoe purposes only so that file is fetched each time this is run
if (LittleFS.exists("/M81.jpg") == true) {
Serial.println("For test only, removing file");
LittleFS.remove("/M81.jpg");
//LittleFS.remove("/F35.jpg");
}
}
void loop()
{
// List files stored in LittleFS
listLittleFS();
// Time recorded for test purposes
uint32_t t = millis();
// Fetch the jpg file from the specified URL, examples only, from imgur
bool loaded_ok = getFile("https://i.imgur.com/C77RWcq.jpg", "/M81.jpg"); // Note name preceded with "/"
//bool loaded_ok = getFile("https://i.imgur.com/OnW2qOO.jpg", "/F35.jpg");
t = millis() - t;
if (loaded_ok) { Serial.print(t); Serial.println(" ms to download"); }
// List files stored in LittleFS, should have the file now
listLittleFS();
t = millis();
// Now draw the LittleFS file
TJpgDec.drawFsJpg(0, 0, "/M81.jpg", LittleFS);
//TJpgDec.drawFsJpg(0, 0, "/F35.jpg", LittleFS);
t = millis() - t;
Serial.print(t); Serial.println(" ms to draw to TFT");
// Wait forever
while(1) yield();
}

View File

@ -0,0 +1,84 @@
// Fetch a file from the URL given and save it in LittleFS
// Return 1 if a web fetch was needed or 0 if file already exists
bool getFile(String url, String filename) {
// If it exists then no need to fetch it
if (LittleFS.exists(filename) == true) {
Serial.println("Found " + filename);
return 0;
}
Serial.println("Downloading " + filename + " from " + url);
// Check WiFi connection
if ((WiFi.status() == WL_CONNECTED)) {
Serial.print("[HTTP] begin...\n");
#ifdef ESP8266
std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
client -> setInsecure();
HTTPClient http;
http.begin(*client, url);
#else
HTTPClient http;
// Configure server and url
http.begin(url);
#endif
Serial.print("[HTTP] GET...\n");
// Start connection and send HTTP header
int httpCode = http.GET();
if (httpCode > 0) {
fs::File f = LittleFS.open(filename, "w+");
if (!f) {
Serial.println("file open failed");
return 0;
}
// HTTP header has been send and Server response header has been handled
Serial.printf("[HTTP] GET... code: %d\n", httpCode);
// File found at server
if (httpCode == HTTP_CODE_OK) {
// Get length of document (is -1 when Server sends no Content-Length header)
int total = http.getSize();
int len = total;
// Create buffer for read
uint8_t buff[128] = { 0 };
// Get tcp stream
WiFiClient * stream = http.getStreamPtr();
// Read all data from server
while (http.connected() && (len > 0 || len == -1)) {
// Get available data size
size_t size = stream->available();
if (size) {
// Read up to 128 bytes
int c = stream->readBytes(buff, ((size > sizeof(buff)) ? sizeof(buff) : size));
// Write it to file
f.write(buff, c);
// Calculate remaining bytes
if (len > 0) {
len -= c;
}
}
yield();
}
Serial.println();
Serial.print("[HTTP] connection closed or file end.\n");
}
f.close();
}
else {
Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
}
http.end();
}
return 1; // File was fetched from web
}

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -68,6 +68,7 @@ void loop()
File root = SPIFFS.open("/");
while (File file = root.openNextFile()) {
String strname = file.name();
strname = "/" + strname;
// If it is not a directory and filename ends in .jpg then load it
if (!file.isDirectory() && strname.endsWith(".jpg")) {
loadFile(strname.c_str());
@ -80,6 +81,7 @@ void loop()
fs::Dir directory = SPIFFS.openDir("/");
while (directory.next()) {
String strname = directory.fileName();
strname = "/" + strname;
// If filename ends in .jpg then load it
if (strname.endsWith(".jpg")) {
loadFile(strname.c_str());

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,7 +1,7 @@
{
"name": "TJpg_Decoder",
"version": "1.0.1",
"version": "1.0.2",
"keywords": "jpeg, jpg, tft, display, STM32, ESP8266, ESP32",
"description": "A JPEG decoder library based on Tiny JPEG Decompressor",

View File

@ -1,5 +1,5 @@
name=TJpg_Decoder
version=1.0.1
version=1.0.3
author=Bodmer
maintainer=Bodmer
sentence=A JPEG decoder based on tjpgd

View File

@ -94,7 +94,7 @@ unsigned int TJpg_Decoder::jd_input(JDEC* jdec, uint8_t* buf, unsigned int len)
thisPtr->array_index += len;
}
#ifdef TJPGD_LOAD_SPIFFS
#ifdef TJPGD_LOAD_FFS
// Handle SPIFFS input
else if (thisPtr->jpg_source == TJPG_FS_FILE) {
// Check how many bytes are available
@ -156,7 +156,7 @@ int TJpg_Decoder::jd_output(JDEC* jdec, void* bitmap, JRECT* jrect)
}
#if defined (TJPGD_LOAD_SD_LIBRARY) || defined (TJPGD_LOAD_SPIFFS)
#if defined (TJPGD_LOAD_SD_LIBRARY) || defined (TJPGD_LOAD_FFS)
/***************************************************************************************
** Function name: drawJpg
@ -244,63 +244,41 @@ JRESULT TJpg_Decoder::getJpgSize(uint16_t *w, uint16_t *h, const String& pFilena
#endif
#ifdef TJPGD_LOAD_SPIFFS
#ifdef TJPGD_LOAD_FFS
/***************************************************************************************
** Function name: drawFsJpg
** Description: Draw a named jpg SPIFFS file at x,y (name in char array)
** Description: Draw a named jpg file at x,y (name in char array)
***************************************************************************************/
// Call specific to SPIFFS
JRESULT TJpg_Decoder::drawFsJpg(int32_t x, int32_t y, const char *pFilename) {
#ifdef USE_LITTLEFS
JRESULT TJpg_Decoder::drawFsJpg(int32_t x, int32_t y, const char *pFilename, fs::FS &fs) {
// Check if file exists
if ( !LittleFS.exists(pFilename) )
if ( !fs.exists(pFilename) )
{
Serial.println(F("Jpeg file not found"));
return JDR_INP;
}
return drawFsJpg(x, y, LittleFS.open( pFilename, "r"));
#else
// Check if file exists
if ( !SPIFFS.exists(pFilename) )
{
Serial.println(F("Jpeg file not found"));
return JDR_INP;
}
return drawFsJpg(x, y, SPIFFS.open( pFilename, "r"));
#endif
return drawFsJpg(x, y, fs.open( pFilename, "r"));
}
/***************************************************************************************
** Function name: drawFsJpg
** Description: Draw a named jpg SPIFFS file at x,y (name in String)
** Description: Draw a named jpg file at x,y (name in String)
***************************************************************************************/
JRESULT TJpg_Decoder::drawFsJpg(int32_t x, int32_t y, const String& pFilename) {
#ifdef USE_LITTLEFS
JRESULT TJpg_Decoder::drawFsJpg(int32_t x, int32_t y, const String& pFilename, fs::FS &fs) {
// Check if file exists
if ( !LittleFS.exists(pFilename) )
if ( !fs.exists(pFilename) )
{
Serial.println(F("Jpeg file not found"));
return JDR_INP;
}
return drawFsJpg(x, y, LittleFS.open( pFilename, "r"));
#else
// Check if file exists
if ( !SPIFFS.exists(pFilename) )
{
Serial.println(F("Jpeg file not found"));
return JDR_INP;
}
return drawFsJpg(x, y, SPIFFS.open( pFilename, "r"));
#endif
return drawFsJpg(x, y, fs.open( pFilename, "r"));
}
/***************************************************************************************
** Function name: drawFsJpg
** Description: Draw a jpg with opened SPIFFS file handle at x,y
** Description: Draw a jpg with opened file handle at x,y
***************************************************************************************/
JRESULT TJpg_Decoder::drawFsJpg(int32_t x, int32_t y, fs::File inFile) {
JDEC jdec;
@ -330,46 +308,25 @@ JRESULT TJpg_Decoder::drawFsJpg(int32_t x, int32_t y, fs::File inFile) {
/***************************************************************************************
** Function name: getFsJpgSize
** Description: Get width and height of a jpg saved in SPIFFS
** Description: Get width and height of a jpg saved in SPIFFS or LittleFS
***************************************************************************************/
// Call specific to SPIFFS
JRESULT TJpg_Decoder::getFsJpgSize(uint16_t *w, uint16_t *h, const char *pFilename) {
#ifdef USE_LITTLEFS
JRESULT TJpg_Decoder::getFsJpgSize(uint16_t *w, uint16_t *h, const char *pFilename, fs::FS &fs) {
// Check if file exists
if ( !LittleFS.exists(pFilename) )
if ( !fs.exists(pFilename) )
{
Serial.println(F("Jpeg file not found"));
return JDR_INP;
}
return getFsJpgSize(w, h, LittleFS.open( pFilename, "r"));
#else
// Check if file exists
if ( !SPIFFS.exists(pFilename) )
{
Serial.println(F("Jpeg file not found"));
return JDR_INP;
}
return getFsJpgSize(w, h, SPIFFS.open( pFilename, "r"));
#endif
return getFsJpgSize(w, h, fs.open( pFilename, "r"));
}
/***************************************************************************************
** Function name: getFsJpgSize
** Description: Get width and height of a jpg saved in SPIFFS
** Description: Get width and height of a jpg saved in SPIFFS or LittleFS
***************************************************************************************/
JRESULT TJpg_Decoder::getFsJpgSize(uint16_t *w, uint16_t *h, const String& pFilename) {
#ifdef USE_LITTLEFS
// Check if file exists
if ( !LittleFS.exists(pFilename) )
{
Serial.println(F("Jpeg file not found"));
return JDR_INP;
}
return getFsJpgSize(w, h, LittleFS.open( pFilename, "r"));
#else
JRESULT TJpg_Decoder::getFsJpgSize(uint16_t *w, uint16_t *h, const String& pFilename, fs::FS &fs) {
// Check if file exists
if ( !SPIFFS.exists(pFilename) )
{
@ -378,7 +335,6 @@ JRESULT TJpg_Decoder::getFsJpgSize(uint16_t *w, uint16_t *h, const String& pFile
}
return getFsJpgSize(w, h, SPIFFS.open( pFilename, "r"));
#endif
}
/***************************************************************************************

View File

@ -19,26 +19,12 @@ https://github.com/Bodmer/TJpg_Decoder
#if defined (ESP8266) || defined (ESP32)
#include <pgmspace.h>
#ifdef USE_LITTLEFS
#ifdef ESP8266
#include <LittleFS.h>
#endif
#ifdef ESP32
#include <FS.h>
//#define LittleFS LITTLEFS
#include <LittleFS.h>
#endif
#else
#define TJPGD_LOAD_SPIFFS
#define FS_NO_GLOBALS
#include <FS.h>
#ifdef ESP32
#include "SPIFFS.h" // ESP32 only
#endif
#include <FS.h>
#include <LittleFS.h>
#ifdef ESP32
#include "SPIFFS.h" // ESP32 only
#endif
#define TJPGD_LOAD_FFS
#endif
#if defined (TJPGD_LOAD_SD_LIBRARY)
@ -62,7 +48,7 @@ private:
File jpgSdFile;
#endif
#ifdef TJPGD_LOAD_SPIFFS
#ifdef TJPGD_LOAD_FFS
fs::File jpgFile;
#endif
@ -78,7 +64,7 @@ public:
void setCallback(SketchCallback sketchCallback);
#if defined (TJPGD_LOAD_SD_LIBRARY) || defined (TJPGD_LOAD_SPIFFS)
#if defined (TJPGD_LOAD_SD_LIBRARY) || defined (TJPGD_LOAD_FFS)
JRESULT drawJpg (int32_t x, int32_t y, const char *pFilename);
JRESULT drawJpg (int32_t x, int32_t y, const String& pFilename);
@ -96,13 +82,13 @@ public:
JRESULT getSdJpgSize(uint16_t *w, uint16_t *h, File inFile);
#endif
#ifdef TJPGD_LOAD_SPIFFS
JRESULT drawFsJpg (int32_t x, int32_t y, const char *pFilename);
JRESULT drawFsJpg (int32_t x, int32_t y, const String& pFilename);
#ifdef TJPGD_LOAD_FFS
JRESULT drawFsJpg (int32_t x, int32_t y, const char *pFilename, fs::FS &fs = SPIFFS);
JRESULT drawFsJpg (int32_t x, int32_t y, const String& pFilename, fs::FS &fs = SPIFFS);
JRESULT drawFsJpg (int32_t x, int32_t y, fs::File inFile);
JRESULT getFsJpgSize(uint16_t *w, uint16_t *h, const char *pFilename);
JRESULT getFsJpgSize(uint16_t *w, uint16_t *h, const String& pFilename);
JRESULT getFsJpgSize(uint16_t *w, uint16_t *h, const char *pFilename, fs::FS &fs = SPIFFS);
JRESULT getFsJpgSize(uint16_t *w, uint16_t *h, const String& pFilename, fs::FS &fs = SPIFFS);
JRESULT getFsJpgSize(uint16_t *w, uint16_t *h, fs::File inFile);
#endif

View File

@ -1,12 +1,9 @@
#if defined (ESP32) || defined (ESP8266)
#define TJPGD_LOAD_SPIFFS
#define TJPGD_LOAD_FFS
#endif
#define TJPGD_LOAD_SD_LIBRARY
#if defined (ESP6266) || defined(ESP32)
//#define USE_LITTLEFS
#endif
// Use PROGMEM for tables, saves 1K RAM when JD_TBLCLIP is set to 1 in tjpgd.h
// #define TJPG_USE_PROGMEM

View File

@ -9,7 +9,7 @@
#define JD_SZBUF 512 /* Size of stream input buffer */
#define JD_FORMAT 1 /* Output pixel format 0:RGB888 (3 BYTE/pix), 1:RGB565 (1 WORD/pix) */
#define JD_USE_SCALE 1 /* Use descaling feature for output */
#ifdef ESP32 // Table gives no speed mprovement for ESP32
#ifdef ESP32 // Table gives no speed improvement for ESP32
#define JD_TBLCLIP 1 /* Use table for saturation (might be a bit faster but increases 1K bytes of code size) */
#else
#define JD_TBLCLIP 1 /* Use table for saturation (might be a bit faster but increases 1K bytes of code size) */