moononournation / arduino_gfx Goto Github PK
View Code? Open in Web Editor NEWArduino GFX developing for various color displays and various data bus interfaces
License: Other
Arduino GFX developing for various color displays and various data bus interfaces
License: Other
Hi, sorry to bother you with a general programming question but this repository has the only example of using the esp_jpg_decode function that I could find. I want to use it with with jpgs from a camera feed and can't work out how to read them for the decoder. I understand it reads and processes in chunks but I'm not sure how to make it work. My code is below. Any ideas?
esp_err_t camera_capture()
{
camera_fb_t * fb = esp_camera_fb_get();
esp_jpg_decode(fb->len, JPG_SCALE_NONE, camera_buffer_reader, array_writer, fb);
esp_camera_fb_return(fb);
}
static size_t camera_buffer_reader(void *arg, size_t index, uint8_t *buf, size_t len)
{
camera_fb_t * fb = (camera_fb_t *)arg;
buf = (uint8_t *)fb->buf;
Serial.println(fb->len);
return fb->len;
}
static bool array_writer(void *arg, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t *data)
{
Serial.println("writer");
if (data)
{
Serial.printf("%d, %d, %d, %d\n", x, y, w, h);
}
feedLoopWDT();
return true; // Continue to decompression
}
@per1234 reply on this issue:
I see that files were added after the v1.0.7 tag where the path differs only in case:
cd73084#For example:
https://github.com/moononournation/Arduino_GFX/blob/v1.0.8/examples/ImgViewerAnimatedGIF/Data/ezgif.com-optimize.gif
https://github.com/moononournation/Arduino_GFX/blob/v1.0.8/examples/ImgViewerAnimatedGIF/data/ezgif.com-optimize.gif
(Data vs. data)While this is perfectly fine on a case sensitive file system like Linux, the two files can not coexist on case insensitive file systems like Windows or macOS. I suspect this is the cause of the silent failure of the Library Manager installation of the 1.0.8 and 1.0.9 versions of the library.
People who have upgraded the firmware on their WIO's RTL8720 need to change the include on line 17 to the eRPC library:
from:
to
#include "rpcWifi.h"
If rotation parameter inputted outside 0-3, should use rotation instead.
hello, I have some issues when I tried to displayed an image like PNG or GIF, I'm using an NodeMCU ESP8266, also I used sketch data upload but doesn't work, I'm hope you have some solution for this.
Regards.
By default the screen is unstable and shows artifacts with solid color on ESP32.
Fixed by editing Arduino_SSD1331.cpp
Change Original:
_bus->sendCommand(SSD1331_PRECHARGEA); // 0x8A
_bus->sendCommand(0x64);
_bus->sendCommand(SSD1331_PRECHARGEB); // 0x8B
_bus->sendCommand(0x78);
_bus->sendCommand(SSD1331_PRECHARGEA); // 0x8C
_bus->sendCommand(0x64);
_bus->sendCommand(SSD1331_PRECHARGELEVEL); // 0xBB
_bus->sendCommand(0x3A);
_bus->sendCommand(SSD1331_VCOMH); // 0xBE
_bus->sendCommand(0x3E);
To Updated:
_bus->sendCommand(SSD1331_PRECHARGEA); // 0x8A
_bus->sendCommand(0x0);
_bus->sendCommand(SSD1331_PRECHARGEB); // 0x8B
_bus->sendCommand(0x0);
_bus->sendCommand(SSD1331_PRECHARGEC); // 0x8C
_bus->sendCommand(0x0);
_bus->sendCommand(SSD1331_PRECHARGELEVEL); // 0xBB
_bus->sendCommand(0x0);
_bus->sendCommand(SSD1331_VCOMH); // 0xBE
_bus->sendCommand(0x0);
Examples like ImgViewerAnimatedGIF have a directory called Data that contains files to upload to SPIFFS or FatFS.
The expected name is 'data', not 'Data', so it doesn't work on linux unless I rename it.
It probably works on windows because windows does not care about uppercase and lowercase. On MacOS I'm not sure, I guess it works too?
That said, if you could rename as 'data', it will work on unix too :)
If you'd like me to send you a pull request, let me know, will be happy to
Thanks
Currently full PDQgraphicstest cannot fit in Arduino Nano program flash. 4 tests skipped:
This issue keeps remind me of a size tuning on this.
Hi there,
I am seeing no activity on any of the GPIO I'm using to drive my ST7735S TFT. Here is my declaration:
//Begin TFT
#include <Arduino_GFX_Library.h>
//Override pin locations from Arduino_GFX_Library.h
//NOTE: pin numbers follow P0.xx convention, not Arduino Dx convention.
//#define TFT_SCK 14 //SCK
//#define TFT_MOSI 13 //MO
//#define TFT_MISO 15 //MI
#define TFT_CS 3 //A5
#define TFT_DC 2 //A4
#define TFT_RST 28 //A3
#define TFT_BL 30 //A2
//Arduino_DataBus *bus = new Arduino_NRFXSPI(TFT_DC, TFT_CS, TFT_SCK, TFT_MOSI, TFT_MISO);
Arduino_DataBus *bus = create_default_Arduino_DataBus();
Arduino_GFX *gfx = new Arduino_ST7735(bus, TFT_RST, 0 /* rotation */, false /* IPS */);
//End TFT
Here is my TFT init in setup():
//TFT
gfx->begin();
gfx->fillScreen(BLACK);
#ifdef TFT_BL
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
#endif
gfx->setCursor(10, 10);
gfx->setTextColor(RED);
gfx->println("Hello World!");
I reviewed the pin mapping for the nRF52840 Feather board by Adafruit, and it seems correct.
Can you help me understand why the GPIO are not operating? Thanks!
Hi, this is awesome. After seeing your video I ordered the same screen (I needed a circle screen for one project). Today I received it but i cant compile the code I always end up with an error... could you please share your exact code for this display? thanks :)
here is the error:
multiple libraries were found for "Arduino_HWSPI.h"
In file included from C:\Users\nicol\OneDrive\Documents\Arduino\libraries\Arduino_GFX-master\Arduino_ESP32SPI_DMA.cpp:7:0:
Used: C:\Users\nicol\OneDrive\Documents\Arduino\libraries\Arduino_GFX-master
C:\Users\nicol\OneDrive\Documents\Arduino\libraries\Arduino_GFX-master\Arduino_ESP32SPI_DMA.h:19:19: fatal error: unity.h: No such file or directory
compilation terminated.
exit status 1
Hi, I got errors when I using this library
error: 'I2S_NUM_1' was not declared in this scope <<(error from Arduino_ESP32I2S8.h)
error: 'VSPI' was not declared in this scope <<(error from Arduino_ESP32SPI.h)
Hello, thank you for the amazing work!
I’m trying to use a Seeeduino XIAO with a GC9A01 round display.
It works via swSPI and hwSPI with the library you can find at this link:
https://www.buydisplay.com/arduino/ER-TFTM1.28-1_Arduino_Tutorial.zip
But I would like to use your library, it works with swSPI, but doesn’t work wit hwSPI.
There is a way to implement the hwSPI functionality? Or something to edit to make it working?
Thank you very much.
Christian
Hi there,
I'm using a 80x160px ST7735 based TFT. My hard-coded offsets/extents are here:
#define TFT_OFFSETX 26
#define TFT_OFFSETY 1
#define ST7735_TFTWIDTH 80
#define ST7735_TFTHEIGHT 160
I draw a rectangle here:
gfx->fillScreen(BLACK);
gfx->drawRect(gOffsetX+TFT_OFFSETX, gOffsetY+TFT_OFFSETY, ST7735_TFTWIDTH, ST7735_TFTHEIGHT, GREEN);
This is the result:
I noticed there are additional offset arguments in the GFX library:
Arduino_ST7735(
Arduino_DataBus *bus, int8_t rst = -1, uint8_t r = 0,
bool ips = false, int16_t w = ST7735_TFTWIDTH, int16_t h = ST7735_TFTHEIGHT,
uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0,
bool bgr = true);
Can you help me understand why the last row contains random data when displayed?
Thanks!
Hello,
I have two displays, which Your library supports the chipsets, but the displays wont to work with it...
I tried it with Your example.
first display: chipset ILI9486 (works with TFT_eSPI)
second display: chipset ST7796S (not supported by TFT_eSPI)
Can You check why the display not works please?
Thank You!
Hans
Hey,
I need to use the write pin of my ILI9486 device to be above 31. This pin is shared with the touch panel and since ESP32 cannot use ADC2 together with WiFi, I have to use ADC1 (pins above 31). I have found a way to allow the use of this pin by tweaking the file "\databus\Arduino_ESP32PAR8.cpp" as follows (starting from line 331 in this file):
INLINE void Arduino_ESP32PAR8::WRITE(uint8_t d)
{
uint32_t mask = xset_mask[d];
*dataPortClr = dataClrMask;
*dataPortSet = mask;
#if !defined(SET_DATA_AND_WR_AT_THE_SAME_TIME)
*wrPortClr = wrPinMask; // <---- ADD THIS LINE!!!
*wrPortSet = wrPinMask;
#endif // !defined(SET_DATA_AND_WR_AT_THE_SAME_TIME)
}
Is there any chance for you to implement this change in a future release of your code?
Thank you
I cant even compile example sketches. I tried compile for any esp boards and any example sketch and always i get the same error.
C:\Users\User\Documents\Arduino\libraries\GFX_Library_for_Arduino\src\Arduino_TFT.cpp: In member function 'virtual void Arduino_TFT::drawChar(int16_t, int16_t, unsigned char, uint16_t, uint16_t)':
C:\Users\User\Documents\Arduino\libraries\GFX_Library_for_Arduino\src\Arduino_TFT.cpp:1010:1: error: a15 cannot be used in asm here
}
^
C:\Users\User\Documents\Arduino\libraries\GFX_Library_for_Arduino\src\Arduino_TFT.cpp:1010:1: error: a15 cannot be used in asm here
exit status 1
Compilation error for board Wemos D1 mini.
I used:
IDE: Arduino IDE 1.8.13
Board: Wemos D1 mini ESP 8266
Display: GC9A01
Hello,
Do you have a user guide available. I need to do things like rotate the display and my colors are inverted. I am sure they are easy corrections but I do not know the commands to do it, Can you please help.
got:
In member function 'virtual void Arduino_TFT::drawChar(int16_t, int16_t, unsigned char, uint16_t, uint16_t)':
...\libraries\Arduino_GFX-master\src\Arduino_TFT.cpp:1125:1: error: a15 cannot be used in asm here
}
^
by using https://github.com/moononournation/Arduino_GFXmoononournation one of the Arduino_GFX_Library examples
Google find plenty issues related to that error. However I didn't have the expertise to apply the proposals.
Hi,
Is there a way to draw a 24bit BMP file easily?
Something like https://github.com/adafruit/Adafruit_ImageReader
I know there is a JPEG converter code. what about str8 BMP?
Thank you!
Hi, does your library support off-screen canvases?
In other words, can I do this:
// In global declarations:
GFXcanvas1 canvas(128, 32); // 128x32 pixel canvas
// In code later:
canvas.println("I like cake");
tft.drawBitmap(x, y, canvas, 128, 32, foreground, background); // Copy to screen
as it is done in Adafruit version of GFX?
I am interested in implementing blinking-free redraws...
https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts
Thanks!
Great work supporting 3-wire SPI! I searched high and low before finding your lib. Thanks!
when changing the font from built-in to a custom GFXfont , no text is printed !
Hello again,
First, when you get a chance, try to recompile all your code with all warnings enabled in the arduino IDE (preferences/settings/compiler warnings/all)
this one is a compilation error on ESP32:
GifClass.h:417:59: error: narrowing conversion of 'key' from 'int32_t {aka int}' to 'uint8_t {aka unsigned char}' inside { } [-Werror=narrowing]
table->entries[key] = (gd_Entry){1, 0xFFF, key};
I can change line 417 to say
for (uint8_t key = 0; key < (1 << key_size); key++)
but I'm not too sure if key_size is smaller than 8, it looks like maybe not.
line 503, I see:
gif_buf_read(gif->fd, &byte, 1);
key_size = (int16_t)byte;
If it's a byte, why use (int16_t), shouldn't this be uint8_t ?
Later down, I see
clear = 1 << key_size;
with
uint16_t key, clear, stop;
So key is actually 16bits instead of 8. and 1 << key_size likely is 16 bits and not 8 bits.
So maybe suffix in gd_Entry should be 16 bits?
typedef struct gd_Entry
{
int32_t length;
uint16_t prefix;
uint8_t suffix;
} gd_Entry;
This is an never closing issue
I am trying to compile the example for the BlackPill board and am getting this error
error: 'class Arduino_GC9A01' has no member named 'writeIndexedPixels'
121 | gfx->writeIndexedPixels(buf, gif->palette->colors, s);
Looking through the source code it looks like there are some conditional functions if certain boards are defined.
writeIndexedPixels seems to belong to only ESP32.
I really appreciate the work that's gone into this library the examples worked amazingly well on my ESP32; now I'm hoping to build something using the STM32411CEU.
Looking forward to your advice
Thanks
If you use the arduino environment, can you go to file/preferences/compiler warning: all
Then, build the animatedgifs example (I used ESP32 as a target) and you get those errors. They may not be coding errors, but they are enough of a potential problem that the compiler treats them as such:
/home/merlin/arduino/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -DESP_PLATFORM "-DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\"" -DHAVE_CONFIG_H -I/home/merlin/arduino/hardware/espressif/esp32/tools/sdk/include/esp-face -I/home/merlin/arduino/hardware/espressif/esp32/tools/sdk/include/fb_gfx -std=gnu++11 -fno-exceptions -Os -g3 -Wpointer-arith -fexceptions -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wall -Werror=all -Wextra -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -fno-rtti -MMD -c -DF_CPU=240000000L -DARDUINO=10812 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32_DEV\"" "-DARDUINO_VARIANT=\"esp32\"" -DESP32 -DCORE_DEBUG_LEVEL=5 -I/home/merlin/arduino/hardware/espressif/esp32/cores/esp32 -I/home/merlin/arduino/hardware/espressif/esp32/variants/esp32 -I/home/merlin/Arduino/libraries/Arduino_GFX/src -I/home/merlin/arduino/hardware/espressif/esp32/libraries/SPIFFS/src -I/home/merlin/arduino/hardware/espressif/esp32/libraries/FS/src -I/home/merlin/arduino/hardware/espressif/esp32/libraries/SPI/src /tmp/arduino_build_753374/sketch/ImgViewerAnimatedGIF.ino.cpp -o /tmp/arduino_build_753374/sketch/ImgViewerAnimatedGIF.ino.cpp.o
In file included from /home/merlin/arduino/libraries/Arduino_GFX/examples/ImgViewerAnimatedGIF/ImgViewerAnimatedGIF.ino:248:0:
/tmp/arduino_build_753374/sketch/GifClass.h: In member function 'void GifClass::read_plain_text_ext(gd_GIF*)':
/tmp/arduino_build_753374/sketch/GifClass.h:282:19: warning: unused variable 'sub_block' [-Wunused-variable]
off_t sub_block;
^
/tmp/arduino_build_753374/sketch/GifClass.h: In member function 'void GifClass::reset_table(gd_Table*, int32_t)':
GifClass.h:418:59: error: narrowing conversion of 'key' from 'int32_t {aka int}' to 'uint8_t {aka unsigned char}' inside { } [-Werror=narrowing]
table->entries[key] = (gd_Entry){1, 0xFFF, key};
^
/tmp/arduino_build_753374/sketch/GifClass.h: In member function 'int32_t GifClass::read_image_data(gd_GIF*, int, uint8_t*)':
/tmp/arduino_build_753374/sketch/GifClass.h:502:15: warning: unused variable 'start' [-Wunused-variable]
off_t start, end;
^
/tmp/arduino_build_753374/sketch/GifClass.h:502:22: warning: unused variable 'end' [-Wunused-variable]
off_t start, end;
^
/tmp/arduino_build_753374/sketch/GifClass.h: In member function 'void GifClass::render_frame_rect(gd_GIF*, uint16_t*, uint8_t*)':
/tmp/arduino_build_753374/sketch/GifClass.h:627:25: warning: unused variable 'color' [-Wunused-variable]
uint8_t index, *color;
^
/tmp/arduino_build_753374/sketch/GifClass.h: In member function 'int32_t GifClass::read_image_data(gd_GIF*, int, uint8_t*)':
GifClass.h:436:77: error: 'entry.gd_Entry::suffix' may be used uninitialized in this function [-Werror=maybe-uninitialized]
table->entries[table->nentries] = (gd_Entry){length, prefix, suffix};
^
/tmp/arduino_build_753374/sketch/GifClass.h:501:18: note: 'entry.gd_Entry::suffix' was declared here
gd_Entry entry;
^
GifClass.h:536:32: error: 'str_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
ret = add_entry(gif->table, str_len + 1, key, entry.suffix);
^
GifClass.h:533:18: error: 'table_is_full' may be used uninitialized in this function [-Werror=maybe-uninitialized]
else if (!table_is_full)
^
cc1plus: some warnings being treated as errors
Hi guys,
during migrating Arduino_ESP32PAR8.cpp to stm32 I have noticed, that after
Arduino_GFX/src/databus/Arduino_ESP32PAR8.cpp
Line 345 in 6cfcb47
follows
Arduino_GFX/src/databus/Arduino_ESP32PAR8.cpp
Line 350 in 6cfcb47
looks like it sets twice instead of set and then clear.
To whom it may concern,
unfortunately I do not have ESP32 + "lcd par8+wr" shield to test it
please check it.
Best regards,
Vladyslav
First, I wanted to give a huge thumbs up for your excellent work on this library. The amount of MCU support, types of communication support and number of TFTs, is really good, thank you.
Is it possible to explain in the documentation for regular SPI (not 4bit or 8/9bit), the difference between:
Are they not all supposed to be using hardware SPI if I use VSPI pins? Yet, they are not all the same speed, ESP32SPI_DMA is definitely faster. Is it a better implementation of the HW SPI stack? Still, doesn't HW SPI use support inside the chip?
I'm just curious about what you made faster :)
[env:d1]
platform = espressif8266
board = d1
framework = arduino
lib_deps=
moononournation/GFX Library for Arduino @ ^1.1.2
moononournation/GFX Library for Arduino @ ~1.1.2
moononournation/GFX Library for Arduino @ 1.1.2
.pio/libdeps/d1/GFX Library for Arduino/src/Arduino_TFT.cpp:1125:1: error: a15 cannot be used in asm here
will thanks for your help.
Hello.
What does IPS means?
Thank You.
Marc.
#include <Arduino_GFX_Library.h>
#define TFT_BL 32
Arduino_DataBus bus = new Arduino_ESP32SPI(27 / DC /, 14 / CS */, SCK, MOSI, MISO);
Arduino_GFX gfx = new Arduino_ILI9341_M5STACK(bus, 33 / RST /, 1 / rotation */);
i did include like this...
and got this error:
expected type-specifier before 'Arduino_ILI9341_M5STACK'
Can you help ?
Thanks.
Marc.
I've been trying the ImgViewerJpeg example and seems like whenever I try to display a second image with another call to jpegClass.draw it won't do anything, only the first call to the function succeeds. I tried to debug this issue to no avail
我在使用IC为ST7735的屏幕时,显示出来的内容颜色与我设置的相反,如红色变成绿色
If i may contribute i can push minor changes in:
modified: Arduino_GFX.cpp
modified: Arduino_SSD1283A.cpp
modified: Arduino_TFT.cpp
modified: Arduino_TFT_18bit.cpp // type conversion issues and offset may be not initialized
modified: glcdfont.c // font defined but not used:
Hi,
Great work @moononournation !
I want to add an Arduino_Duplicate_Display
driver with a constructor like:
Arduino_Duplicate_Display(Arduino_GFX *gfxs[]);
And I want it to override all of the Arduino_GFX and Arduino_TFT needed functions so we can use it like:
Arduino_DataBus *bus = new Arduino_ESP32SPI(BUS_DC_PIN, -1, BUS_SCK_PIN, BUS_DAT_PIN, -1, BUS_SPI_ID);
Arduino_GFX *gc9a01 = new Arduino_GC9A01(bus, GC9A01_CS_PIN, BUS_RST_PIN); // 240x240px
Arduino_GFX *st7789 = new Arduino_ST7789(bus, ST7789_CS_PIN, BUS_RST_PIN); // 240x240px
Arduino_GFX *ssd1351 = new Arduino_SSD1351(bus, SSD1351_CS_PIN, BUS_RST_PIN); // 128x128px
Arduino_GFX *gfxs[] = {gc9a01, st7789, ssd1351, NULL};
Arduino_GFX *gfx = new Arduino_Duplicate_Display(gfxs);
void setup(void)
{
// on all displays:
gfx->begin();
gfx->fillScreen(BLACK);
gfx->setCursor(10, 10);
gfx->setTextColor(RED);
gfx->println("Hello World!");
// can also do:
ssd1351->fillScreen(GREEN);
}
But I have some problems:
1. I need the Arduino_TFT
and ALL the display drivers to accept the uint8_t cs_pin
argument in their constructors.
I don't understand why the Arduino_DataBus
needs the cs pin? I think this pin is needed per display not per bus!
2. Do I need to inherit from Arduino_GFX
or Arduino_TFT
?
The problem with Arduino_TFT
is that it needs a bus in its constructor, but it implements more functions like:
begin, invertDisplay, displayOn, displayOff, writeRepeat, writeAddrWindow, setAddrWindow...
3. Do you think a NULL
terminated array of displays it good for the Arduino_Duplicate_Display
constructor?
Looking forward,
Arad :)
When I use SWSPI on a Teensy 4.1 and a GC9A01 display, the library works properly. But when I try HWSPI with the same hardware, I just get lines and screen garbage. What am I missing?
Interfacing_Arduino_to_ER-TFTM1.28-1.pdf
Code:
#include "Arduino_GFX_Library.h"
//PINS
#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10
#define TFT_MOSI 11
#define TFT_SCK 13
#define TFT_MISO -1
Arduino_DataBus *bus = new Arduino_SWSPI(TFT_DC, TFT_CS, TFT_SCK, TFT_MOSI, TFT_MISO);
//Arduino_DataBus *bus = new Arduino_HWSPI(TFT_DC, TFT_CS);
Arduino_GC9A01 *gfx = new Arduino_GC9A01(bus, TFT_RST, 0 /*rotation*/, true /*IPS*/);
void setup() {
gfx->begin();
}
void loop() {
gfx->fillScreen(BLACK);
delay(500);
gfx->fillScreen(RED);
delay(500);
}
When trying to change the orientation of the display the gfx->setRotation(X); method works well for jpgs
With a strange mapping on my setup at least where 0 -> 0 degrees 1 -> 180 degrees, 2 -> 90 degrees, 3 -> 270 degrees
But when any gfx->setRotation(X) is set the gif playback is empty :/
Would appreciate any input, thank-you
Here is the function
static void play_gif(File gifFile, char* filename, uint8_t repeats, uint16_t rotation)
{
if (!gifFile || gifFile.isDirectory())
{
show_fail_message(F("ERROR: open gifFile Failed!"), 1000);
return;
}
display_on();
set_rotation(rotation);
// read GIF file header
gd_GIF *gif = gifClass.gd_open_gif(&gifFile);
if (!gif)
{
show_fail_message(F("gd_open_gif() failed!"), 1000);
return;
}
int32_t gif_frame_size = gif->width * gif->height;
uint8_t *buf = (uint8_t *)malloc(gif_frame_size);
if (!buf)
{
show_fail_message(F("ERROR: buf malloc failed!"), 1000);
return;
}
Serial.println(F("GIF video start"));
gfx->setAddrWindow((gfx->width() - gif->width) / 2, (gfx->height() - gif->height) / 2, gif->width, gif->height);
int t_fstart, t_delay = 0, t_real_delay, res, delay_until;
int duration = 0, remain = 0;
uint8_t counter = 0;
uint32_t idle_counter = 0;
uint32_t sd_fetch_time = 0;
uint32_t draw_time = 0;
while (counter < repeats)
{
t_fstart = millis();
t_delay = gif->gce.delay * 10;
res = gifClass.gd_get_frame(gif, buf);
sd_fetch_time = millis() - t_fstart;
if (res < 0)
{
Serial.println(F("ERROR: gd_get_frame() failed!"));
break;
}
else if (res == 0)
{
Serial.print(F("rewind, duration: "));
Serial.print(duration);
Serial.print(F(", remain: "));
Serial.print(abs(remain));
Serial.print(F(" ("));
Serial.print(100.0 * abs(remain) / duration);
Serial.println(F("%)"));
Serial.print(F("SD Time = "));
Serial.println(sd_fetch_time);
Serial.print(F("Draw Time = "));
Serial.println(draw_time);
duration = 0;
remain = 0;
gifClass.gd_rewind(gif);
counter += 1;
continue;
}
gfx->startWrite();
gfx->writeIndexedPixels(buf, gif->palette->colors, gif_frame_size);
gfx->endWrite();
draw_time = millis() - t_fstart;
t_real_delay = t_delay - (millis() - t_fstart);
duration += t_delay;
remain += t_real_delay;
delay_until = millis() + t_real_delay;
do
{
delay(1);
idle_counter += 1;
} while (millis() < delay_until);
}
free(buf);
gifClass.gd_close_gif(gif);
display_off();
Serial.println(F("GIF video end"));
}
This is an never closing issue.
I would like to align all display rotation orientation with display FPC. But I am still struggling the display FPC should be at 6 o'clock or 12 o'clock.
At the beginning I believe the FPC should be at 12 o'clock. However, I found many breakout board silk print text told me the FPC should be at 6 o'clock.
Welcome to leave your comment here.
Hello i have this config: // For the Adafruit shield, these are the default.
#define TFT_DC 2
#define TFT_CS 15
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_RST 4
#define TFT_MISO 19
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST, TFT_MISO);
and AdafruitGFX works, and TFT_eSPI too.
i tried:
//Arduino_DataBus bus = new Arduino_ESP32SPI(2 / DC /, 15 / CS /, 18 / SCK /, 23 / MOSI /, -1 / MISO /, VSPI / spi_num */);
Arduino_DataBus bus = new Arduino_ESP32SPI(2 / DC /, 15 / CS */, SCK, 23, -1);
Arduino_ILI9341 gfx = new Arduino_ILI9341(bus, 4 / RST / , 0 / rotation */ );
and nothing works...
can you help?
Thanks.
Marc.
Hi there, I'm getting an error using the Adafruit nRF52840 Feather board:
error: expected type-specifier before 'Arduino_NRFXSPI'
Arduino_DataBus *bus = new Arduino_NRFXSPI(2 /* DC */, 3 /* CS */, 14 /* SCK */, 13 /* MOSI */, 15 /* MISO */);
Here is my declaration:
//Begin TFT
#define ARDUINO_ARCH_NRF52840
#include <Arduino_GFX_Library.h>
#define TFT_BL 30 /*Backlight control, pin 'A2'.*/
Arduino_DataBus *bus = new Arduino_NRFXSPI(2 /* DC */, 3 /* CS */, 14 /* SCK */, 13 /* MOSI */, 15 /* MISO */);
Arduino_GFX *gfx = new Arduino_ST7735(bus, 28 /*RST*/, 0 /* rotation */, false /* IPS */);
//End TFT
The declaration appears correct for this platform, can you help? Thanks!
As the title says,When I use Arduino_GFX, the color on the screen is not real. The color is very bright. But it can be displayed normally when LCDWIKI_SPI is used. And if I use LCDWIKI_SPI to initialize the screen first, and keep the power on, then burn another sketch written in Arduino_GFX again. It still shows the right colors, even if I press the rest key to restart. But once I turn off the power and restart Arduino, the color will become untrue. I don't know what the problem is, but I still want to use your API because it takes less memory.Do you have any suggestions for solving this problem?
My Screen: 2.0inch Arduino SPI Module ILI9225 SKU:MAR2001
Using Arduino IDE 1.8.13 on Windows with your library version 1.1.2 and get the error
Arduino_DataBus.cpp:76:63: error: operation on 'i' may be undefined [-Werror=sequence-point]
in line 76: writeCommand16(((uint16_t)batch[++i] << 8) | batch[++i]);
...\libraries\GFX_Library_for_Arduino\src\Arduino_DataBus.cpp: In member function 'void Arduino_DataBus::batchOperation(uint8_t*, uint8_t)':
...\libraries\GFX_Library_for_Arduino\src\Arduino_DataBus.cpp:76:63: error: operation on 'i' may be undefined [-Werror=sequence-point]
writeCommand16(((uint16_t)batch[++i] << 8) | batch[++i]);
^
Allows to use rlottie animations in Arduino GFX.
You can use Samsung/rlottie library with C-api header
Best regards.
Ref:
Samsung/rlottie#484
File: /ezgif.com-optimize.gif
new_table() malloc: 32776
GIF video start
Guru Meditation Error: Core 1 panic'ed (LoadStoreError). Exception was unhandled.
Core 1 register dump:
PC : 0x400d17c1 PS : 0x00060130 A0 : 0x800d1b55 A1 : 0x3ffb1eb0
A2 : 0x3ffc00a4 A3 : 0x3ffb20f8 A4 : 0x40041574 A5 : 0x00000000
A6 : 0x00000fff A7 : 0x3ffd1cb7 A8 : 0x3ffc9d94 A9 : 0x00000000
A10 : 0x0000028e A11 : 0x00000093 A12 : 0x0000fefe A13 : 0x3ffb24f8
A14 : 0x3ffb24f8 A15 : 0x00000008 SAR : 0x00000016 EXCCAUSE: 0x00000003
EXCVADDR: 0x40041578 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0x00000000
Backtrace: 0x400d17c1:0x3ffb1eb0 0x400d1b52:0x3ffb1f20 0x400d6ac3:0x3ffb1fb0 0x4008a529:0x3ffb1fd0
Rebooting...
PC: 0x400d17c1: GifClass::read_image_data(gd_GIF*, short, unsigned char*) at /tmp/arduino_build_303251/sketch/GifClass.h line 575
I changed the code to display the array element:
else
{
Serial.println(entry.prefix);
Serial.flush();
entry = gif->table->entries[entry.prefix];
}
and I see this before it dies:
32
590
589
522
352
351
350
2
24149
65278
Guru Meditation Error: Core 1 panic'ed (LoadStoreError). Exception was unhandled.
Not sure about other screens, but the GC9A01 that I'm testing with does not turn blank when I use gfx->fillScreen(BLACK). It shows full white instead.
I used the displayOff() method but then when I want to show something on the screen after it does not respond. Calling displayOn() does not help.
There should be a simple way to to clear the screen, please tell me I'm just missing something obvious.
Thanks
I get the following error after uploading the data and sketch to esp32
E (512) SPIFFS: mount failed, -10025
Please help in resolving the same
reduce set window command overhead
Using ESP32 + SD card to playback a gif.
The playback is about 70% slower than it should be, playing from SPIFFS was much faster and exactly the same as the playback on my computer
I am noticing that the time to get the frame is slower than the allotted time determined from t_delay, fetching of the GIF frame of the SD card must be taking too long.
I have both the GC9A01 and the SD card on the VSPI bus, I'm wondering if we can get the playback fast enough or will we need to put the display and SD card on separate busses and then have two tasks running. One to fetch the next GIF frame, the other to play it back.
Thanks in advance
The last 7 columns cannot display with a jpg picture. You can easily reproduce the problem with the example named ImgViewerJpeg.ino. I change the code
Arduino_ST7789 *gfx = new Arduino_ST7789(bus, TFT_RST, 0 /* rotation */, true /* IPS */, 135 /* width */, 240 /* height */, 53 /* col offset 1 */, 40 /* row offset 1 */, 52 /* col offset 2 */, 40 /* row offset 2 */);
to
Arduino_ST7789 *gfx = new Arduino_ST7789(bus, TFT_RST, 0 /* rotation */, true /* IPS */, 136 /* width */, 240 /* height */, 53 /* col offset 1 */, 40 /* row offset 1 */, 52 /* col offset 2 */, 40 /* row offset 2 */);
the problem was fixed.
I found something.
Draw pos = 0,0. size = 64 x 8
Draw pos = 64,0. size = 64 x 8
Draw pos = 128,0. size = 8 x 8 <--------it does not work
Draw pos = 0,8. size = 64 x 8
Draw pos = 64,8. size = 64 x 8
Draw pos = 128,8. size = 8 x 8 <--------it does not work
Draw pos = 0,16. size = 64 x 8
Draw pos = 64,16. size = 64 x 8
Draw pos = 128,16. size = 8 x 8 <--------it does not work
Draw pos = 0,24. size = 64 x 8
Draw pos = 64,24. size = 64 x 8
Draw pos = 128,24. size = 8 x 8 ......
Draw pos = 0,32. size = 64 x 8
Draw pos = 64,32. size = 64 x 8
Draw pos = 128,32. size = 8 x 8
Draw pos = 0,40. size = 64 x 8
Draw pos = 64,40. size = 64 x 8
Draw pos = 128,40. size = 8 x 8
Draw pos = 0,48. size = 64 x 8
Draw pos = 64,48. size = 64 x 8
Draw pos = 128,48. size = 8 x 8
Draw pos = 0,56. size = 64 x 8
Draw pos = 64,56. size = 64 x 8
Draw pos = 128,56. size = 8 x 8
Draw pos = 0,64. size = 64 x 8
Draw pos = 64,64. size = 64 x 8
Draw pos = 128,64. size = 8 x 8
Draw pos = 0,72. size = 64 x 8
Draw pos = 64,72. size = 64 x 8
Draw pos = 128,72. size = 8 x 8
Draw pos = 0,80. size = 64 x 8
Draw pos = 64,80. size = 64 x 8
Draw pos = 128,80. size = 8 x 8
Draw pos = 0,88. size = 64 x 8
Draw pos = 64,88. size = 64 x 8
Draw pos = 128,88. size = 8 x 8
Draw pos = 0,96. size = 64 x 8
Draw pos = 64,96. size = 64 x 8
Draw pos = 128,96. size = 8 x 8
Draw pos = 0,104. size = 64 x 8
Draw pos = 64,104. size = 64 x 8
Draw pos = 128,104. size = 8 x 8
Draw pos = 0,112. size = 64 x 8
Draw pos = 64,112. size = 64 x 8
Draw pos = 128,112. size = 8 x 8
Draw pos = 0,120. size = 64 x 8
Draw pos = 64,120. size = 64 x 8
Draw pos = 128,120. size = 8 x 8
Draw pos = 0,128. size = 64 x 8
Draw pos = 64,128. size = 64 x 8
Draw pos = 128,128. size = 8 x 8
Draw pos = 0,136. size = 64 x 8
Draw pos = 64,136. size = 64 x 8
Draw pos = 128,136. size = 8 x 8
Draw pos = 0,144. size = 64 x 8
Draw pos = 64,144. size = 64 x 8
Draw pos = 128,144. size = 8 x 8
Draw pos = 0,152. size = 64 x 8
Draw pos = 64,152. size = 64 x 8
Draw pos = 128,152. size = 8 x 8
Draw pos = 0,160. size = 64 x 8
Draw pos = 64,160. size = 64 x 8
Draw pos = 128,160. size = 8 x 8
Draw pos = 0,168. size = 64 x 8
Draw pos = 64,168. size = 64 x 8
Draw pos = 128,168. size = 8 x 8
Draw pos = 0,176. size = 64 x 8
Draw pos = 64,176. size = 64 x 8
Draw pos = 128,176. size = 8 x 8
Draw pos = 0,184. size = 64 x 8
Draw pos = 64,184. size = 64 x 8
Draw pos = 128,184. size = 8 x 8
Draw pos = 0,192. size = 64 x 8
Draw pos = 64,192. size = 64 x 8
Draw pos = 128,192. size = 8 x 8
Draw pos = 0,200. size = 64 x 8
Draw pos = 64,200. size = 64 x 8
Draw pos = 128,200. size = 8 x 8
Draw pos = 0,208. size = 64 x 8
Draw pos = 64,208. size = 64 x 8
Draw pos = 128,208. size = 8 x 8
Draw pos = 0,216. size = 64 x 8
Draw pos = 64,216. size = 64 x 8
Draw pos = 128,216. size = 8 x 8
Draw pos = 0,224. size = 64 x 8
Draw pos = 64,224. size = 64 x 8
Draw pos = 128,224. size = 8 x 8
Draw pos = 0,232. size = 64 x 8
Draw pos = 64,232. size = 64 x 8
Draw pos = 128,232. size = 8 x 8
Time used: 279
esp32 4m flash without psram.
screen: st7789 135x240.
arduino ide 1.8.9无法编译arduino gfx例程
也无法编译rgb565 video例程。
我很喜欢vide例子。
(feel free to close this issue after you've read it, there is a suggestion, plus some pointers to my own work that may be useful to you)
The examples you give are really good, but the many many ways to define the screens, is very long because there are so many options (and for good reason).
Have you considered factoring that out into a common file?
For instance, see:
Then you can have the adafruit example like this: https://github.com/marcmerlin/tft-playground/tree/master/ili3941graphicstest
And your example code like that: https://github.com/marcmerlin/tft-playground/tree/master/PDQgraphicstest
This makes it easy to change the pin and screen in one place and all the demos are updated at the same time.
And if you have a little time, please look at
https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos
especially https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/blob/master/neomatrix_config.h
neomatrix_config solves a similar problem to yours: a single config file that contains 2D hardware definition and then all the demos source that file and work automatically.
Currently I support a few TFTs from adafruit lib, but I will add support for your driver because your driver is better :)
If you are curious, I support a lot of different hardware, including RGBPanels and neopixel matrices, see my base class:
https://github.com/marcmerlin/Framebuffer_GFX
The only issue is that my base class is RGB888, which is a bit wasteful for TFTs that are RGB565. For 320x240, the framebuffer is 224KB which is too big on an ESP32 without PSRAM
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.