Skip to content

Copy jpg via TFT_eFEX to sprite #46

@powersoft

Description

@powersoft

I try to copy a jpg file using the TFT_eFEX procedure.
The result of my code is that fex.drawJpgFile is drawing direct to the tft, instead of the command spr.pushSprite.
What is wrong with my code?

`#define FS_NO_GLOBALS
#include "FS.h"
#include <SD.h>

#ifdef ESP32
#include "SPIFFS.h" // Needed for ESP32 only
#endif

#include <SPI.h>

// https://github.com/Bodmer/TFT_eSPI
#include <TFT_eSPI.h> // Hardware-specific library
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
TFT_eSprite spr = TFT_eSprite(&tft); // Declare Sprite object "spr" with pointer to "tft" object

// https://github.com/Bodmer/TFT_eFEX
#include <TFT_eFEX.h> // Include the extension graphics functions library
TFT_eFEX fex = TFT_eFEX(&spr); // Create TFT_eFX object "efx" with pointer to "tft" object

uint8_t sdSelectPin = 25;

void setup() {
Serial.begin(250000);

tft.begin();
tft.setRotation(1); // 0 & 2 Portrait. 1 & 3 landscape
spr.createSprite(192,192);
// clear tft and sprite
spr.fillScreen(TFT_BLACK);
tft.fillScreen(TFT_BLACK);

// init SD and SPIFFS
if (!SD.begin(sdSelectPin)) Serial.println("SD Card Mount Failed");
else Serial.println("SD Card Mount");

if (!SPIFFS.begin()) Serial.println("SPIFFS initialisation failed!");
else Serial.println("SPIFFS initialisation okee!")

// draw picture to sprite spr
fex.drawJpgFile(SD, "/moon/180.jpg", 0, 0); //<========
// push sprite on LCD
spr.pushSprite(200,0); <=====
}

void loop() {
// put your main code here, to run repeatedly:
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions