Skip to content

Add CPU temp sensor path selection option#8012

Merged
MichaIng merged 6 commits intoMichaIng:devfrom
N7-BADA:cpu-temp-sysfs-selection
Mar 14, 2026
Merged

Add CPU temp sensor path selection option#8012
MichaIng merged 6 commits intoMichaIng:devfrom
N7-BADA:cpu-temp-sysfs-selection

Conversation

@N7-BADA
Copy link

@N7-BADA N7-BADA commented Mar 11, 2026

Closes #7870

Adds option to manually select CPU temperature sensor path.

Changes:

  • dietpi.txt: new SOFTWARE_DIETPI_CPU_TEMP_PATH setting
  • dietpi-globals: check for user-defined path before auto-detection
  • dietpi-config: menu option under Display Options to select sensor from available sysfs nodes

Users can pick from detected sensors, enter a custom path, or keep auto-detect.

@nonnorm
Copy link
Collaborator

nonnorm commented Mar 11, 2026

Note for myself: read through this PR later and see if it could be applied to make dashboard temp sensing more accurate.

@MichaIng MichaIng added this to the v10.2 milestone Mar 11, 2026
@MichaIng MichaIng linked an issue Mar 11, 2026 that may be closed by this pull request
1 task
@N7-BADA
Copy link
Author

N7-BADA commented Mar 11, 2026

Applied both suggestions, renamed the setting from SOFTWARE_DIETPI_CPU_TEMP_PATH to CONFIG_CPU_TEMP_PATH
Switched default handling to explicit CONFIG_CPU_TEMP_PATH=auto
Updated dietpi-globals to use:

: "${G_HW_CPU_TEMP_PATH:=$(sed -n 's/^CONFIG_CPU_TEMP_PATH=//p' /boot/dietpi.txt)}"
[[ $G_HW_CPU_TEMP_PATH == 'auto' ]] && G_HW_CPU_TEMP_PATH=

Updated dietpi-config accordingly to use CONFIG_CPU_TEMP_PATH
Simplified the menu handler so all selection paths end in a single:

G_CONFIG_INJECT 'CONFIG_CPU_TEMP_PATH=' "CONFIG_CPU_TEMP_PATH=$G_WHIP_RETURNED_VALUE" /boot/dietpi.txt

Tested again with new changes and still works.

@N7-BADA N7-BADA requested a review from MichaIng March 12, 2026 22:01
@MichaIng MichaIng force-pushed the cpu-temp-sysfs-selection branch from d444016 to 5beefa7 Compare March 14, 2026 13:30
@MichaIng
Copy link
Owner

MichaIng commented Mar 14, 2026

I moved the menu to performance options and simplified it by using the sensor paths as menu index. Also added the coretemp API. But those paths can be long, let's see whether it looks fine, else we could implement some mechanism to only show the last X characters in the menu, prefixed with ... or so.

The display options are meant to be about video output and camera features. The benefit about performance options is that it already shows the temperature above the menu. So one can see the effect immediately, and if spottet false temperature there the right option is right below.

N7-BADA added 2 commits March 14, 2026 14:41
Implements sysfs node selection for CPU temp MichaIng#7870
- Add SOFTWARE_DIETPI_CPU_TEMP_PATH option in dietpi.txt
- Add sensor selection in dietpi-config Display Options
- Update dietpi-globals to use custom path
@MichaIng MichaIng force-pushed the cpu-temp-sysfs-selection branch from 5beefa7 to 38cd64c Compare March 14, 2026 13:41
And simplify menu/code by using the path itself as index
@MichaIng MichaIng force-pushed the cpu-temp-sysfs-selection branch from 38cd64c to 5cc4229 Compare March 14, 2026 13:55
Copy link
Owner

@MichaIng MichaIng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great. On narrow screens it might look weird, but otherwise the max menu width of 120 characters has more than enough space.

@MichaIng MichaIng merged commit f756df5 into MichaIng:dev Mar 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DietPi-Banner | Implement sysfs node selection for CPU temp

4 participants