修复温度数据计算逻辑:修正高低字节顺序并添加2730的开尔文到摄氏度转换
This commit is contained in:
@@ -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(未温补)
|
||||
|
||||
Reference in New Issue
Block a user