Skip to content

Instantly share code, notes, and snippets.

@Lessica
Created March 25, 2022 17:07
Show Gist options
  • Save Lessica/30240b63ac0e47d80a919209ea006c60 to your computer and use it in GitHub Desktop.
Save Lessica/30240b63ac0e47d80a919209ea006c60 to your computer and use it in GitHub Desktop.
Configure Raspberry Pi + Argon One Case for Lineage OS
#!/system/bin/sh
sleeptime=120
while true
do
cputemp=$(cat /sys/class/thermal/thermal_zone0/temp)
if [[ $cputemp -lt 55000 ]]; then
fanspeed="0x00"
elif [ $cputemp -ge 55000 -a $cputemp -lt 60000 ]; then
fanspeed="0x10"
elif [ $cputemp -ge 60000 -a $cputemp -lt 65000 ]; then
fanspeed="0x32"
elif [ $cputemp -ge 65000 ]; then
fanspeed="0x64"
fi
i2cget -y 1 0x01a $fanspeed
sleep $sleeptime
done
@bernardovalente
Copy link

just in case if your fan running on official gpio 14 pin or you have pwm controlled fan, you can use this script to control fan.

sleeptime=120
echo 14 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio14/direction
echo 0 > /sys/class/gpio/gpio14/value
echo `date` > /data/local/fan-script.log

while true
do
	cputemp=$(cat /sys/class/thermal/thermal_zone0/temp)
	echo $cputemp >> /data/local/fan-script.log
	if [[ $cputemp -lt 55000 ]]; then
		echo 0 > /sys/class/gpio/gpio14/value
	elif [ $cputemp -ge 65000 ]; then
		echo 1 > /sys/class/gpio/gpio14/value
	fi
	sleep $sleeptime
done

I'm using the case as it came, where should I copy this file to? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment