View Issue Details

IDProjectCategoryView StatusLast Update
0003091SpeedFanConfigurationpublic2021-01-05 05:25
Reporteravenger Assigned Toalfredo  
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version4.52 
Summary0003091: Profile support
DescriptionI miss a "fan profile setting" support.

It would be nice to have a way to switch fan settings profiles, say between "silent" and "cool", or "average", having a means to save profiles.
Additional InformationI have found a way to "kind of" save and load settings.

Observing how speedfan works, if we close the application, it keeps the fan speeds no matter how temperature changes (if we switched said fans to "software controlled"). It simply won't actuate as temperatures changes, because it is no longer monitoring temps.

If closed, we can just copy over the speedfan{params,sens}.cfg files somewhere else and "save" that file pair as a "Profile".

Trying to copy or replace these files while speedfan is open, results in all sorts of random crashes, so it is not a good idea.

So, as long as the process is closed, we can "load profiles" and re-open speedfan to apply the new settings.

I have then written a simple bash script to save current settings to a profile directory and restore it, tracking whether speedfan is running or not (script attached, tested under cygwin).

It would be nice to have a means to be able to do this from within SpeedFan, though! Or at least, maybe, support "hot-file-replacing", as closing and reopening speedfan can be a cumbersome process (as it probes all sensors again -- and requires administrative permissions).
TagsNo tags attached.
Motherboard ModelGA-Z97M-D3H
Video Card Model

Activities

avenger

2020-05-17 08:36

reporter  

profile_select.sh (2,978 bytes)   
#!/bin/bash

_ifs="${IFS}"

profilelist=()
function load_profiles() {
 IFS=$'\n'
 profilelist=($(find profiles -mindepth 1 -maxdepth 1 -type d))
 IFS="${_ifs}"
}

function switch_profile() {
 local profile_folder="${1}" profile_name="${profile_folder##*/}"
 local resp pid
 
 echo "Should switch to profile '${profile_folder}'."
 
 if speedfan_running; then
  echo -n "Speedfan is currently running. Please close it before the configuration
profile can be switched.
Waiting. Press 'c' to cancel, or 'k' to attempt to kill it . . ."
  while speedfan_running; do
   read -n 1 -s -t 0.25 resp
   
   if [ "${resp}" == "c" ]; then
    break
   elif [ "${resp}" == "k" ]; then
    pid="$(tasklist /fi "imagename eq speedfan.exe" /fo list | egrep "^PID:" | head -n1 | strings | sed -E "s/^PID: +//")"
    echo -n "
Killing process id ${pid}..."
    taskkill /pid "${pid}"
    sleep 1
    if speedfan_running; then
     echo "Unable to stop SpeedFan."
    fi
    break
   fi
  done

  if ! speedfan_running; then
   echo "
Speedfan process interrupted."
  else
   echo "
Cancelling profile update process."
   return 1
  fi
 fi
 
 echo -n "Updating profile: "
 cp "${profile_folder}"/speedfan{params,sens}.cfg .
 echo "done.
   
*** Restart speedfan to apply changes!"
}

function speedfan_running() {
 if [ "$(tasklist /fi "imagename eq speedfan.exe" /fo list | wc -l)" -gt 1 ]; then
  return 0
 else
  return 1
 fi
}

function save_profile() {
 local resp
 
 while true; do
 echo -n "
- Enter new profile name (empty to cancel): "
  read resp
  if [ -z "${resp}" ]; then
   echo "Profile name must not be empty."
   return 0
  elif [ ! -z "${resp//[a-zA-Z0-9_-]}" ]; then
   echo "Invalid profile name: ${resp}"
  else
   break
  fi
 done

 if [ -e "profiles/${resp}" ]; then
  echo "Unable to create profile: file exists."
  return 1
 fi
 
 if ! mkdir "profiles/${resp}" > /dev/null 2>&1; then
  echo "Error creating profile directory. Aborting."
  return 1
 fi
 
 if ! cp speedfan{params,sens}.cfg "profiles/${resp}"/. > /dev/null 2>&1; then
  echo "Error copying settings to profile."
  return 1
 fi
 
 load_profiles
 echo "Created profile: ${resp}."
}

load_profiles

if [ ${#profilelist[@]} -lt 1 ]; then
 echo "No profile to switch to. Create one from the current setup with --create."
 exit 1
fi

while true; do
 echo "Available profiles: "
 prid=1
 for profiledir in "${profilelist[@]}"; do
  echo "${prid}. ${profiledir##*/}"
  prid="$(( 10#${prid} + 1 ))"
  if [ -e "${profiledir}/descript.ion" ]; then
   cat "${profiledir}/descript.ion" | while read line; do
    echo "    ${line}"
   done
  fi
 done

 echo -n "s. Save current SpeedFan settings to a new profile.
q. Quit without changing.

- Choose a profile to switch to: "
 read -n1 resp

 if [ -z "${resp/[0-9]}" ]; then
  echo ""
  switch_profile "${profilelist[resp-1]}"
  exit 0
 elif [ "${resp}" == "s" ]; then
  save_profile
 elif [ "${resp}" == "q" ]; then
  echo "
Exitting without changes."
  exit 0
 fi
done
profile_select.sh (2,978 bytes)   

TonyMai

2021-01-05 05:25

reporter   ~0009453

let's play https://puzzle-jigsaw.com

Issue History

Date Modified Username Field Change
2020-05-17 08:36 avenger New Issue
2020-05-17 08:36 avenger Assigned To => alfredo
2020-05-17 08:36 avenger File Added: profile_select.sh
2021-01-05 05:25 TonyMai Note Added: 0009453