Skip to content

Live Monitor mode uses cached temperature values #6

@edward-bailey

Description

@edward-bailey

Description:
The Get-ParsedTemperature function matches the first CPU temperature occurrence in dumpsys thermalservice output, which comes from the "Cached temperatures" section rather than the "Current temperatures from HAL" section. Aka the device shows 37 degrees under load, not 66.5
Image

Device: Nvidia Shield TV Pro 2019
Expected behaviour: Report current/live CPU temperature (66.5°C)
Actual behaviour: Reports stale cached temperature (37.0°C)
ADB Thermal output sample:

PS C:\Users\ShieldUser\Desktop> adb shell dumpsys thermalservice  
IsStatusOverride: false  
ThermalEventListeners:  
        callbacks: 1  
        killed: false  
        broadcasts count: -1  
ThermalStatusListeners:  
        callbacks: 2  
        killed: false  
        broadcasts count: -1  
Thermal Status: 0  
Cached temperatures:  
        Temperature{mValue=36.0, mType=1, mName=GPU, mStatus=0}  
        Temperature{mValue=37.0, mType=0, mName=CPU0, mStatus=0}  
        Temperature{mValue=37.0, mType=0, mName=CPU1, mStatus=0}  
        Temperature{mValue=37.0, mType=0, mName=CPU2, mStatus=0}  
        Temperature{mValue=37.0, mType=0, mName=CPU3, mStatus=0}   
HAL Ready: true  
HAL connection:  
        ThermalHAL 1.0 connected: yes  
Current temperatures from HAL:  
        Temperature{mValue=67.5, mType=0, mName=CPU0, mStatus=0}  
        Temperature{mValue=67.5, mType=0, mName=CPU1, mStatus=0}  
        Temperature{mValue=67.5, mType=0, mName=CPU2, mStatus=0}  
        Temperature{mValue=67.5, mType=0, mName=CPU3, mStatus=0}  
        Temperature{mValue=68.0, mType=1, mName=GPU, mStatus=0}  
Current cooling devices from HAL:  
        CoolingDevice{mValue=0, mType=0, mName=FAN} 

Root cause:
The regex matches the first occurrence (cached), not the current HAL values.

mValue=([\d\.]+).*mName=CPU\d*

Suggested fix:
Prioritise matching within the "Current temperatures from HAL" section:

Current temperatures from HAL:[\s\S]*?Temperature\{mValue=([\d\.]+),.*?mType=0,.*?mName=CPU
function Get-ParsedTemperature {
    param([string]$ThermalOutput)

    if (-not $ThermalOutput) { return "N/A" }

    # Try different thermal output formats
    # Check HAL section first
    if ($ThermalOutput -match "Current temperatures from HAL:[\s\S]*?Temperature\{mValue=([\d\.]+),.*?mType=0,.*?mName=CPU") {
        return [math]::Round([float]$matches[1], 1)
    }
    if ($ThermalOutput -match "mValue=([\d\.]+).*mName=CPU\d*,") {
        return [math]::Round([float]$matches[1], 1)
    }
    elseif ($ThermalOutput -match "mValue=([\d\.]+).*mName=soc_thermal") {
        return [math]::Round([float]$matches[1], 1)
    }
    elseif ($ThermalOutput -match "Temperature\{mValue=([\d\.]+),.*mType=0") {
        return [math]::Round([float]$matches[1], 1)
    }

    return "N/A"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions