diff --git a/Code/devterm_fan_daemon_cpi_a06/README.md b/Code/devterm_fan_daemon_cpi_a06/README.md index 529cb7c..f739d16 100644 --- a/Code/devterm_fan_daemon_cpi_a06/README.md +++ b/Code/devterm_fan_daemon_cpi_a06/README.md @@ -8,7 +8,7 @@ wget -O - https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg | sudo apt-key add - echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" | sudo tee -a /etc/apt/sources.list.d/clockworkpi.list -sudo apt update && apt install -y devterm-fan-daemon-cpi-a06 devterm-wiringpi-cpi +sudo apt update && apt install -y devterm-fan-daemon-cpi-a06 ``` ## Change the threshold temperature diff --git a/Code/devterm_fan_daemon_cpi_a06/temp_fan_daemon_a06.py b/Code/devterm_fan_daemon_cpi_a06/temp_fan_daemon_a06.py index a8a0349..f84af2a 100755 --- a/Code/devterm_fan_daemon_cpi_a06/temp_fan_daemon_a06.py +++ b/Code/devterm_fan_daemon_cpi_a06/temp_fan_daemon_a06.py @@ -13,18 +13,21 @@ max_freq = 0 MAX_TEMP=70000 ONCE_TIME=30 +gpiopath="/sys/class/gpio" +gpiopin=96 def init_fan_gpio(): - os.popen("gpio mode 41 out") + if not os.path.exists("%s/gpio%i" % (gpiopath,gpiopin)): + open("%s/export" % (gpiopath),"w").write(str(gpiopin)) + open("%s/gpio%i/direction" % (gpiopath,gpiopin),"w").write("out") def fan_on(): init_fan_gpio() - os.popen("gpio write 41 1") + open("%s/gpio%i/value" % (gpiopath,gpiopin),"w").write("1") time.sleep(ONCE_TIME) def fan_off(): init_fan_gpio() - os.popen("gpio write 41 0") - + open("%s/gpio%i/value" % (gpiopath,gpiopin),"w").write("0") def isDigit(x): try: