diff --git a/logger/FTLogger.py b/logger/FTLogger.py index 170362c..93f7af1 100644 --- a/logger/FTLogger.py +++ b/logger/FTLogger.py @@ -60,7 +60,6 @@ def fileSave(): outFile = open(workingDirectory+"/"+dataFileName, "a") except FileNotFoundError: outFile = open(workingDirectory+"/"+dataFileName, "w+") - outFile.write("# LOG started at " + str(lastLog)) # dichiaro una stringa in cui accumulo i valori csvRow = str(lastLog) +"," for chIndex in range(0,2,+1): diff --git a/logger/log/PyLog.txt b/logger/log/PyLog.txt index e3eea5f..ed585dc 100644 --- a/logger/log/PyLog.txt +++ b/logger/log/PyLog.txt @@ -88,3 +88,8 @@ 2021-04-09 09:35:39.271878 Caught error: Error 111 connecting to 127.0.0.1:6379. Connection refused. 2021-04-12 09:44:47.671178 Caught error: Error while reading from socket: (104, 'Connection reset by peer') 2021-04-14 11:56:16.891671 Caught error: Error 111 connecting to 127.0.0.1:6379. Connection refused. +2021-04-16 11:01:11.178539 Caught error: unsupported operand type(s) for /: 'str' and 'int' +2021-04-16 11:06:50.122850 Caught error: unsupported operand type(s) for /: 'str' and 'int' +2021-04-16 14:22:54.029457 Caught error: unsupported operand type(s) for /: 'str' and 'int' +2021-04-16 14:24:04.609002 Caught error: unsupported operand type(s) for /: 'str' and 'int' +2021-04-16 14:44:34.419407 Caught error: Error 111 connecting to 127.0.0.1:6379. Connection refused. diff --git a/sampler/FTSampler.py b/sampler/FTSampler.py index 24819f7..774bd3c 100644 --- a/sampler/FTSampler.py +++ b/sampler/FTSampler.py @@ -62,12 +62,13 @@ try: for chIndex in range(0,8,+1): redAreaIn = 'RTDATA:CH:'+str(chIndex) redAreaOut = 'RTDATA:OUT:'+str(chIndex) - innovazione = "%.4f" % (CHvalue[chIndex]*5.0/0x7fffff) + innovazione = float("%.4f" % (CHvalue[chIndex]*5.0/0x7fffff)) # RILEGGO DA REDIS vecchio valore oldVal = float(redSrv0.get(redAreaIn)) # effettuo smoothing valore strValIn = (innovazione/10) + (oldVal*9/10) - redSrv0.set(redAreaIn,strValIn) + roundedIn = round(strValIn, 4) + redSrv0.set(redAreaIn,roundedIn) # salvo i valori scalati in OUT strValOut = "%.4f" % scaleVal(CHvalue[chIndex]*5.0/0x7fffff, chIndex) redSrv0.set(redAreaOut,strValOut) diff --git a/server/FTServer.py b/server/FTServer.py index 4156e8c..f6dddab 100644 --- a/server/FTServer.py +++ b/server/FTServer.py @@ -51,11 +51,7 @@ def main(): #funzione logger, route a pagina /logger def logger(): channelsData = { - 'title' : 'Logger', - 'timeSrv' : getRedisVal('RTDATA:TIME:SRV'), - 'timeLog' : getRedisVal('RTDATA:TIME:LOG'), - 'LogFreq' : getRedisVal('SETTINGS:LOG:FREQ'), - 'WriteFreq' : getRedisVal('SETTINGS:WRITE:FREQ'), + 'title' : 'Logger' } #assegno il template html di riferimento return render_template('logger.html', **channelsData) @@ -65,8 +61,6 @@ def logger(): def setup(): channelsData = { 'title' : 'Settings', - 'LogFreq' : getRedisVal('SETTINGS:LOG:FREQ'), - 'WriteFreq' : getRedisVal('SETTINGS:WRITE:FREQ'), } #assegno il template html di riferimento return render_template('settings.html', **channelsData) @@ -97,7 +91,6 @@ def api_channels_all(): UNIMISURA[numCh] = getRedisVal('SETTINGS:UNIT:MEASURE:'+str(numCh)) channelsData = { 'timeSrv' : getRedisVal('RTDATA:TIME:SRV'), - 'timeLog' : getRedisVal('RTDATA:TIME:LOG'), 'LogFreq' : getRedisVal('SETTINGS:LOG:FREQ'), 'WriteFreq' : getRedisVal('SETTINGS:WRITE:FREQ'), 'Status' : getRedisVal('SETTINGS:LOG:STATUS'), @@ -141,7 +134,6 @@ def api_channels_current(): result = { 'numCh' : numCh, 'timeSrv' : getRedisVal('RTDATA:TIME:SRV'), - 'timeLog' : getRedisVal('RTDATA:TIME:LOG'), 'LogFreq' : getRedisVal('SETTINGS:LOG:FREQ'), 'WriteFreq' : getRedisVal('SETTINGS:WRITE:FREQ'), 'CurrIn' : getRedisVal('RTDATA:CH:'+str(numCh)), diff --git a/server/templates/logger.html b/server/templates/logger.html index eecb182..2c0cb7d 100644 --- a/server/templates/logger.html +++ b/server/templates/logger.html @@ -5,17 +5,12 @@