Route logging changed.

This commit is contained in:
Milan Hanajik
2021-03-24 21:39:37 +01:00
parent 25856496d8
commit 0fc8bb4ea0
5 changed files with 34 additions and 31 deletions
+2 -2
View File
@@ -196,8 +196,8 @@ namespace TBF.Rig.ControlBoard.Uni
EtPulses2 = Convert.ToInt32(GetUInt24(data, offs + (int)Poz.ETX2)); /// Byte 294,295,296
EtPulses3 = Convert.ToInt32(GetUInt24(data, offs + (int)Poz.ETX3)); /// Byte 297,298.299 !!!!!!!!!!!!!!!
log.InfoFormat("Et={0} State={1:X14} Freq={2} EtPulses={3} TTime={4} WMPulses[3]={5} WMRefPulses[3]={6}, Time[3]={7}",
(State & 7), State, ReferenceFreq[0], EtPulses[0], Ttime, WMeterPuls[3], EtPulses[3], ImpulseTime[3]);
log.InfoFormat("Et={0} State={1:X14} Route={2} Freq={3} EtPulses={4} TTime={5} WMPulses[3]={6} WMRefPulses[3]={7}, Time[3]={8}",
(State & 7), State, Utils.ToBin40(((UInt64)Vystupy) >> 8), ReferenceFreq[0], EtPulses[0], Ttime, WMeterPuls[3], EtPulses[3], ImpulseTime[3]);
}
}
+4 -26
View File
@@ -41,8 +41,8 @@ namespace TBF.Rig.ControlBoard.Uni
{
altString.Clear();
altString.AppendFormat("State: {0}.{1}.{2}.{3}\n", (State >> 48) & 0xFF, (State >> 40) & 0xFF, (State >> 32) & 0xFF, Convert.ToUInt32(State & 0xFFFFFFFF).ToString("X6"));
altString.AppendFormat("DI: {0}\n", ToBin40(DigitalInputs));
altString.AppendFormat("DO: {0}\n", ToBin40(((UInt64)Route) >> 8));
altString.AppendFormat("DI: {0}\n", Utils.ToBin40(DigitalInputs));
altString.AppendFormat("DO: {0}\n", Utils.ToBin40((ulong)Route >> 8));
altString.AppendFormat("AI0: {0:D3} AI1: {1:D3} AI2: {2:D3} AI3: {3:D3} AI4: {4:D3} AI5: {5:D3}\n",
AnalogInput(0), AnalogInput(1), AnalogInput(2), AnalogInput(3), AnalogInput(4), AnalogInput(5));
altString.AppendFormat("AI8: {0:D3} AI9: {1:D3} AI10: {2:D3} AI11: {3:D3}\n",
@@ -54,28 +54,6 @@ namespace TBF.Rig.ControlBoard.Uni
}
}
string ToBin40(UInt64 val)
{
return string.Format("{0}-{1}-{2}-{3}-{4}", ToBin8((val >> 32) & 0xFF), ToBin8((val >> 24) & 0xFF),
ToBin8((val >> 16) & 0xFF), ToBin8((val >> 8) & 0xFF), ToBin8(val & 0xFF));
}
string ToBin8(UInt64 val)
{
string str = Convert.ToString((byte)val, 2);
switch (str.Length)
{
case 1: return "0000000" + str;
case 2: return "000000" + str;
case 3: return "00000" + str;
case 4: return "0000" + str;
case 5: return "000" + str;
case 6: return "00" + str;
case 7: return "0" + str;
default: return str;
}
}
///
/// Serial communication
///
@@ -378,7 +356,7 @@ namespace TBF.Rig.ControlBoard.Uni
}
isEmergencyStop = newEmergencyStop;
log.DebugFormat("Route synced with RRoute and UI changes, new route = {0}", Utils.RouteToStr(route));
log.DebugFormat("Route synced with RRoute and UI changes, new route = {0}", Utils.ToBin40((ulong)route >> 8));
}
/// <summary>
@@ -533,7 +511,7 @@ namespace TBF.Rig.ControlBoard.Uni
UInt128 oldRoute = route;
route = (route | valvesToOpen) & (~valvesToClose);
foreach (var logFnV in logicalFnValves) logFnV.UpdateRoute(ref route);
log.DebugFormat("SetValves(x,x), new route = {0}", Utils.RouteToStr(route));
log.DebugFormat("SetValves(x,x), new route = {0}", Utils.ToBin40((ulong)route >> 8));
UInt128 retVal = oldRoute ^ route;
log.DebugFormat("{0}.SetValves({1}, {2}) returns {3}", Name, valvesToOpen.ToString("X"), valvesToClose.ToString("X"), retVal.ToString("X"));