This commit is contained in:
Meliox 2025-09-06 23:55:14 +02:00
parent 4d75d471fe
commit d52f4b0fac

View File

@ -800,6 +800,7 @@ generate_cpu_widget() {
const INTELPackageCaption = '$CPU_TEMP_TARGET' == 'Core' ? 'Core' : 'Package'; const INTELPackageCaption = '$CPU_TEMP_TARGET' == 'Core' ? 'Core' : 'Package';
let AMDPackagePrefix = 'Tccd'; let AMDPackagePrefix = 'Tccd';
let AMDPackageCaption = 'Chiplet'; let AMDPackageCaption = 'Chiplet';
if (cpuKeysA.length > 0) { if (cpuKeysA.length > 0) {
let bTccd = false; let bTccd = false;
let bTctl = false; let bTctl = false;
@ -812,28 +813,33 @@ generate_cpu_widget() {
}); });
if (bTccd && bTctl && '$CPU_TEMP_TARGET' == 'Core') { if (bTccd && bTctl && '$CPU_TEMP_TARGET' == 'Core') {
AMDPackagePrefix = 'Tccd'; AMDPackagePrefix = 'Tccd';
AMDPackageCaption = 'Chiplet'; AMDPackageCaption = 'Ccd';
} else if (bTdie) { } else if (bTdie) {
AMDPackagePrefix = 'Tdie'; AMDPackagePrefix = 'Tdie';
AMDPackageCaption = 'Temp'; AMDPackageCaption = 'Die';
} else if (bTctl) { } else if (bTctl) {
AMDPackagePrefix = 'Tctl'; AMDPackagePrefix = 'Tctl';
AMDPackageCaption = 'Temp'; AMDPackageCaption = 'Ctl';
} else { } else {
AMDPackagePrefix = 'temp'; AMDPackagePrefix = 'temp';
AMDPackageCaption = 'Temp'; AMDPackageCaption = 'Temp';
} }
} }
const cpuKeys = bINTEL ? cpuKeysI : cpuKeysA; const cpuKeys = bINTEL ? cpuKeysI : cpuKeysA;
const cpuItemPrefix = bINTEL ? INTELPackagePrefix : AMDPackagePrefix; const cpuItemPrefix = bINTEL ? INTELPackagePrefix : AMDPackagePrefix;
const cpuTempCaption = bINTEL ? INTELPackageCaption : AMDPackageCaption; const cpuTempCaption = bINTEL ? INTELPackageCaption : AMDPackageCaption;
const formatTemp = bINTEL ? '0' : '0.0'; const formatTemp = bINTEL ? '0' : '0.0';
const cpuCount = cpuKeys.length; const cpuCount = cpuKeys.length;
let temps = []; let temps = [];
cpuKeys.forEach((cpuKey, cpuIndex) => { cpuKeys.forEach((cpuKey, cpuIndex) => {
let cpuTemps = []; let cpuTemps = [];
const items = objValue[cpuKey]; const items = objValue[cpuKey];
const itemKeys = Object.keys(items).filter(item => { return String(item).includes(cpuItemPrefix); }); const itemKeys = Object.keys(items).filter(item => {
return String(item).includes(cpuItemPrefix) || String(item).startsWith('Tccd');
});
itemKeys.forEach((coreKey) => { itemKeys.forEach((coreKey) => {
try { try {
let tempVal = NaN, tempMax = NaN, tempCrit = NaN; let tempVal = NaN, tempMax = NaN, tempCrit = NaN;
@ -846,6 +852,7 @@ generate_cpu_widget() {
tempCrit = cpuTempHelper.getTemp(parseFloat(items[coreKey][secondLevelKey])); tempCrit = cpuTempHelper.getTemp(parseFloat(items[coreKey][secondLevelKey]));
} }
}); });
if (!isNaN(tempVal)) { if (!isNaN(tempVal)) {
let tempStyle = ''; let tempStyle = '';
if (!isNaN(tempMax) && tempVal >= tempMax) { if (!isNaN(tempMax) && tempVal >= tempMax) {
@ -854,7 +861,21 @@ generate_cpu_widget() {
if (!isNaN(tempCrit) && tempVal >= tempCrit) { if (!isNaN(tempCrit) && tempVal >= tempCrit) {
tempStyle = 'color: red; font-weight: bold;'; tempStyle = 'color: red; font-weight: bold;';
} }
let tempStr = ''; let tempStr = '';
// Enhanced parsing for AMD Tccd temperatures
if (coreKey.startsWith('Tccd')) {
let tempIndex = coreKey.match(/Tccd(\d+)/);
if (tempIndex !== null && tempIndex.length > 1) {
tempIndex = tempIndex[1];
tempStr = `${cpuTempCaption}&nbsp;${tempIndex}:&nbsp;<span style="${tempStyle}">${Ext.util.Format.number(tempVal, formatTemp)}${cpuTempHelper.getUnit()}</span>`;
} else {
tempStr = `${cpuTempCaption}:&nbsp;<span style="${tempStyle}">${Ext.util.Format.number(tempVal, formatTemp)}${cpuTempHelper.getUnit()}</span>`;
}
}
// Enhanced parsing for Intel cores (P-Core, E-Core, regular Core)
else {
let tempIndex = coreKey.match(/(?:P\s+Core|E\s+Core|Core)\s*(\d+)/); let tempIndex = coreKey.match(/(?:P\s+Core|E\s+Core|Core)\s*(\d+)/);
if (tempIndex !== null && tempIndex.length > 1) { if (tempIndex !== null && tempIndex.length > 1) {
tempIndex = tempIndex[1]; tempIndex = tempIndex[1];
@ -869,21 +890,28 @@ generate_cpu_widget() {
cpuTempCaption; cpuTempCaption;
tempStr = `${coreType}:&nbsp;<span style="${tempStyle}">${Ext.util.Format.number(tempVal, formatTemp)}${cpuTempHelper.getUnit()}</span>`; tempStr = `${coreType}:&nbsp;<span style="${tempStyle}">${Ext.util.Format.number(tempVal, formatTemp)}${cpuTempHelper.getUnit()}</span>`;
} }
}
cpuTemps.push(tempStr); cpuTemps.push(tempStr);
} }
} catch (e) { /*_*/ } } catch (e) { /*_*/ }
}); });
if(cpuTemps.length > 0) { if(cpuTemps.length > 0) {
temps.push(cpuTemps); temps.push(cpuTemps);
} }
}); });
let result = ''; let result = '';
temps.forEach((cpuTemps, cpuIndex) => { temps.forEach((cpuTemps, cpuIndex) => {
const strCoreTemps = cpuTemps.map((strTemp, index, arr) => { return strTemp + (index + 1 < arr.length ? (itemsPerRow > 0 && (index + 1) % itemsPerRow === 0 ? '<br>' : '&nbsp;| ') : ''); }) const strCoreTemps = cpuTemps.map((strTemp, index, arr) => {
return strTemp + (index + 1 < arr.length ? (itemsPerRow > 0 && (index + 1) % itemsPerRow === 0 ? '<br>' : '&nbsp;| ') : '');
})
if(strCoreTemps.length > 0) { if(strCoreTemps.length > 0) {
result += (cpuCount > 1 ? `CPU ${cpuIndex+1}: ` : '') + strCoreTemps.join('') + (cpuIndex < cpuCount ? '<br>' : ''); result += (cpuCount > 1 ? `CPU ${cpuIndex+1}: ` : '') + strCoreTemps.join('') + (cpuIndex < cpuCount ? '<br>' : '');
} }
}); });
return '<div style="text-align: left; margin-left: 28px;">' + (result.length > 0 ? result : 'N/A') + '</div>'; return '<div style="text-align: left; margin-left: 28px;">' + (result.length > 0 ? result : 'N/A') + '</div>';
} }
}, },