0 votes
in ESPaper by (120 points)
Hello

I wont to change the espaper-sketch to display a prepared picture.

Goal:

The module shall connect to the WLAN, then connect to a defined raspberry pi (ftp, http).

Now it shall get a prepared picture (e.g. PNG, TIFF BMP b/w) and display it to the epaper.

That is all.

The preparation of the picture will be done at the raspi.

What have I to do? Can you help me?

Thanks

Andreas

(german answer welcome)

1 Answer

0 votes
by (9.1k points)
Hi Andreas

I'll answer in English so others can benefit too. Have a look at the espaper-client sketch: it can download a JSON object with a description what to draw and what to download from a server:

https://github.com/squix78/espaper-client

Your Raspberry Pi could use PHP or similar to create such a json object or you could also download the picture from a fixed resource. The mini grafx libray uses it's own format:

0x01, // Version: 1

0x01, // BitDepth: 1

0x02, 0x80, // Width: 640

0x01, 0x80, // Height: 384

// Round width to next byte: 640

0xFF, 0xFF, 0xFF,...//data

To create the data part you have to scan line by line. With a bit depth of one each pixel occupies one bit in a byte. 8 pixels take one byte. If the width is less than a multiple of eight the bits will be filled up in that last byte and a new line begins.

I know this is a very rough description but maybe it helps to get you started...

Kind regards,
Daniel
by (120 points)
edited by
Hi,

this is a good idea. The espaper-client works very well with your server.

Now I want to use the project locally without a cloud.
For this goal I changed:
String WIFI_SSID = <my-SSID>
String WIFI_PASS = <my-PASS>
String DEVICE_ID = "Display1/request.json";
String DEVICE_KEY = "<none>";
const String SHA1_FINGERPRINT = "";
const String SERVER_URL = "http://<my-server-ip>";

Now the unit asked to "http://<my-server-ip>/public/devices/Display1/request.json"
From this position the display gets the content to display.

For testing I commented out the content of loadConfig in configportal.h - Now all changes in settings.h will be used instandly without saving in SPIFFS.

Thanks. You project ist interesting.
Andreas
by (120 points)
Hi,

now I can use the JSON-commands in the request-file.
It is made by php.
Only the setFont command is not quite right.

The working commands are e.g.
{"command": "drawLine","params": {"x1": "196","y1": "116","x2": "196","y2": "128"}}{"command": "drawString","params": {"x1": "48","y1": "116","text":"CONFIG+RST"}}
{"command": "setTextAlignment","params": {"textAlignment": "CENTER"}}'

But how to change to font to Arial10, Arial16, Arial24 - the build-in fonts?
{"command": "setFont ... ???
I think, the command setFont loads an extern file.

Thanks for your help.

Andreas

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.

https://thingpulse.com

...