RegisterReaders.SerialStream : Bug fix in DatastreamFrame in case of TiemFieldFormat == FieldFormat.None, ver. 2.18.916

This commit is contained in:
Milan Hanajik
2018-06-06 11:18:30 +02:00
parent baa67cfe02
commit 2a622d4aa2
3 changed files with 16 additions and 11 deletions
@@ -121,20 +121,22 @@ namespace TBF.BenchControl.RegisterReaders.SerialStream
Int64 uncorrected = (Int64)(((UInt64)volumeRawExtLast & ff.VolumeWindowMask) | VolumeRaw); Int64 uncorrected = (Int64)(((UInt64)volumeRawExtLast & ff.VolumeWindowMask) | VolumeRaw);
if (Math.Abs(uncorrected - volumeRawExtLast) <= ff.VolumeWrapThreshold) if (Math.Abs(uncorrected - volumeRawExtLast) <= ff.VolumeWrapThreshold)
{ {
VolumeRawExt = volumeRawExtLast = uncorrected; VolumeRawExt = uncorrected;
} }
else if (Math.Abs(uncorrected + ff.VolumeWrapIncrement - volumeRawExtLast) <= ff.VolumeWrapThreshold) else if (Math.Abs(uncorrected + ff.VolumeWrapIncrement - volumeRawExtLast) <= ff.VolumeWrapThreshold)
{ {
VolumeRawExt = volumeRawExtLast = uncorrected + ff.VolumeWrapIncrement; VolumeRawExt = uncorrected + ff.VolumeWrapIncrement;
} }
else if (Math.Abs(uncorrected - ff.VolumeWrapIncrement - volumeRawExtLast) <= ff.VolumeWrapThreshold) else if (Math.Abs(uncorrected - ff.VolumeWrapIncrement - volumeRawExtLast) <= ff.VolumeWrapThreshold)
{ {
VolumeRawExt = volumeRawExtLast = uncorrected - ff.VolumeWrapIncrement; VolumeRawExt = uncorrected - ff.VolumeWrapIncrement;
} }
else else
{ {
VolumeRawExt = volumeRawExtLast = uncorrected; VolumeRawExt = uncorrected;
} }
volumeRawExtLast = VolumeRawExt; /// Update referenced value from calling routine
} }
if (ff.TimeFieldFormat == FieldFormat.HexadecimalWindow) if (ff.TimeFieldFormat == FieldFormat.HexadecimalWindow)
@@ -147,24 +149,27 @@ namespace TBF.BenchControl.RegisterReaders.SerialStream
Int64 uncorrected = (Int64)(((UInt64)timestampExtLast & ff.TimeWindowMask) | Timestamp); Int64 uncorrected = (Int64)(((UInt64)timestampExtLast & ff.TimeWindowMask) | Timestamp);
if (Math.Abs(uncorrected - timestampExtLast) <= ff.TimeWrapThreshold) if (Math.Abs(uncorrected - timestampExtLast) <= ff.TimeWrapThreshold)
{ {
TimestampExt = timestampExtLast = uncorrected; TimestampExt = uncorrected;
} }
else if (Math.Abs(uncorrected + ff.TimeWrapIncrement - timestampExtLast) <= ff.TimeWrapThreshold) else if (Math.Abs(uncorrected + ff.TimeWrapIncrement - timestampExtLast) <= ff.TimeWrapThreshold)
{ {
TimestampExt = timestampExtLast = uncorrected + ff.TimeWrapIncrement; TimestampExt = uncorrected + ff.TimeWrapIncrement;
} }
else if (Math.Abs(uncorrected - ff.TimeWrapIncrement - timestampExtLast) <= ff.TimeWrapThreshold) else if (Math.Abs(uncorrected - ff.TimeWrapIncrement - timestampExtLast) <= ff.TimeWrapThreshold)
{ {
TimestampExt = timestampExtLast = uncorrected - ff.TimeWrapIncrement; TimestampExt = uncorrected - ff.TimeWrapIncrement;
} }
else else
{ {
TimestampExt = timestampExtLast = uncorrected; TimestampExt = uncorrected;
} }
timestampExtLast = TimestampExt; /// Update referenced value from calling routine
} }
else if (ff.TimeFieldFormat == FieldFormat.None) else if (ff.TimeFieldFormat == FieldFormat.None)
{ {
TimestampExt = ff.RawTimeIncrementPerFrame * counter; TimestampExt = ff.RawTimeIncrementPerFrame * counter;
timestampExtLast = TimestampExt; /// Update referenced value from calling routine
} }
f3 = byte.TryParse(frame.Substring(ff.FrameLength - 4, 2), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out CheckSum); f3 = byte.TryParse(frame.Substring(ff.FrameLength - 4, 2), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out CheckSum);
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.18.915.0")] [assembly: AssemblyVersion("2.18.916.0")]
[assembly: AssemblyFileVersion("2.18.915.0")] [assembly: AssemblyFileVersion("2.18.916.0")]