pappersverk / inky

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

Refactor and add support for Inky Impression 7.3" #49

Open axelson opened 1 year ago

axelson commented 1 year ago

The Inky Impression 7.3" uses a different chip than the Impression 5.7" and 4" so it required a new HAL module.

To fit this new chip support into the library I also undertook a refactor

I have tested this on (using https://github.com/axelson/inky_tester):

2023-08-06 17 32 38

This merges the contents of the impression branch which also includes code/work from @lawik and @jasonmj :heart:

jasonmj commented 1 year ago

I would have used the chip name instead of "original" but I haven't been able to find the name of the chip anywhere

I did some searching and found IL91874 at the top of the original python code. Maybe that's it?

nyaray commented 1 year ago

So glad to see this continues to get usage/updates, nothing constructive to add, really. ✌️

axelson commented 1 year ago

I would have used the chip name instead of "original" but I haven't been able to find the name of the chip anywhere

I did some searching and found IL91874 at the top of the original python code. Maybe that's it?

Well spotted! Updated in 975d63b331c595ea563930bc2e33e5d711a09b72

cloud8421 commented 2 months ago

Just wondering if this PR has fizzled? I’d be able to help from next week if there’s anything I can do. I have some spares I can test on (will have to check which models).

lawik commented 2 months ago

I don't know if my Impression is broken or if the code is :D

@cloud8421 I believe this ran for @axelson at some point. Try and see if you can get it running if you can. I'd love for us to wrap this up but was not involved very much in the later developments :)

cloud8421 commented 2 months ago

Bit of a hiccup - I just tried to boot my impression 7" with the original firmware and I think there's some hardware issues as it's not working as it was before. Have to dig more but I'm unable to test for now. Will keep you posted.

cloud8421 commented 2 months ago

No luck in reviving the old hardware - I've ordered a new one, it normally takes very little so I HOPE I can test this early in the week.

lawik commented 2 months ago

I would love if this finally goes over the finish line.

I should shove RPi OS on one of my units and just test my hardware.

cloud8421 commented 2 months ago

Got the Impression 7.3 device and did initial testing.

As a testbed, I've generated a plain application with nerves.new, using a Raspberry PI Zero 2, and loaded a checked out local copy of this branch as a dependency.

I've then run the following code in the device SSH console:

{:ok, pid} = Inky.start_link(:impression_7_3, name: InkySample)

It throws the following error, and causes a device reboot:

opening DC pin
** (EXIT from #PID<0.1306.0>) shell process exited with reason: an exception was raised:
    ** (MatchError) no match of right hand side value: {:error, :export_failed}
        (inky 1.0.2) lib/hal/io_impression.ex:58: Inky.IO.Impression.init/1
        (inky 1.0.2) lib/hal/hal_impression_ac073tc1a.ex:110: Inky.HAL.ImpressionAC073TC1A.init/1
        (inky 1.0.2) lib/inky.ex:203: Inky.init/1
        (stdlib 6.0.1) gen_server.erl:2057: :gen_server.init_it/2
        (stdlib 6.0.1) gen_server.erl:2012: :gen_server.init_it/6
        (stdlib 6.0.1) proc_lib.erl:329: :proc_lib.init_p_do_apply/3

The error maps to:

{:ok, dc_pid} = gpio.open(pin_mappings[:dc_pin], :output, initial_value: 0)

I haven't touched any configuration, so following the code it should resolve to the default 22 pin, which according to the device schematics seems correct.

The impression device is new, but I don't think they've changed chipset: looking at Pimoroni Python's source, they map this model to the chipset implemented in this branch, and the PIN number seems correct.