From 5f1417898910d64e564fd9bc522db0af698de9ab Mon Sep 17 00:00:00 2001 From: Sassan Haradji Date: Tue, 16 Apr 2024 15:41:06 +0400 Subject: [PATCH] =?UTF-8?q?build(bootstrap):=20add=20`dtoverlay=3Dgpio-fan?= =?UTF-8?q?,gpiopin=3D22,temp=3D60000`=20to=20`/boot/firmware/config.txt`?= =?UTF-8?q?=20to=20make=20the=20fan=20run=20if=20CPU=20temperature=20passe?= =?UTF-8?q?s=2060=E2=84=83=20#64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ ubo_app/system/bootstrap.py | 8 ++++++++ ubo_app/system/install_wm8960.sh | 1 + 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c894c9d4..cbdc7a65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## Version 0.12.7 - feat(notification): make the extra information screen scrollable +- build(bootstrap): add `dtoverlay=gpio-fan,gpiopin=22,temp=60000` to `/boot/config.txt` + to make the fan run if CPU temperature passes 60℃ #64 ## Version 0.12.6 diff --git a/ubo_app/system/bootstrap.py b/ubo_app/system/bootstrap.py index 1d51e205..66ca6dd6 100644 --- a/ubo_app/system/bootstrap.py +++ b/ubo_app/system/bootstrap.py @@ -161,6 +161,12 @@ def enable_services() -> None: ) +def configure_fan() -> None: + """Configure the behavior of the fan.""" + with Path('/boot/config.txt').open('a') as config_file: + config_file.write('dtoverlay=gpio-fan,gpiopin=22,temp=60000\n') + + def setup_polkit() -> None: """Create the polkit rules file.""" with Path('/etc/polkit-1/rules.d/50-ubo.rules').open('w') as file: @@ -223,6 +229,8 @@ def bootstrap(*, with_docker: bool = False, for_packer: bool = False) -> None: check=True, ) + configure_fan() + reload_daemon() enable_services() diff --git a/ubo_app/system/install_wm8960.sh b/ubo_app/system/install_wm8960.sh index 556ed06c..6d7f4271 100755 --- a/ubo_app/system/install_wm8960.sh +++ b/ubo_app/system/install_wm8960.sh @@ -58,6 +58,7 @@ cp wm8960-soundcard /usr/bin/ chmod -x wm8960-soundcard.service cp wm8960-soundcard.service /lib/systemd/system/ systemctl enable wm8960-soundcard.service +#systemctl start wm8960-soundcard cd .. rm -rf WM8960-Audio-HAT