fix warmers x UI (array punti) e PLC (id/valore)

This commit is contained in:
Samuele E. Locatelli
2021-02-23 17:11:12 +01:00
parent 5fbbb5e61f
commit 37ef6055dc
5 changed files with 23 additions and 10 deletions
@@ -91,10 +91,9 @@ namespace Thermo.Active.Thermocamera
/// <param name="points">Dictionary id richiesta + punto (es canali + relativi punti medi come centro calcolato della resistenza di riferimento del canale)</param>
/// <param name="temp">Dizionario temperature come id + valore double in °C</param>
/// <returns></returns>
public bool readMultiTemperatures(string setName, Dictionary<int, ThermoPoint> points, out Dictionary<int, double> temp)
public bool readMultiTemperatures(string setName, Dictionary<int, ThermoPoint> points, out List<MeasurePoint> temp)
{
temp = new Dictionary<int, double>();
List<MeasurePoint> measData = new List<MeasurePoint>();
temp = new List<MeasurePoint>();
// converto la richiesta in una lista di punti di misura...
List<MeasurePoint> reqData = points.Select(item => new MeasurePoint()
{
@@ -112,12 +111,12 @@ namespace Thermo.Active.Thermocamera
// carico file vari...
done = TCamLive.fileLoad(setName);
}
measData = TCamLive.getPointsTemperature(false, reqData);
// converto valori nel formato finale
foreach (var item in measData)
try
{
temp.Add(item.Id, item.Temperature);
temp = TCamLive.getPointsTemperature(false, reqData);
}
catch
{ }
// fatto!
return true;
}
@@ -110,6 +110,10 @@
<Project>{cbeb631b-abfa-4042-9779-c0060b0dfefe}</Project>
<Name>Thermo.Active.Utils</Name>
</ProjectReference>
<ProjectReference Include="..\Thermo.Cam.Utils\Thermo.Cam.Utils.csproj">
<Project>{E4587942-498B-4AA7-9CC9-9304EB2D05C8}</Project>
<Name>Thermo.Cam.Utils</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
+7 -1
View File
@@ -357,12 +357,18 @@ public static class ThreadsFunctions
if (done)
{
// init
List<Thermo.Cam.Utils.MeasurePoint> measuredpoints = new List<Thermo.Cam.Utils.MeasurePoint>();
Dictionary<int, double> actualTemp = new Dictionary<int, double>();
Dictionary<int, ThermoPoint> chPoints = new Dictionary<int, ThermoPoint>();
// recupero punti centrali resistenze
ncAdapter.GetWarmersChannelCenterPoints(out chPoints);
// richiesta temperature per i punti
done = TCCom.readMultiTemperatures("", chPoints, out actualTemp);
done = TCCom.readMultiTemperatures("", chPoints, out measuredpoints);
// converto in actualTemp
foreach (var item in measuredpoints)
{
actualTemp.Add(item.Id, item.Temperature);
}
// salvo dati temp sul PLC
ncAdapter.WriteRecipeWarmChTCamTempAct(actualTemp);
// give PLC strobe for uploaded Actual TEMP from image
@@ -350,12 +350,12 @@ namespace Thermo.Active.Controllers.WebApi
return Ok(currWarmers);
}
[ResponseType(typeof(Dictionary<int, double>))]
[ResponseType(typeof(List<Thermo.Cam.Utils.MeasurePoint>))]
[Route("getMeasurePoints"), HttpGet]
public IHttpActionResult GetMeasurePoints(string setName)
{
// init punti...
Dictionary<int, double> resultPoints = new Dictionary<int, double>();
List<Thermo.Cam.Utils.MeasurePoint> resultPoints = new List<Cam.Utils.MeasurePoint>();
// Chiamo l'oggetto thermocam x il set richiesto...
TCCom.readMultiTemperatures(setName, MeasurePoints, out resultPoints);
// ritorno!
+4
View File
@@ -16213,6 +16213,10 @@
<Project>{cbeb631b-abfa-4042-9779-c0060b0dfefe}</Project>
<Name>Thermo.Active.Utils</Name>
</ProjectReference>
<ProjectReference Include="..\Thermo.Cam.Utils\Thermo.Cam.Utils.csproj">
<Project>{e4587942-498b-4aa7-9cc9-9304eb2d05c8}</Project>
<Name>Thermo.Cam.Utils</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Service Include="{4A0DDDB5-7A95-4FBF-97CC-616D07737A77}" />