lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.19k stars 209 forks source link

Enable filesystem support for native builds #536

Closed MitchBradley closed 8 months ago

MitchBradley commented 8 months ago

Will this be propagated to M5GFX at some future time?

MitchBradley commented 8 months ago

Some context of what I am trying to accomplish - we have developed a pendant controller for use with the FluidNC CNC firmware. The pendant normally runs on an M5 Dial as shown IMG_6860 but it will also run on a PC for development and testing. It uses M5Unified for most of the IO image

lovyan03 commented 8 months ago

Thank you for the pull request. Sorry, this is a flaw that I overlooked. However, FileWrapper will be deprecated and merged with DataWrapperT. Please wait for a while as we will make a fix to replace this.

lovyan03 commented 8 months ago

BTW, M5GFX and LovyanGFX are basically scheduled to be updated synchronously, but recently M5GFX has sometimes been updated faster. Since LovyanGFX has many target devices, it takes time to confirm operation, and updates may not be provided immediately.

lovyan03 commented 8 months ago

I checked and found that the current development branch's implementation already works with drawJpgFile and loadFont, even without using your pull request.

I used the following program.

#include <stdio.h>

#define LGFX_AUTODETECT
#include <LGFX_AUTODETECT.hpp>
LGFX gfx;
void setup(void) {
  gfx.init();
  gfx.drawJpgFile("r:/lovyan03.jpg", 0, 0);
  gfx.loadFont("r:/font.vlw");
  gfx.drawString("Hello", 100, 100);
}

void loop(void) {}

image

Can you show me the code you used for validation?

MitchBradley commented 8 months ago

I don't have a simple validation test; rather I used a fairly extensive app that can be compiled to run either on M5Dial or Windows. It uses M5Unified for Button_Class, Speaker_Class, and Touch_Class so I can emulate M5Dial in Windows. I can make a small test to illustrate the function of the filesystem stuff.

I just now tried using m5stack/M5GFX#develop to see if that works. It cannot display image files unless I apply the patch to lgfx_filesystem_support.hpp .

I also tried substituting LovyanGFX#develop for the graphics, but ran into conflicts with the M5GFX package that M5Unified depends on. Breaking that dependency looks like it could be difficult.

lovyan03 commented 8 months ago

M5Unified also works fine.

#include <stdio.h>

#include <M5Unified.h>

void setup(void) {
  M5.begin();
  M5.Display.drawJpgFile("r:/lovyan03.jpg", 0, 0);
  M5.Display.loadFont("r:/font.vlw");
  M5.Display.drawString("Hello", 100, 100);
}

void loop(void) { M5.delay(1000); }

image

lovyan03 commented 8 months ago

What matters is the include order. It should work if stdio.h is included before M5GFX.

lovyan03 commented 8 months ago

By the way, although the contents of M5GFX is LovyanGFX, we have no intention of supporting M5Unified or M5GFX in the LovyanGFX repository. If this topic continues any longer, please close this pull request and open an issue in the M5Unified or M5GFX repositories.

If you want to debug with LovyanGFX, you can continue the topic here, but if you want to debug with M5Unified, end the discussion here and move over there.

MitchBradley commented 8 months ago

My program works with stdio.h before M5Unified. I completely missed the template specialization of DataWrapper when trying to understand how the code works. Thanks for the help.

mhaberler commented 8 months ago

... I completely missed the template specialization of DataWrapper when trying to understand how the code works.

me too.. very useful.