pimoroni / fanshim-python

Python library for the Fan SHIM for Raspberry Pi
https://shop.pimoroni.com/products/fan-shim
MIT License
295 stars 85 forks source link

Sofie patch - fixed manual mode #46

Open SofieLewis opened 5 years ago

SofieLewis commented 5 years ago

Fixing the manual mode. After switching modes by long press, once a short press on button is detected the fan will switch and stay in new mode rather than reverting back after delay (2 seconds default) has passed.

Gadgetoid commented 5 years ago

Ooops, you're onto something here- manual mode has been neglected with all the other features being piled on.

Looks like you're on the right track to fixing it, but I think this will break pre-emptive mode, which still sets enable = True rather than set_fan(True)

But that said- I think pre-emptive mode would then interfere with manual mode.

I wonder if the prempt stuff should only trigger if the fan is armed?

(also good catch with the on/off threshold descriptions, I'd never have noticed those)

SofieLewis commented 5 years ago

Hi Gadgetoid, thank you so much for taking a look at my code and for the advice. My apologies to the pre-emptive mode I missed that is was using enabled. I think I see what you mean and will have another go at this. Really enjoyed getting to know the code and getting manual to work even though I broke another mode in the process :P

Sorry for the late reply have had a rough few days but look forwards to getting back into this :) Also sorry if I am using git hub wrong, I hope this is the correct place to write this.

Gadgetoid commented 5 years ago

No worries! It’s your PR so set your own pace. Lord knows I’m not the most responsive maintainer in the world.