diff --git a/PyLog.txt b/PyLog.txt index ab4945d..26924f0 100644 --- a/PyLog.txt +++ b/PyLog.txt @@ -543,3 +543,4 @@ 14/05/2021 15:15:22 FTSampler caught error: int() argument must be a string, a bytes-like object or a number, not 'NoneType' 17/05/2021 09:51:36 FTSampler caught error: int() argument must be a string, a bytes-like object or a number, not 'NoneType' 17/05/2021 11:12:38 FTSampler caught error: float() argument must be a string or a number, not 'NoneType' +21/05/2021 14:59:25 FTSampler caught error: int() argument must be a string, a bytes-like object or a number, not 'NoneType' diff --git a/sampler/FTSampler.py b/sampler/FTSampler.py index 7b064de..d3922c8 100644 --- a/sampler/FTSampler.py +++ b/sampler/FTSampler.py @@ -65,7 +65,8 @@ redSamPer='SETTINGS:LOG:EXETIME' #se non c'è un valore nei campi di redis, popolo il db redSrv0.set('SETTINGS:DECIMALS:COUNT',3) redSrv0.set('SETTINGS:LOG:STATUS',0) - +if redSrv0.get('RTDATA:VALUE:UMEASURE') is None: + redSrv0.set('RTDATA:VALUE:UMEASURE', "-") if redSrv0.get('SETTINGS:LOG:EXETIME') is None: redSrv0.set('SETTINGS:LOG:EXETIME', 1) if redSrv0.get('RTDATA:VALUE') is None: @@ -80,7 +81,6 @@ if redSrv0.get('SETTINGS:SMOOTHING:FUNCTION') is None: redSrv0.set('SETTINGS:SMOOTHING:FUNCTION', 0) if redSrv0.get('SETTINGS:SMOOTHING:FACTOR') is None: redSrv0.set('SETTINGS:SMOOTHING:FACTOR', 10) - if redSrv0.get('SETTINGS:PASSWORD:CURRENT') is None: redSrv0.set('SETTINGS:PASSWORD:CURRENT',"-") if redSrv0.get('SETTINGS:FOLDER:CURRENT') is None: @@ -189,8 +189,8 @@ def calculateValue(): v1 = getRedisVal('RTDATA:OUT:' + ch1) v2 = getRedisVal('RTDATA:OUT:' + ch2) den = (float(v1)-float(v2)) - if(den < 0.00001): - den = 0.00001 + if(den < 0.001): + den = 0.001 newValue = float(v2)/float(den) redSrv0.set('RTDATA:VALUE',round(newValue,3)) diff --git a/server/FTServer.py b/server/FTServer.py index fcca00e..c5d59f3 100644 --- a/server/FTServer.py +++ b/server/FTServer.py @@ -100,6 +100,7 @@ def api_channels_all(): 'Outmin': OUTMIN, 'Outmax': OUTMAX, 'UniMeasure' : UNIMISURA, + 'CalcUMeasure' : getRedisVal('RTDATA:VALUE:UMEASURE'), 'ChA' : getRedisVal('SETTINGS:CHANNEL:A'), 'ChB' : getRedisVal('SETTINGS:CHANNEL:B'), 'ChScaleMax' : getRedisVal('SETTINGS:IN:MAX:'+str(numCh)), @@ -138,6 +139,7 @@ def api_channels_current(): #funzione api_channels_all: legge direttamente da redis, ritorna jsonify result = { 'numCh' : numCh, + 'CalcUMeasure' : getRedisVal('RTDATA:VALUE:UMEASURE'), 'SmoothFact' : getRedisVal('SETTINGS:SMOOTHING:FACTOR'), 'ChanThresh' : getRedisVal('SETTINGS:POWER:THRESH'), 'timeSrv' : getRedisVal('RTDATA:TIME:SRV'), @@ -325,6 +327,12 @@ def setPowerChannel(numPowerCh): redSrv0.set('SETTINGS:POWER:CH', numPowerCh) return "OK" +@flaskApp.route("/api/v1/setup/calcMeasureUnit", methods=['POST']) +def VUnitMeasure(): + CMeasureUnit = request.form['CalcUMeasure'] + redSrv0.set('RTDATA:VALUE:UMEASURE', CMeasureUnit) + return redirect("/settings") + @flaskApp.route("/api/v1/setup/selectProcessing/", methods=['PUT']) def setProcessing(processingType): redSrv0.set('SETTINGS:SMOOTHING:FUNCTION', processingType) diff --git a/server/templates/logger.html b/server/templates/logger.html index aafc514..5d3e23e 100644 --- a/server/templates/logger.html +++ b/server/templates/logger.html @@ -91,7 +91,7 @@ //scarico unità di misura dei canali mostrati $("#UniMisuA").html(result.UniMeasure[result.ChA]); $("#UniMisuB").html(result.UniMeasure[result.ChB]); - + $("#CalcUMeasure").html(result.CalcUMeasure); }}); // A ogni giro di data refresh fix di tabella cartelle e tabella file @@ -339,14 +339,15 @@ -
-
- Calcolo risultante -
-
- [Valore B / (Valore A - Valore B)] =   -
+
+
+ Calcolo risultante [Valore B / (Valore A - Valore B)]
+
+   + +
+
diff --git a/server/templates/settings.html b/server/templates/settings.html index 29712e2..e1cf16f 100644 --- a/server/templates/settings.html +++ b/server/templates/settings.html @@ -35,6 +35,7 @@ $("#UniMisura").val(result.UniMisura); $("#ChanThresh").val(result.ChanThresh); $("#SmoothFact").val(result.SmoothFact); + $("#CalcUMeasure").val(result.CalcUMeasure); // inizio nascondendo div2 e div3 $("#Div2").hide(); $("#Div3").hide(); @@ -346,6 +347,20 @@
+
+
+ Unità di misura della risultante [Valore B / (Valore A - Valore B)] +
+
+
+
+ Unità di misura:   + + +
+
+
+
Impostazioni canale e soglia per spegnimento