Fix richiesta warmers SEMPRE senza cache

This commit is contained in:
Samuele Locatelli
2020-11-04 09:23:55 +01:00
parent ee21a0fe2e
commit 3dd81652b5
2 changed files with 10 additions and 4 deletions
+9 -3
View File
@@ -1208,7 +1208,9 @@ public static class ThreadsFunctions
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
int readCount = 0;
#if false
int readCount = 0;
#endif
bool useCache = false;
while (true)
{
@@ -1217,17 +1219,21 @@ public static class ThreadsFunctions
// Check if client is connected
if (ncAdapter.numericalControl.NC_IsConnected())
{
#if false
// every 10 reads all data...
useCache = (readCount != 0);
useCache = (readCount != 0);
#endif
// 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);
#if false
readCount++;
// ciclo resettato ogni 20
readCount = readCount % 20;
readCount = readCount % 20;
#endif
}
else
RestoreConnection();
@@ -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}");