CAN驱动修改优化

This commit is contained in:
“hsc”
2026-08-07 09:06:43 +08:00
parent deb3544143
commit 062582e238
18 changed files with 583 additions and 558 deletions
@@ -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.;