epaper.js icon indicating copy to clipboard operation
epaper.js copied to clipboard

Add support for Waveshare 5.83

Open garytube opened this issue 3 years ago • 3 comments

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 avatar Dec 22 '21 20:12 garytube

@garytube glad to have you on board!

  • The basic idea is that for each screen there is a c++ file that takes the provided Waveshare c 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 to c / c++ for higher performance / access to system APIs. For the 4.2" display, this file is EPD_4in2_node.cc.
  • There's a build tool called gyp that compiles the c++ file, along with any dependencies. This is configured with the binding.gyp file and referenced as a build step (that occurs automatically when you install epaper.js) inside package.json.
  • The devices.js file imports the c++ driver from the steps above and binds it to a common interface. So each device has an init and displayPNG 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 like convertPNGTo4Grey(). The HTML / JS contents that you display on the screen are rendered as a color PNG, which displayPNG 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 file epd5in83_V2.py I believe you may be able to use the existing convertPNGto1BitBW and convertPNGto1BitBWRotated methods in image.js.

That's a quick overview, please reach out if you have any questions, and I'd be happy to help!

samsonmking avatar Dec 23 '21 22:12 samsonmking

This is such a nice explanation,Thank you.

abhayakulkarni avatar Jan 31 '22 17:01 abhayakulkarni

@abhayakulkarni, the process has changed a little since the release of version 2.0. I'll work on writing up some documentation, soon.

samsonmking avatar Feb 02 '22 03:02 samsonmking