pappersverk / inky

A library for managing Inky e-ink displays from Elixir.
Apache License 2.0
72 stars 11 forks source link

Support the Inky Impression #36

Open lawik opened 3 years ago

lawik commented 3 years ago

This issue will be used for now to capture any and all notes about implementing support for the impression.

It is different hardware but I think we could extend the current API or make a 2.x series to support it where we extend the API in a breaking fashion if necessary.

The way we built the Phat and What support was by porting from Pimoroni. pimoroni/inky

Example for the 7color should be the Impression: https://github.com/pimoroni/inky/blob/master/examples/7color/stripes.py

That indicates using this: https://github.com/pimoroni/inky/blob/master/library/inky/inky_uc8159.py

Make any notes on progress or dead ends available here :)

Ping @jasonmj @axelson who have also ordered this thing.

lawik commented 3 years ago

https://github.com/pappersverk/inky/pull/37/files

Current progress will be in that PR on my end. Made a #TODO note on how far I've gotten (not very).

I don't think this uses the eeprom that was a thing on the what at all. I get the impression that a lot was copy and pasted and never cleaned up. I'll try to figure out what we can rip out after I have it working.

Unclear if all the SPI stuff and pins actually mostly line up between the old ones and the Impression or if they are unused copy and pastes. I guess I'll find out as I get through it :D

axelson commented 3 years ago

I haven't found any documentation on the orientation (the pinout links to https://pinout.xyz/pinout/inky_impression# but that doesn't help me with the orientation), but the product page has an image that shows the correct orientation with a rpi0: inky-7-colour-reverse-1_1024x1024

axelson commented 3 years ago

This is what I receive back from Inky.EEPROM.read/0:

iex(livebook@nerves-517f.local)1> Inky.EEPROM.read
{:ok,
 %Inky.EEPROM{
   color: :unknown,
   display_variant: "7-Color (UC8159)",
   height: 192,
   pcb_variant: 12,
   timestamp: "2021-08-25 17:12:10.3",
   width: 88
 }}

I've also started a shell project to be used for testing/developing this work: https://github.com/axelson/inky_impression_livebook

axelson commented 3 years ago

Some progress! This is effectively what I get if I skip using the cs0 pin entirely (and fix a couple minor bugs in the code):

https://user-images.githubusercontent.com/9973/140674500-ee3d9e5d-9e9c-421e-b763-dff37219ea2f.mp4

axelson commented 3 years ago

Update, I'm able to display things now!

By generating a buffer with (w=width h=height):

    buffer =
      for y <- 0..(h - 1), x <- 0..(w - 1), into: <<>> do
        cond do
          y > 100 -> <<3>>
          x > 100 -> <<4>>
          true -> <<rem(y, @colors[:orange] + 1)>>
        end
        # color = floor(0 / w * 7)
      end

I get: 2021-11-07 22 04 09

It seems like we'll have to update or re-write PixelBuffer to generate a buffer Also the setup code causing about 5x more flashing than what I'm seeing in a YouTube video: https://www.youtube.com/watch?v=RWgaSNRqyEg

axelson commented 3 years ago

2021-11-11 21 26 19 2021-11-11 21 25 55

Okay, making progress! The bars are mostly gone. They seem completely gone for some colors but not others. I'm not quite sure what's happening.

My updates are in #45 but the latest code isn't being used. The main thing I've added is an implementation of the following python code:

buf = ((buf[::2] << 4) & 0xF0) | (buf[1::2] & 0x0F)

Which is saying that they're using the top 4 bits and the bottom 4 bits.

Edit: actually what's happening in the picture is that the color on the right is bleeding into the color on the left.

axelson commented 3 years ago

2021-11-13 18 26 14

I finally got the coordinates working properly, when writing to the display we should treat it as if it's 300x896 instead of 600x448

lawik commented 3 years ago

Fantastic work Jason!

On Sun, 14 Nov 2021, 05:28 Jason Axelson, @.***> wrote:

[image: 2021-11-13 18 26 14] https://user-images.githubusercontent.com/9973/141667497-ac63c611-c935-40f8-ab13-daedd2c7921e.jpg

I finally got the coordinates working properly, when writing to the display we should treat it as if it's 300x896 instead of 600x448

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pappersverk/inky/issues/36#issuecomment-968203912, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPBIJOPMIHHU5K3FDRAVI3UL43HXANCNFSM5FWM2AWA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

axelson commented 3 years ago

Thanks! Next up I'm trying to figure out why it takes me 30 seconds to update but all the videos I can find online seem to take about 10 seconds to do the equivalent update:

nyaray commented 2 years ago

One thing you could do is to compare the command sequence generated by the python library exactly to the one that Inky creates. That way you could figure out if something is being done in a weird manner or causing a setting to be changed or something. Be sure to check values carefully! :)... have "fun", hehe.