Cardputer and drawJpgFile
-
Hello everybody.
I have a problem that is giving me a headache. I purchased an M5Cardputer and I'm trying to get it to display a JPG image on the screen by reading from an SD card, using the M5Cardputer.Display.drawJpgFile function, but my code doesn't compile, returning this error.In file included from .pio/libdeps/m5stack-stamps3/M5GFX/src/M5GFX.h:22, from .pio/libdeps/m5stack-stamps3/M5Unified/src/M5Unified.hpp:19, from .pio/libdeps/m5stack-stamps3/M5Unified/src/M5Unified.h:5, from .pio/libdeps/m5stack-stamps3/M5Cardputer/src/M5Cardputer.h:4, from src/main.cpp:1: .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/LGFXBase.hpp: In instantiation of 'bool lgfx::v1::LGFXBase::drawJpgFile(T&, const char*, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, float, float, lgfx::v1::datum::datum_t) [with T = fs::SDFS; int32_ t = int; lgfx::v1::datum::datum_t = lgfx::v1::textdatum::textdatum_t]': src/main.cpp:19:46: required from here .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/LGFXBase.hpp:888:23: error: cannot declare variable 'file' to be of abstract type 'lgfx::v1::DataWrapperT<fs::SDFS>' DataWrapperT<T> file ( &fs ); \ ^~~~ .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/LGFXBase.hpp:895:5: note: in expansion of macro 'LGFX_FUNCTION_GENERATOR' LGFX_FUNCTION_GENERATOR(drawJpg, draw_jpg) ^~~~~~~~~~~~~~~~~~~~~~~ In file included from .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/common.hpp:20, from .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/platforms/esp32/../common.hpp:22, from .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/platforms/esp32/Bus_SPI.hpp:57, from .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/platforms/device.hpp:42, from .pio/libdeps/m5stack-stamps3/M5GFX/src/M5GFX.h:19, from .pio/libdeps/m5stack-stamps3/M5Unified/src/M5Unified.hpp:19, from .pio/libdeps/m5stack-stamps3/M5Unified/src/M5Unified.h:5, from .pio/libdeps/m5stack-stamps3/M5Cardputer/src/M5Cardputer.h:4, from src/main.cpp:1: .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../misc/DataWrapper.hpp:91:10: note: because the following virtual functions are pure within 'lgfx::v1::DataWrapperT<fs::SDFS>': struct DataWrapperT : public DataWrapper { ^~~~~~~~~~~~ .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../misc/DataWrapper.hpp:72:17: note: 'virtual int lgfx::v1::DataWrapper::read(uint8_t*, uint32_t)' virtual int read(uint8_t *buf, uint32_t len) = 0; ^~~~ .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../misc/DataWrapper.hpp:74:18: note: 'virtual void lgfx::v1::DataWrapper::skip(int32_t)' virtual void skip(int32_t offset) = 0; ^~~~ .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../misc/DataWrapper.hpp:75:18: note: 'virtual bool lgfx::v1::DataWrapper::seek(uint32_t)' virtual bool seek(uint32_t offset) = 0; ^~~~ .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../misc/DataWrapper.hpp:76:18: note: 'virtual void lgfx::v1::DataWrapper::close()' virtual void close(void) = 0; ^~~~~ .pio/libdeps/m5stack-stamps3/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../misc/DataWrapper.hpp:77:21: note: 'virtual int32_t lgfx::v1::DataWrapper::tell()' virtual int32_t tell(void) = 0; ^~~~ *** [.pio/build/m5stack-stamps3/src/main.cpp.o] Error 1
If possible, could anyone give me a code link or vidui, a tutorial that shows how to display it in a very simple way
-
Hi,
I have exactly the same problem and error message when trying to build with VS Code & Platformio having included to libs- m5stack/M5CoreS3@^1.0.0
- m5stack/M5Unified@^0.1.12
- m5stack/M5GFX@^0.1.12
Is this maybe related to https://github.com/m5stack/M5GFX/issues/72 ?
Did you find a solution to compile your code?Cheers
-
Hi,
I created an issue in the M5GFX repository. Big kudos to @lovyan03 for providing a very fast answer and solution.
For me the solution for an M5Stack CoreS3 is to add an include for <SD.h>#include <SD.h> #include <M5CoreS3.h>
See M5GFX issue #79 Error: cannot declare variable 'file' to be of abstract type 'lgfx::v1::DataWrapperTfs::SDFS' for reference.