Fix sensor detection when only cpu is present

Co-authored-by: Meliox <na>
This commit is contained in:
Meliox 2025-03-02 20:40:01 +01:00 committed by GitHub
parent e655a9a324
commit 981c781868
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -112,28 +112,43 @@ function configure {
err "Sensor output error.\n\nCommand output:\n${sensorsOutput}\n\nExiting...\n" err "Sensor output error.\n\nCommand output:\n${sensorsOutput}\n\nExiting...\n"
fi fi
# Prompt user for which temperature to use # Check if CPU is part of known list for autoconfiguration
while true; do msg "\nDetecting support for CPU temperature sensors..."
local choiceTempDisplayType=$(ask "Do you wish to display temperatures for all cores [C] or just an average temperature per CPU [a] (note: AMD only supports average)? (C/a)") supportedCPU=false
case "$choiceTempDisplayType" in for item in "${KNOWN_CPU_SENSORS[@]}"; do
# Set temperature search criteria if (echo "$sensorsOutput" | grep -q "$item"); then
[cC] | "") echo $item
CPU_TEMP_TARGET="Core" supportedCPU=true
info "Temperatures will be displayed for all cores." fi
;;
[aA])
CPU_TEMP_TARGET="Package"
info "An average temperature will be displayed per CPU."
;;
*)
# If the user enters an invalid input, print an warning message and retry ask.
warn "Invalid input."
continue
;;
esac
break
done done
# Prompt user for which CPU temperature to use
if [ $supportedCPU = true ]; then
while true; do
local choiceTempDisplayType=$(ask "Do you wish to display temperatures for all cores [C] or just an average temperature per CPU [a] (note: AMD only supports average)? (C/a)")
case "$choiceTempDisplayType" in
# Set temperature search criteria
[cC] | "")
CPU_TEMP_TARGET="Core"
info "Temperatures will be displayed for all cores."
;;
[aA])
CPU_TEMP_TARGET="Package"
info "An average temperature will be displayed per CPU."
;;
*)
# If the user enters an invalid input, print an warning message and retry as>
warn "Invalid input."
continue
;;
esac
break
done
SENSORS_DETECTED=true
else
warn "No CPU temperature sensors found."
fi
# Look for ram temps # Look for ram temps
msg "\nDetecting support for RAM temperature sensors..." msg "\nDetecting support for RAM temperature sensors..."
if (echo "$sensorsOutput" | grep -q '"SODIMM":'); then if (echo "$sensorsOutput" | grep -q '"SODIMM":'); then