From 51b3e994c3fbe4ceda32f2a3698b6af9d62dd733 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Thu, 11 Nov 2021 12:11:34 +0100 Subject: [PATCH] Bug fixes : (1) UniCB timing after a delay in worker thread (DB request), (2) Scales.MettlerToledo.ScaleCfg, ver. 3.1.1806 --- TBF/Properties/AssemblyInfo.cs | 4 ++-- TBF/Rig/ControlBoard/Uni/UniCB.cs | 8 -------- TBF/Rig/Scales/MettlerToledo/ScaleCfg.cs | 1 + TBF/Rig/StateMachine.cs | 5 ++++- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 01aa0a8c6..a9e2b0aed 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("3.1.1805.0")] -[assembly: AssemblyFileVersion("3.1.1805.0")] +[assembly: AssemblyVersion("3.1.1806.0")] +[assembly: AssemblyFileVersion("3.1.1806.0")] diff --git a/TBF/Rig/ControlBoard/Uni/UniCB.cs b/TBF/Rig/ControlBoard/Uni/UniCB.cs index 029017cae..db9f1c085 100644 --- a/TBF/Rig/ControlBoard/Uni/UniCB.cs +++ b/TBF/Rig/ControlBoard/Uni/UniCB.cs @@ -472,14 +472,6 @@ namespace TBF.Rig.ControlBoard.Uni /// public void RunDeviceAfter() { - DateTime now = DateTime.Now; - if (now < lastSentTime + TimeSpan.FromSeconds(0.7) || - (lastReceivedTime < lastSentTime && now < lastSentTime + TimeSpan.FromSeconds(1.7))) - { - log.Error("RunDeviceAfter() ... skipping too early write of a serial command or a data requect"); - return; - } - /// /// Combine data from the current route and from UI /// diff --git a/TBF/Rig/Scales/MettlerToledo/ScaleCfg.cs b/TBF/Rig/Scales/MettlerToledo/ScaleCfg.cs index b003e1948..4c1ca9003 100644 --- a/TBF/Rig/Scales/MettlerToledo/ScaleCfg.cs +++ b/TBF/Rig/Scales/MettlerToledo/ScaleCfg.cs @@ -277,6 +277,7 @@ namespace TBF.Rig.Scales.MettlerToledo if (Utils.TryParseUFloat(strValue, out fdummy)) return true; break; case 13: /// Evaporation + return true; default: message = "Invalid index"; return false; diff --git a/TBF/Rig/StateMachine.cs b/TBF/Rig/StateMachine.cs index 5e24d0287..49d25873c 100644 --- a/TBF/Rig/StateMachine.cs +++ b/TBF/Rig/StateMachine.cs @@ -836,7 +836,10 @@ namespace TBF.Rig /// true when interrupted by 'quitStateMachine', otherwise false public static void WaitNextTick() { - currentTimeSec += Period; + int currentTimeSecFromClock = Convert.ToInt32(Math.Round((DateTime.Now - startDateTime).TotalSeconds - 0.2)); + + currentTimeSec = Math.Max(currentTimeSec, currentTimeSecFromClock) + Period; + DateTime nextTickDateTime = startDateTime + TimeSpan.FromSeconds(currentTimeSec); while (DateTime.Now < nextTickDateTime)