修复TemperatureData.cs中的float到int隐式转换错误,添加显式类型转换
This commit is contained in:
@@ -5411,8 +5411,6 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
}
|
||||
|
||||
// 注释:该方法已在文件上方定义,避免重复实现
|
||||
|
||||
/// <summary>
|
||||
/// 停止定期连接状态检查(兼容Form1)
|
||||
/// </summary>
|
||||
@@ -5421,17 +5419,6 @@ namespace JoyD.Windows.CS.Toprie
|
||||
StopConnectionCheck();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 尝试ping设备IP地址
|
||||
/// </summary>
|
||||
/// <param name="ipAddress">设备IP地址</param>
|
||||
/// <returns>是否ping通</returns>
|
||||
// PingDevice方法已在文件上方定义,删除重复实现
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存温度数据到CSV文件
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,6 +12,13 @@ namespace JoyD.Windows.CS.Toprie
|
||||
/// </summary>
|
||||
public class TemperatureData
|
||||
{
|
||||
/// <summary>
|
||||
/// 静态温度数据映射表,线程安全
|
||||
/// 键:宽_高
|
||||
/// 值:x_y -> x,y
|
||||
/// </summary>
|
||||
private static readonly ConcurrentDictionary<string, ConcurrentDictionary<string,List<int>>> _temperatureMap = new ConcurrentDictionary<string, ConcurrentDictionary<string, List<int>>>();
|
||||
|
||||
/// <summary>
|
||||
/// 原始温度数据矩阵(未温补)
|
||||
/// 格式: [行][列]
|
||||
@@ -74,7 +82,26 @@ namespace JoyD.Windows.CS.Toprie
|
||||
// 创建512×384的实际温度矩阵
|
||||
RealTemperatureMatrix = new float[384, 512];
|
||||
Timestamp = DateTime.Now;
|
||||
|
||||
String key = $"{width}_{height}";
|
||||
ConcurrentDictionary<String,List<int>> map = _temperatureMap.GetOrAdd(key, new ConcurrentDictionary<string, List<int>>());
|
||||
if (map.IsEmpty)
|
||||
{
|
||||
// 计算映射比例(从原始分辨率映射到512×384)
|
||||
float rowRatio = 384.0f / Height;
|
||||
float colRatio = 512.0f / Width;
|
||||
for (int row = 0; row < 384; row++)
|
||||
{
|
||||
for (int col = 0; col < 512; col++)
|
||||
{
|
||||
int x = (int)(col / colRatio);
|
||||
int y = (int)(row / rowRatio);
|
||||
key = $"{x}_{y}";
|
||||
List<int> toXY = map.GetOrAdd(key, new List<int>());
|
||||
toXY.Add(row);
|
||||
toXY.Add(col);
|
||||
}
|
||||
}
|
||||
}
|
||||
ParseRawData(rawData, compensationValue);
|
||||
CalculateStatistics();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user