Commit 7ebc388c authored by 潘栩锋's avatar 潘栩锋 🚴

ModbusMapper Coil 数据读取不会更新

parent 556f69da
...@@ -238,6 +238,11 @@ namespace FLY.Modbus ...@@ -238,6 +238,11 @@ namespace FLY.Modbus
if ((bool)dr.plcValue != vals.ElementAt(idx2)) if ((bool)dr.plcValue != vals.ElementAt(idx2))
{ {
dr.plcValue = vals.ElementAt(idx2); dr.plcValue = vals.ElementAt(idx2);
dr.isPlcValueChanged = true;
}
//isPlcValueChanged 可能是上面值不一样 被设为true, 也可能是 客户端 发送数据到 PLC ,所以被强制设置为 true
if (dr.isPlcValueChanged) {
dr.ToPropertyObj(); dr.ToPropertyObj();
//触发事件 //触发事件
NotifyNameDataChanged(dr); NotifyNameDataChanged(dr);
......
...@@ -25,6 +25,11 @@ namespace FLY.OBJComponents.Common ...@@ -25,6 +25,11 @@ namespace FLY.OBJComponents.Common
{ {
throw new Exception("PropertiesManager_JSON 类型="+obj.GetType().ToString()+" 不能找到 属性名=" + propertyName, e); throw new Exception("PropertiesManager_JSON 类型="+obj.GetType().ToString()+" 不能找到 属性名=" + propertyName, e);
} }
if (property == null) {
throw new Exception("PropertiesManager_JSON 类型=" + obj.GetType().ToString() + " 不能找到 属性名=" + propertyName);
}
if (!property.CanWrite) { if (!property.CanWrite) {
throw new Exception("PropertiesManager_JSON 类型=" + obj.GetType().ToString() + " 属性名=" + propertyName +" 不能set"); throw new Exception("PropertiesManager_JSON 类型=" + obj.GetType().ToString() + " 属性名=" + propertyName +" 不能set");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment