Problem displaying image from HTTP. with Waveshare 7.5" e-paper

Hello everyone,
I’m working on a Waveshare 7.5" B&W e-paper display with a ESP32 board. What I need to do is to dispaly a certain image on the display in the bitmap format. The image should be downloaded from a web server.
In order to do this, I decided to use the GXEPD2 library since it provides a valid and functioning example of what I’m trying to do. I got no issues whatsoever with the example provided in the github repo, called “GxEPD2_WiFi_Example.ino”, I can display those images perfectly on the display.

But when I adapted the code to my standards, I was unable to make it work at all. My waveshare basically continues to go black and white alternatively while running the code.

Part of the Serial logs is:

(...)
downloading file "site.bmp"
connecting to 10.10.21.1
requesting URL: http://10.10.21.1/site.bmp
request sent
HTTP/1.1 200 OK

headers received
File size: 983178
Image Offset: 138
Header size: 124
Bit Depth: 32
Image size: 640x384
downloaded in 6924 ms
_Update_Full : 4268001
bytes read 4294967050
width:640
height:384

downloading file "site.bmp"
connecting to 10.10.21.1
requesting URL: http://10.10.21.1/site.bmp
request sent
HTTP/1.1 200 OK

headers received
File size: 983178
Image Offset: 138
Header size: 124
Bit Depth: 32
Image size: 640x384
downloaded in 6926 ms
_Update_Full : 4268001
bytes read 4294967050
width:640
height:384

downloading file "site.bmp"
connecting to 10.10.21.1
requesting URL: http://10.10.21.1/site.bmp
request sent
HTTP/1.1 200 OK

headers received
File size: 983178
Image Offset: 138
Header size: 124
Bit Depth: 32
Image size: 640x384
(...)

Is there an issue with the bitmap format of the image I’m trying to display? I tried using all kinds of bitmap standards, with no success. Details of it are provided in the logs posted above.

I’m also attaching to this message the code I’m flashing on the board.

Could someone please help me out with this?

DEC2.ino (15.4 KB)

@tHe_giafra_sHoW,

Thank you for reporting this issue, even if you are not aware that it is an issue! :slight_smile:

I had a slight problem with your name, as I store downloaded code from posters under NewbieCodes/name,
NewbieCodes/tHe_giafra_sHoW as tHe_giafra_sHoW.ino in your case:(

The important line of your diagnostics is: "Bit Depth: 32".

The issue is that unhandled depths are not reported as "bitmap format not handled."

Only depths of 1, 4, 8, 16, 24 are handled.

Jean-Marc

@ZinggIM

Many thanks for your help!

I still have problems though: I managed to create a bitmap having bit depth of 1 (the Serial logs do confirm), but still the image is not displayed correctly.
Using bit depth of 32 the display just goes black and white alternatively, but while using the same image with a bit depth of 1, some small vertical rows appear in the screen that keeps refreshing. The stuff displayed looks like a barcode, very different from the image given (a planimetry of a room).

downloading file "liberato.bmp"
connecting to 10.10.21.1
requesting URL: http://10.10.21.1/liberato.bmp
request sent
HTTP/1.1 200 OK

headers received
File size: 30782
Image Offset: 62
Header size: 40
Bit Depth: 1
Image size: 640x384

your URL http://10.10.21.1/liberato.bmp is very local. No idea how your liberato.bmp looks like.
you could consider to attach it, maybe zipped.

Ok, I attached the image requested.

liberato.zip (2.19 KB)

tHe_giafra_sHoW:
Ok, I attached the image requested.

That is very kind of you!

And you still would like that I help you?

I have added your bitmap as liberato640x384.bmp to GxEPD2/extras/bitmaps at master · ZinggJM/GxEPD2 · GitHub

It can be shown correctly by GxEPD2_WiFi_Example if added.

I had to re-add showBitmapFrom_HTTPS() to your example to test your example, and see your error.

I replaced the methods skip() and read() with the versions of the actual GxEPD2_WiFi_Example, and your bitmap was shown correctly.

That was very helpful, you solved my problem.
Many thanks for your excellent help.

Feel free to include my bitmap in your own github repo if you think it's helpful for others. :slight_smile:

Feel free to include my bitmap in your own github repo if you think it’s helpful for others.

This was the easiest way to test.

@zinggJM

Hello again.
Sorry if I bother you, but I’m currently working on a similar project, albeit a more complicated one, and I’m using the very same device and the very same drawing functions I used in this thread, since I only need to retrieve the image from a different URL.
So I figured all I had to do was literally copypasting this old project we discussed here to the new one on which I’m currently working. The only problem is that when I compile the code, it gives me errors regarding the “read” function which is present both in unistd.h and in the project:

C:\Users\gd\Documents\Arduino\libraries\MA_Libs/MA_DRAW.h: In function 'void showBitmapFrom_HTTP(const char*, const char*, const char*, int16_t, int16_t, bool)':

C:\Users\gd\Documents\Arduino\libraries\MA_Libs/MA_DRAW.h:18:10: note: candidate 1: uint32_t read(WiFiClient&, uint8_t*, int32_t)

 uint32_t read(WiFiClient& client, uint8_t* buffer, int32_t bytes);

          ^

In file included from C:\Users\gd\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/stdio.h:29:0,

                 from C:\Users\gd\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:27,

                 from sketch\ma_epaper.ino.cpp:1:

C:\Users\gd\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/sys/unistd.h:149:25: note: candidate 2: int read(int, void*, size_t)

 _READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte ));

                         ^

In file included from C:\Users\gd\Documents\Arduino\ma_epaper\ma_epaper.ino:55:0:

C:\Users\gd\Documents\Arduino\libraries\MA_Libs/MA_DRAW.h:18:10: note: candidate 1: uint32_t read(WiFiClient&, uint8_t*, int32_t)

 uint32_t read(WiFiClient& client, uint8_t* buffer, int32_t bytes);

          ^

In file included from C:\Users\gd\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/stdio.h:29:0,

                 from C:\Users\gd\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:27,

                 from sketch\ma_epaper.ino.cpp:1:

C:\Users\gd\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/sys/unistd.h:149:25: note: candidate 2: int read(int, void*, size_t)

 _READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte ));

                         ^

sketch\ma_epaper.ino.cpp.o:(.literal.startup._GLOBAL__sub_I__Z13ma_debug_initv+0x18): undefined reference to `vtable for GxEPD2_750'

sketch\ma_epaper.ino.cpp.o:(.literal.startup._GLOBAL__sub_I__Z13ma_debug_initv+0x24): undefined reference to `GxEPD2_750::GxEPD2_750(signed char, signed char, signed char, signed char)'

sketch\ma_epaper.ino.cpp.o: In function `_GLOBAL__sub_I__Z13ma_debug_initv':

C:\Users\gd\Documents\Arduino\libraries\MA_Libs/MA_DRAW.h:352: undefined reference to `GxEPD2_750::GxEPD2_750(signed char, signed char, signed char, signed char)'
collect2.exe: error: ld returned 1 exit status

it seems a linker problem - though all the libraries are in the right place.

I attached to this message the code I’m using in my library to draw the image, where the read() function is defined.

I know it could be a simple question, but I’m stuck with this issue.
Hope you can help me, many thanks :slight_smile:

MA_DRAW.h (13.1 KB)

@tHe_giafra_sHoW

See GxEPD2_WiFi_Example.ino, lines 132 - 139:

#if defined (ESP8266)
#include <ESP8266WiFi.h>
#define USE_BearSSL true
#endif

#include <WiFiClient.h>
#include <WiFiClientSecure.h>