epaper.js
epaper.js copied to clipboard
Add support for Waveshare 5.83
https://www.waveshare.com/wiki/5.83inch_e-Paper_HAT
I will try to add support myself but i would grateful for any tipps & gotchas
@garytube glad to have you on board!
- The basic idea is that for each screen there is a
c++
file that takes the provided Wavesharec
drivers and exposes them as a node module using the node.js n-api. As you might be aware, this is how node lets you drop toc / c++
for higher performance / access to system APIs. For the 4.2" display, this file isEPD_4in2_node.cc
. - There's a build tool called
gyp
that compiles thec++
file, along with any dependencies. This is configured with thebinding.gyp
file and referenced as a build step (that occurs automatically when you install epaper.js) insidepackage.json
. - The
devices.js
file imports thec++
driver from the steps above and binds it to a common interface. So each device has aninit
anddisplayPNG
method. These devices are also the objects the user specifies, when they specify which screen they'd like to use. - You'll notice inside the
device.displayPNG
method references to other methods likeconvertPNGTo4Grey()
. The HTML / JS contents that you display on the screen are rendered as a color PNG, whichdisplayPNG
consumes and converts into a format the display can understand. Usually this logic is ported from the example Waveshare c or python code to JavaScript. Looking at the example Waveshare fileepd5in83_V2.py
I believe you may be able to use the existingconvertPNGto1BitBW
andconvertPNGto1BitBWRotated
methods inimage.js
.
That's a quick overview, please reach out if you have any questions, and I'd be happy to help!
This is such a nice explanation,Thank you.
@abhayakulkarni, the process has changed a little since the release of version 2.0. I'll work on writing up some documentation, soon.