Closed stefancrain closed 6 years ago
There's no real detection happening, the library is just attempting to differentiate between pHAT and HAT by checking for the presence/absence of certain i2c devices (the sn3218 in this case). It's a pretty naive check and is definitely not bulletproof. Yes, the library will fail if you don't have a HAT or pHAT connected.
to add to this though - I am aware that there is a gap on the logic when no HAT/pHAT is attached, it shouldn't claim a pHAT is attached.
I'll look at it and try to improve when I have a minute but apart from obviously not claiming a pHAT is attached when none are that is not going to magically make things work when there is no hardware attached ;-)
@RogueM Thats exactly what I was looking for. I was trying to debug a hardware failure last month and it was very confusing to see that my Hat had changed into a pHat.
I appreciate this is a somewhat late update, but as part of the defer-setup
update I have in the pipeline for Automation HAT/pHAT these messages would be removed and replaced with a RuntimeError
when the ADC is not detected. See: https://github.com/pimoroni/automation-hat/tree/defer-setup/library/automationhat
These messages constitute import-time side-effects, and aren't really very Pythonic. While they could be helpful to some users, I've surmised they do more harm than good and will take steps to avoid patterns like this in future.
With a fresh install of raspbianI tried to use this example file. I had no hat attached and had never attached a hat. I still see that it detected one and promptly failed.
Seems like thats an error with detecting that the hat is connected.