dr-mod / zero-btc-screen

Crypto stock price for RPi Zero
MIT License
310 stars 69 forks source link

Add Pimoroni inkyWhat (Red, Black, White) EPD #7

Closed martinatime closed 3 years ago

martinatime commented 3 years ago

Got the inkyWhat RBW working as a new screen type. Changed the ploy.py which may affect other screens but I couldn't test as I don't have those.

https://shop.pimoroni.com/products/inky-what?variant=13590497624147

dr-mod commented 3 years ago

Hi Aaron, thank you for your pull request! I'll hopefully have some time tomorrow to take a look at it and get back to you if something pops up.

martinatime commented 3 years ago

Thanks @dr-mod & @vindexins for the review. I think I have made changes to address most if not all of your concerns. I did hit an error when I ran it configured with a different screen than what I own and I don't know if I introduced the error or if it is because I don't have the correct library and/or hardware.

dr-mod commented 3 years ago

Hi @martinatime, I've just got around to execute this on my pi and there are two things that I've noticed.

  1. I had to install driver for the new screen even though I don't use it. We'll need to think how to resolve thins.
  2. After installing the driver it didn't work due to some changes you've made:
    Traceback (most recent call last):
    File "main.py", line 61, in <module>
    main()
    File "main.py", line 47, in main
    data_sink.update_observers(prices)
    File "/home/pi/zero-btc-screen/presentation/observer.py", line 18, in update_observers
    observer.update(data)
    File "/home/pi/zero-btc-screen/presentation/screens/epd2in13v2.py", line 52, in update
    self.form_image(data, self.screen_draw)
    File "/home/pi/zero-btc-screen/presentation/screens/epd2in13v2.py", line 49, in form_image
    Plot.caption(flatten_prices[len(flatten_prices) - 1], 60, 95, SCREEN_WIDTH, FONT_LARGE, screen_draw)
    File "/home/pi/zero-btc-screen/data/plot.py", line 42, in caption
    draw.text((currency_offset, y), "BTC", font=font, fill=fill)
    AttributeError: 'FreeTypeFont' object has no attribute 'text'

Will you be able to take a look at the latter please?

martinatime commented 3 years ago

I'll look into it this weekend. I also had to pull in the drivers for the original screens. I'm not certain how you deal with that but the presentation/screens/init.py file seems to load all of the screens and therefore needs all of the drivers. My python skills are minimal so I don't know how to programatically load only certain imports in a init.py file. Also, I'll have to deal with the merge conflict introduced by the other PR.

dr-mod commented 3 years ago

Great, thanks for looking into it. As for having to install drivers for screens you don't need, I've just wrapped imports in "try" this easy fix should resolve this.

martinatime commented 3 years ago

I had a little time tonight and it was bugging me. Please review it again and make sure it works on your hardware. Thanks again.

dr-mod commented 3 years ago

Hey @martinatime , I've come round to double check it, tanks for updating your PR. There is a couple of things that need fixing. Let me do the following, I'll merge the PR now and fix it there, feel free to check if everything works afterwards.