🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Cardputer and drawJpgFile

    Scheduled Pinned Locked Moved PRODUCTS
    3 Posts 2 Posters 3.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F Offline
      felipeparaizo
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • W Offline
        WpVnDIrPld
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • W Offline
          WpVnDIrPld
          last edited by

          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.

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post