UniCB.RRoute and SyncRoute( ) implemented, ver. 3.1.1639

This commit is contained in:
Milan Hanajik 2021-03-16 13:05:04 +01:00
parent d971831ab8
commit e8e1be644b
2 changed files with 20 additions and 4 deletions

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.1.1638.0")]
[assembly: AssemblyFileVersion("3.1.1638.0")]
[assembly: AssemblyVersion("3.1.1639.0")]
[assembly: AssemblyFileVersion("3.1.1639.0")]

View File

@ -123,7 +123,8 @@ namespace TBF.Rig.ControlBoard.Uni
/// Route: 128-bit word representing the current state of all valves and pumps
/// </summary>
public UInt128 Route { get { return benchModelRoute; } }
public UInt128 RRoute { get { return (UInt128)Data.Vystupy; } }
/// Values valid during a test
public double RefFrequency { get { return Data.ReferenceFreq[0]; } }
public double RefFrequency1 { get { return Data.ReferenceFreq[1]; } }
@ -328,6 +329,21 @@ namespace TBF.Rig.ControlBoard.Uni
rcvdData[i - lastValidOffset] = rcvdData[i];
}
rcvdBytesCount -= lastValidOffset;
/// Synchronize benchModelRoute with RRoute
SyncRoute();
}
/// <summary>
/// Set Route to value returned by RRoute. Take virtual valves into account.
/// </summary>
/// <returns>'ulong' with bits of valves that have changed set to '1'</returns>
public UInt128 SyncRoute()
{
UInt128 oldRoute = benchModelRoute;
benchModelRoute = (RRoute & routeMask) | (benchModelRoute & (~routeMask));
log.DebugFormat("SyncRoute(), new route = {0}", Utils.RouteToStr(benchModelRoute));
return oldRoute ^ benchModelRoute;
}
/// <summary>
@ -359,7 +375,7 @@ namespace TBF.Rig.ControlBoard.Uni
}
}
if (!outputsInitialized || Data.Vystupy != (ulong)benchModelRoute || (StateMachine.Time - lastStateMachineTime) >= 15)
if (!outputsInitialized || RRoute != benchModelRoute || (StateMachine.Time - lastStateMachineTime) >= 15)
{
var actionsToModify = actionQueue.Where(x => (x.ActionId == ActionID.ChangeRoute));
bool oneModified = false;