修复温度数据计算逻辑:修正高低字节顺序并添加2730的开尔文到摄氏度转换

This commit is contained in:
zqm
2025-10-31 11:23:27 +08:00
parent aa06408621
commit de511c8f2f

View File

@@ -122,10 +122,11 @@ namespace JoyD.Windows.CS.Toprie
{
if (dataIndex + 1 < rawData.Length)
{
// 按照SDK文档计算温度值:摄氏温度=(H*256+L)/10
int highByte = rawData[dataIndex];
int lowByte = rawData[dataIndex + 1];
float rawTemperature = (highByte * 256 + lowByte) / 10.0f;
// 按照SDK实际实现计算温度值:摄氏温度=(L + H*256 - 2730)/10
// 注意SDK实现是低字节在前高字节在后且包含2730的开尔文到摄氏度转换
int lowByte = rawData[dataIndex];
int highByte = rawData[dataIndex + 1];
float rawTemperature = (lowByte + highByte * 256 - 2730) / 10.0f;
float compensatedTemperature = rawTemperature + compensationValue;
// 原始温度存入TemperatureMatrix未温补