Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LittleFS error occurs suddenly #94

Open
sastles-com opened this issue May 20, 2024 · 3 comments
Open

LittleFS error occurs suddenly #94

sastles-com opened this issue May 20, 2024 · 3 comments

Comments

@sastles-com
Copy link

on my M5Dial,

Using LittleFS,
Suddenly this error occurs.

.pio/libdeps/esp32/M5GFX/src/lgfx/v1/LGFXBase.hpp:920:23: error: cannot declare variable 'file' to be of abstract type 'lgfx::v1::DataWrapperT<fs::LittleFSFS>'
before then, this program normally runs.

@sastles-com
Copy link
Author

In file included from .pio/libdeps/esp32/M5GFX/src/M5GFX.h:22,
from .pio/libdeps/esp32/M5Unified/src/M5Unified.hpp:19,
from .pio/libdeps/esp32/M5Unified/src/M5Unified.h:5,
from src/main.cpp:2:
.pio/libdeps/esp32/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::LittleFSFS; int32_t = int; lgfx::v1::datum::datum_t = lgfx::v1::textdatum::textdatum_t]':
include/image.h:37:74: required from here
.pio/libdeps/esp32/M5GFX/src/lgfx/v1/LGFXBase.hpp:920:23: error: cannot declare variable 'file' to be of abstract type 'lgfx::v1::DataWrapperT[fs::LittleFSFS](javascript:void(0))'

It has been found that drawJpgFile is the problem.
Executing the following line of code:
M5Canvas canvas.drawJpgFile(LittleFS, "/image.jpg", 0, 0);
results in the error mentioned above.

@sastles-com
Copy link
Author

In file included from .pio/libdeps/esp32/M5GFX/src/M5GFX.h:22,
from .pio/libdeps/esp32/M5Unified/src/M5Unified.hpp:19,
from .pio/libdeps/esp32/M5Unified/src/M5Unified.h:5,
from src/main.cpp:2:
.pio/libdeps/esp32/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::LittleFSFS; int32_t = int; lgfx::v1::datum::datum_t = lgfx::v1::textdatum::textdatum_t]':
include/image.h:47:83: required from here
.pio/libdeps/esp32/M5GFX/src/lgfx/v1/LGFXBase.hpp:920:23: error: cannot declare variable 'file' to be of abstract type 'lgfx::v1::DataWrapperT[fs::LittleFSFS](javascript:void(0))'
DataWrapperT<T> file ( &fs ); \
^~~~
.pio/libdeps/esp32/M5GFX/src/lgfx/v1/LGFXBase.hpp:927:5: note: in expansion of macro 'LGFX_FUNCTION_GENERATOR'
LGFX_FUNCTION_GENERATOR(drawJpg, draw_jpg)

@lovyan03
Copy link
Collaborator

Hello, @sastles-com
I don't have your source code so I can only guess, but have you changed the order of your includes?
If you use LittleFS with M5GFXorM5Unified, you need to include the LittleFS headers first.

// include before M5Unified.h
#include <LittleFS.h>

// include after LittleFS.h
#include <M5Unified.h>

void setup(void) {
  M5.begin();
  LittleFS.begin();
  M5.Display.drawJpgFile(LittleFS, "/filename.jpg", 0, 0);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants