pufferfish-tech / octopus-agile-pi-prices

Display the upcoming prices on the Octopus Energy "Agile" tariff.
Apache License 2.0
71 stars 27 forks source link

Update octoprice_main_inky.py #15

Closed jerbzz closed 3 years ago

jerbzz commented 3 years ago

Change to automatic detection of the display type. Fixes an issue causing a silent exit and no image displayed on my new yellow inkyphat: Found: Yellow pHAT (SSD1608) Display: 212x104 Color: yellow PCB Variant: 1.2 Display Variant: 12 Time: b'2020-10-08 17:17:35.9'

jerbzz commented 3 years ago

This works just fine now on this new yellow without making any further changes to the code. It looks like the resolution on this display is higher as well, so there is considerable whitespace on the right hand and bottom edges of the display. That is a slightly bigger project to tidy up, especially as I don't have an older inkyphat for testing :(

jerbzz commented 3 years ago

Further clarification: changing l25 from inky_display = InkyPHAT("red") to inky_display = InkyPHAT("yellow") still resulted in no update to the display on my device.

jerbzz commented 3 years ago

@pufferfish-tech any thoughts on this? :)

pufferfish-tech commented 3 years ago

@pufferfish-tech any thoughts on this? :)

I'm not sure what the issue is, I've been running a yellow inkyPhat for over a year on core code. You just edit the file to use the yellow phat as you say. As far as I'm aware no updates have been made to the resolution or the pimoroni libraries since 2018?

Also a FYI to anyone else watching: the yellow display is meh, go for the red one. The yellow has gone muddy grey after a year.

pufferfish-tech commented 3 years ago

Oh wait on further inspection:

We started rolling out a higher resolution SSD1608 e-paper screen on the Inky pHAT from late 2020 (250x122 pixels instead of 212x104!). These screens require different drivers, but the library should autodetect the right drivers for your screen (if you're running an example that needs you to specify a --type, make sure you go for --type "auto"). You might run into problems using third party software to drive the display if you have one of these newer boards.

Hmm that'll throw a spanner in the works! I don't have a new model so this is going to be pretty tricky to look at! What exactly does/doesn't it do?

jerbzz commented 3 years ago

Oh wait on further inspection:

We started rolling out a higher resolution SSD1608 e-paper screen on the Inky pHAT from late 2020 (250x122 pixels instead of 212x104!). These screens require different drivers, but the library should autodetect the right drivers for your screen (if you're running an example that needs you to specify a --type, make sure you go for --type "auto"). You might run into problems using third party software to drive the display if you have one of these newer boards.

Hmm that'll throw a spanner in the works! I don't have a new model so this is going to be pretty tricky to look at! What exactly does/doesn't it do?

That there be the problem.

Without the change in this PR, your code exits silently for me but does not update the display at all.

All of Pimoroni's pHAT example code now uses the from inky.auto import auto idiom too. There is now inky.py and inky_ssd1608.py in the library - the displays are driven totally differently.

I think without auto, I'd need to say from inky import InkyPHAT_SSD1608 etc etc which obviously is no good for anyone with an older board.

Have you tested the diff to see what it does on an older board (which I don't have 😅)?

pufferfish-tech commented 3 years ago

I will test it, but the pain in the butt part of testing it is it will need a rebuild/reinstall of the libraries which may break existing code. However anyone with an old display coming to it as of now will use those, so it has to be done anyway. Oh joy. ;)

So what's the status with this patch before I go in head first: With this code, does your display work (other than obvious resolution issues)?

jerbzz commented 3 years ago

B8AA321A-F4A7-4221-A43A-0F3963580545

That’s what I get with this change. Without it, nada.

If you end up merging this or something similar I might as well fix up the layout for the higher resolution and wrap all that in the autodetect stuff and submit another PR, rather than just bodging it for myself 😝

jerbzz commented 3 years ago

Just to let you know @pufferfish-tech I've got hold of an older red inkypHat and it works fine with the change here.

jerbzz commented 3 years ago

Ehhhh I think I made a bodge with the white space... sorry

Any road:

77DAF4FE-7F4B-466F-B2BA-BCA533AFB1BB

With this diff: new high res on the left, old low res on the right.

pufferfish-tech commented 3 years ago

Just catching up - I still have no idea how to use github but I think I have merged the code in...let me know if I messed it up.

Glad to see you managed to sort it, sorry for being less present than usual, just been one of those weeks!

jerbzz commented 3 years ago

Awesome thanks. I also don’t really know how to GitHub 😅

Let’s hope it still works for everyone!