* Add cooling profile support with "aggressive" "moderate" "quiet" and "custom" settings.

* Quiet - the current default fan curve (Set by default)
  * Moderate - Low speed default, scales slightly more aggressively.
  * Aggressive - Always on, full speed.
  * Custom - Utilizes ~/.config/fancontrol.conf to allow user modified curves
This commit is contained in:
fewtarius 2022-03-03 16:55:39 -05:00
parent e135f93ff8
commit e42ccd087a
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
5 changed files with 33 additions and 8 deletions

View file

@ -8,6 +8,7 @@ splash.enabled=0
advmame_auto_gamepad=0
system.hostname=JELOS
rotate.root.password=1
cooling.profile=quiet
wifi.enabled=0
audio.bgmusic=1
controllers.bluetooth.enabled=1

View file

@ -3,7 +3,7 @@
# Copyright (C) 2020-present Fewtarius
PKG_NAME="emulationstation"
PKG_VERSION="7f02269"
PKG_VERSION="e0b8f2f"
PKG_GIT_CLONE_BRANCH="main"
PKG_REV="1"
PKG_ARCH="any"

View file

@ -4,17 +4,41 @@
. /etc/profile
if [ -e "/storage/.config/fancontrol.conf" ]
DEBUG=false
COOLING_PROFILE=$(get_setting "cooling.profile")
FAN_PWM="${DEVICE_PWM_FAN}"
$DEBUG && echo "Setting profile to ${COOLING_PROFILE}"
if [ -e "/storage/.config/fancontrol.conf" ] && [ "${COOLING_PROFILE}" = "custom" ]
then
$DEBUG && echo "Loading configuration file" 2>/dev/null
source /storage/.config/fancontrol.conf
if [ ! $? = 0 ]
then
WARN="Custom fan profile could not be loaded, defaulting to quiet."
$DEBUG && echo "${WARN}"
logger -t fancontrol "${WARN}"
COOLING_PROFILE="quiet"
set_setting cooling.profile quiet
fi
fi
if [ "${COOLING_PROFILE}" = "aggressive" ]
then
SPEEDS=(255)
TEMPS=(0)
elif [ "${COOLING_PROFILE}" = "moderate" ]
then
SPEEDS=(255 190 125 85)
TEMPS=(70000 60000 50000 0)
else
$DEBUG && echo "Configuration not found, loading defaults" 2>/dev/null
FAN_PWM="${DEVICE_PWM_FAN}"
# Quiet.
SPEEDS=(255 127 85 0)
TEMPS=(75000 65000 55000 0)
fi
while true
do
INDEX=0

View file

@ -1,3 +1,6 @@
# To enable custom fan control, set the cooling profile to custom, or run
# set_setting cooling.profile custom
#
# Set to true or export it as a variable if you want debug output.
# To test:
#
@ -11,9 +14,6 @@
# Disable debugging by default
DEBUG=false
# This is the location of the PWM control, you don't need to change it.
FAN_PWM="/sys/class/hwmon/hwmon0/pwm1"
## Fan speeds range from off (0) to full (255).
## Define a speed for each temperature that you define. Order matters.
SPEEDS=(255 127 85 0)

View file

@ -32,7 +32,7 @@ clean_package() {
fi
done
rm -f "${STAMPS}/${1}/build_"*
rm -rf "${BUILD}/image/.stamps/${1}"
rm -rf "${BUILD}/image/.stamps/${1}/*"
}
if [ "${1}" = "--all" -a -n "${2}" ]; then