Skip to content

Commit 998b859

Browse files
Update UnityMapper to use new signal status flags
1 parent 3f23879 commit 998b859

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

UnityMapper/Instances/SignalCollection.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,19 @@ public void Update()
6060
{
6161
foreach (var id in _signals.Keys)
6262
{
63-
var newVal = _signal.GetValue(id);
64-
var localVal = _signals[id].Property.GetValue();
65-
66-
if ((newVal.Item2 > _lastUpdates[id] || _spec.Type == SignalType.WriteOnly)
67-
&& _spec.Type != SignalType.ReadOnly) // only read from network if this signal is not a read-only signal
63+
var status = _signal.FetchStatus((long) id);
64+
if (status.HasFlag(Signal.StatusFlags.SetRemote))
6865
{
69-
// read value from network
70-
if (newVal.Item1 == null) continue;
71-
_signals[id].Property.SetObject(newVal.Item1);
66+
// update local
67+
var value = _signal.GetValue(id);
68+
_signals[id].Property.SetObject(value.Item1);
7269
}
73-
else if (newVal.Item1 != localVal)
70+
else
7471
{
75-
// push value to network
76-
_signal.SetValue(localVal, id);
72+
//push local
73+
var value = _signals[id].Property.GetValue();
74+
_signal.SetValue(value, id);
7775
}
78-
_lastUpdates[id] = _device.Time;
7976
}
8077
}
8178

UnityMapper/UnityMapper.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="Mapper.NET" Version="2.4.6.3" />
19+
<PackageReference Include="Mapper.NET" Version="2.4.7-alpha2" />
2020
<PackageReference Include="Unity3D" Version="2.1.3" />
2121
</ItemGroup>
2222

0 commit comments

Comments
 (0)