Gestione decimali mostrati & decimali calcolati

This commit is contained in:
marco.locatelli@steamware.net
2023-07-11 11:29:11 +02:00
parent c60e013ece
commit 2cfea27d17
+7 -7
View File
@@ -15,26 +15,26 @@
timeoutFast = setInterval(dataRefresh, intTime);
timeoutSlow = setInterval(fixTables, intTimeSlow);
function fixFloat(actVal, numCount)
function fixFloat(actVal, numDisplay)
{
return parseFloat(actVal).toFixed(numCount)
return parseFloat(actVal).toFixed(numDisplay)
}
function dataRefresh() {
// scarico i dati aggioranti
$.ajax({url: "/api/v1/channels/all", success: function(result){
numCount = parseInt(result.DecimalsCount)
numDisplay = parseInt(result.DecimalsDisplay)
var divWidth = document.getElementById("divChA").offsetWidth
// compilo i dati scaricati
$("#SelChannelA").html(result.ChA);
$("#OutputA").html(fixFloat(result.Outs[result.ChA],numCount));
$("#OutputA").html(fixFloat(result.Outs[result.ChA],numDisplay));
setGaugeA(divWidth,result.Outs[result.ChA],result.Outmin[result.ChA],result.Outmax[result.ChA]);
$("#SelChannelB").html(result.ChB);
$("#OutputB").html(fixFloat(result.Outs[result.ChB],numCount));
$("#OutputB").html(fixFloat(result.Outs[result.ChB],numDisplay));
setGaugeB(divWidth,result.Outs[result.ChB],result.Outmin[result.ChB],result.Outmax[result.ChB]);
@@ -42,8 +42,8 @@
$("#ServerTime").html(result.timeSrv);
$("#LastSessionName").html(result.LastSessionName);
$("#CurrentFolder").html(result.CurrentWorkFolder);
$("#ResultValue").html(result.ResultValue);
$("#RealValue").html(result.RealValue);
$("#ResultValue").html(fixFloat(result.ResultValue,numDisplay));
$("#RealValue").html(fixFloat(result.RealValue,numDisplay));
$("#Crono").html(result.Crono);
if(result.GateOpen == "0")