diff --git a/Thermo.Active.Core/ThreadsFunctions.cs b/Thermo.Active.Core/ThreadsFunctions.cs index 62d356fc..8a052366 100644 --- a/Thermo.Active.Core/ThreadsFunctions.cs +++ b/Thermo.Active.Core/ThreadsFunctions.cs @@ -917,7 +917,7 @@ public static class ThreadsFunctions recipeRtCounter--; bool onlyRt = recipeRtCounter > 0; //check reset... - recipeRtCounter = recipeRtCounter < 0 ? 5 : recipeRtCounter; + recipeRtCounter = recipeRtCounter < 0 ? 4 : recipeRtCounter; sw.Restart(); @@ -1021,7 +1021,7 @@ public static class ThreadsFunctions // Update thread timer UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds); // Wait - Thread.Sleep(CalcSleepTime(1000, (int)sw.ElapsedMilliseconds)); + Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds)); } } catch (ThreadAbortException) diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs index 326538b1..9b2dc9cf 100644 --- a/Thermo.Active.NC/NcAdapter.cs +++ b/Thermo.Active.NC/NcAdapter.cs @@ -147,6 +147,11 @@ namespace Thermo.Active.NC #endregion + #region cached data + + protected static Dictionary lastRecipe = new Dictionary(); + + #endregion #region Read Data @@ -1266,13 +1271,16 @@ namespace Thermo.Active.NC { Dictionary currPlcRecipe = new Dictionary(); CmsError cmsError = NO_ERROR; - if (useLastRead) + if (useLastRead && lastRecipe.Count > 0) { - cmsError = numericalControl.PLC_RRecipeParamList(false, ref currPlcRecipe); + currentRecipe = lastRecipe; + return cmsError; } else { cmsError = numericalControl.PLC_RRecipeParamList(refreshOnlyRT, ref currPlcRecipe); + if (cmsError.IsError()) + return cmsError; } if (cmsError.IsError()) @@ -1349,10 +1357,13 @@ namespace Thermo.Active.NC } currentRecipe.Add(item.Label, currParam); } + // salvo! + lastRecipe = currentRecipe; } else { currentRecipe = new Dictionary(); + lastRecipe = currentRecipe; } return NO_ERROR; diff --git a/Thermo.Active/Listeners/SignalR/SignalRListener.cs b/Thermo.Active/Listeners/SignalR/SignalRListener.cs index dc8e10ba..47204dd3 100644 --- a/Thermo.Active/Listeners/SignalR/SignalRListener.cs +++ b/Thermo.Active/Listeners/SignalR/SignalRListener.cs @@ -269,7 +269,8 @@ namespace Thermo.Active.Listeners.SignalR // comparazione if (!item.Value.Equals(LastRecipeFullData[item.Key])) { - diffData[item.Key] = item.Value; + //diffData[item.Key] = item.Value; + diffData.Add(item.Key, item.Value); } } } diff --git a/Thermo.Active/Properties/AssemblyInfo.cs b/Thermo.Active/Properties/AssemblyInfo.cs index 57ab8036..9accf279 100644 --- a/Thermo.Active/Properties/AssemblyInfo.cs +++ b/Thermo.Active/Properties/AssemblyInfo.cs @@ -31,4 +31,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.7.5")] +[assembly: AssemblyVersion("0.8.1")]