CAN驱动修改优化
This commit is contained in:
@@ -20,12 +20,22 @@ namespace UIShare.GlobalVariable
|
||||
{
|
||||
if (globalInfo?.ConfigDic == null) return "";
|
||||
if (!globalInfo.ConfigDic.TryGetValue(scope, out var systemConfig)) return "";
|
||||
if (systemConfig.ValueLimitList == null) return "";
|
||||
return CheckAlarm(fingerprint, methodName, value, systemConfig);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 直接根据 SystemConfig 的 ValueLimitList 检查当前值是否超限。
|
||||
/// 适用于不持有 GlobalInfo 引用的场景(如 CANSignalBroadcaster)。
|
||||
/// </summary>
|
||||
public static string CheckAlarm(string fingerprint, string methodName, double value, SystemConfig systemConfig)
|
||||
{
|
||||
if (systemConfig?.ValueLimitList == null) return "";
|
||||
|
||||
var limit = systemConfig.ValueLimitList.FirstOrDefault(x =>
|
||||
x.Fingerprint == fingerprint && x.MethodName == methodName);
|
||||
if (limit == null) return "";
|
||||
if (value > limit.UpperExtreme)
|
||||
|
||||
if (value > limit.UpperExtreme)
|
||||
{
|
||||
limit.IsAlarm = true;
|
||||
limit.AlarmSatus = AlarmStatus.超上极限;
|
||||
|
||||
Reference in New Issue
Block a user