Merge branch 'Thermocamera' into Connect-UI

This commit is contained in:
Samuele Locatelli
2020-11-04 10:05:10 +01:00
4 changed files with 25 additions and 6 deletions
@@ -33,6 +33,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
+22 -5
View File
@@ -29,6 +29,7 @@ using static Thermo.Active.Model.Constants;
using static Thermo.Active.Utils.ExceptionManager;
using System.Windows;
using System.Drawing;
using System.Configuration;
public static class ThreadsFunctions
{
@@ -1196,6 +1197,19 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
/// <summary>
/// Swap x/y requesto from FLIR camera
/// </summary>
internal static bool cacheWarmers
{
get
{
bool answ = false;
bool.TryParse(ConfigurationManager.AppSettings["cacheWarmers"], out answ);
return answ;
}
}
public static void ReadWarmersData()
{
@@ -1217,17 +1231,20 @@ public static class ThreadsFunctions
// Check if client is connected
if (ncAdapter.numericalControl.NC_IsConnected())
{
// every 10 reads all data...
useCache = (readCount != 0);
if (cacheWarmers)
{
// every 10 reads all data...
useCache = (readCount != 0);
readCount++;
// ciclo resettato ogni 20
readCount = readCount % 20;
}
// Get new data from PLC
libraryError = ncAdapter.ReadWarmers(useCache, out Dictionary<int, DTOWarmers> currWarmers);
if (libraryError.IsError())
ManageLibraryError(libraryError);
// pubblico
MessageServices.Current.Publish(SEND_THERMO_WARMERS_DATA, null, currWarmers);
readCount++;
// ciclo resettato ogni 20
readCount = readCount % 20;
}
else
RestoreConnection();
+1
View File
@@ -18,6 +18,7 @@
<add key="delayParamWrite" value="5" />
<add key="ewmaPar100" value="40" />
<add key="flirSwapXY" value="true" />
<add key="cacheWarmers" value="false" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.2" />
@@ -367,7 +367,7 @@ namespace Thermo.Active.Controllers.WebApi
}
// recupero valori attuali
libraryError = ncAdapter.ReadWarmers(true, out Dictionary<int, DTOWarmers> currWarmers);
libraryError = ncAdapter.ReadWarmers(false, out Dictionary<int, DTOWarmers> currWarmers);
if (libraryError.IsError())
{
ThermoActiveLogger.LogError($"SimReqFlirImg | GetRecipeOverview error | {libraryError.exception}");