Pi thinks unicorn hat is a phat


#1

just updated my unicornhat libary and ran the new detect program and it says my height isn’t = to my width which it isn’t and now all the examples run as a phat format


#2

Thanks for the heads up, we’ll look into it ASAP. Remember that you can override the detection and enforce the HAT layout with:

unicornhat.set_layout(unicornhat.HAT)

a bit of a pain I know, but may help in the interim.


#3

the weird thing is however that when in shell I run the function that tells you the dimensions of the display it says (8,8)


#4

I just had a look and the process uses device-tree detection to see if a HAT is present. This will only work if you booted the Pi with the HAT already fitted… I’m willing to bet it’s your problem.


#5

great. That’s slightly annoying but will try that and be back.


#6

works now

Thanks a lot

will


#7

great, remember you can always enforce the layout in your code if you tend to swap HATs on the fly.


#8

This is the result of the autodetect feature I merged in recently. Unfortunately like all other HAT-eeprom features it needs the HAT placed on the Pi before booting in order to work- as @RogueM mentions.

Defaulting to pHAT may be a little problematic, but in reality it’s the only way auto-detect can work since the pHAT has no EEPROM to explicitly detect. It’s a trade-off and a temporary discomfort for existing Unicorn HAT users, but it’s easy enough to simply specify whether you have the HAT or the pHAT in code. :D

Arguably your Pi should always be turned off before swapping out HATs, but we all know nobody pays attention to that rule ;) ( I sure don’t! )