Updated Fan Service to use Raspi fan service on Raspberry Pis
This commit is contained in:
parent
caa4c95459
commit
4c0dec3b10
1 changed files with 36 additions and 14 deletions
|
|
@ -8,6 +8,16 @@ shell.group = 'ADAFRUIT'
|
|||
|
||||
def main():
|
||||
shell.clear()
|
||||
if shell.is_raspberry_pi():
|
||||
print("""This script will enable the Raspberry Pi
|
||||
fan service, which will turn on an
|
||||
external fan controlled by a given pin
|
||||
|
||||
Operations performed include:
|
||||
- Enable Fan Service
|
||||
|
||||
Run time < 1 minute. Reboot required.""")
|
||||
else:
|
||||
print("""This script will install Adafruit
|
||||
fan service, which will turn on an
|
||||
external fan controlled by a given pin
|
||||
|
|
@ -35,6 +45,18 @@ Run time < 1 minute. Reboot not required.""")
|
|||
else:
|
||||
shell.bail("Unrecognised init system")
|
||||
|
||||
if shell.is_raspberry_pi():
|
||||
shell.info('Enabling Raspberry Pi Fan Service on GPIO 4')
|
||||
shell.run_command("sudo raspi-config nonint do_fan 0 4")
|
||||
shell.info('Done!')
|
||||
if not shell.prompt("REBOOT NOW?", default="y"):
|
||||
print("Exiting without reboot.")
|
||||
shell.exit()
|
||||
print("Reboot started...")
|
||||
os.sync()
|
||||
shell.reboot()
|
||||
shell.exit()
|
||||
else:
|
||||
shell.info('Adding adafruit_fan.service')
|
||||
contents = """[Unit]
|
||||
Description=Fan service for some Adafruit boards
|
||||
|
|
|
|||
Loading…
Reference in a new issue