Closed lightmaster closed 3 years ago
Hi, thanks for the feedback!
I find that just using the GPIO.cleanup()
can do the trick.
So I removed the setFanSpeed function in exception and add an atexit
to detect if the process is killed or not,
and now even kill the process by kill
command the fan should reset to full speed.
If you are using other GPIO pins in other scripts, will GPIO.cleanup()
effect those other pins?
If you are using other GPIO pins in other scripts, will
GPIO.cleanup()
effect those other pins?
No, GPIO.cleanup()
only effects the pins use in this script.
https://github.com/DriftKingTW/Raspberry-Pi-PWM-Fan-Control/blob/79e191710c338823fa19573017137b4afc5eb753/fan_control.py#L82
As the title says, when testing the script, when I kill the script with Ctrl+C, the fan shuts off instead of getting set to high. Can you adjust this to instead use its own variable and make it so if the script is killed by any means it'll get set to this new variable?