fix e ottimizzazione
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
+1
-9
@@ -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)),
|
||||
|
||||
@@ -5,17 +5,12 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var intTime=300;
|
||||
var intTimeSlow=1500;
|
||||
// $("#divWarnCanc").hide();
|
||||
var intTimeSlow=2000;
|
||||
|
||||
// fix visualizzazioni
|
||||
fixTables();
|
||||
dataRefresh();
|
||||
|
||||
// // avvio timer
|
||||
// var timeoutFast = setTimeout(dataRefresh, intTime);
|
||||
// var timeoutSlow = setTimeout(fixTables, intTimeSlow);
|
||||
|
||||
function dataRefresh() {
|
||||
// scarico i dati aggioranti
|
||||
$.ajax({url: "/api/v1/channels/all", success: function(result){
|
||||
@@ -98,7 +93,7 @@
|
||||
knob0.setProperty('angleStart', -0.85 * Math.PI);
|
||||
knob0.setProperty('angleEnd', 0.85 * Math.PI);
|
||||
knob0.setProperty('colorFG', '#07adec');
|
||||
knob0.setProperty('trackWidth', 0.3);
|
||||
knob0.setProperty('trackWidth', 0.2);
|
||||
knob0.setProperty('valMin', parseInt(outMinA)*1000);
|
||||
knob0.setProperty('valMax', parseInt(outMaxA)*1000);
|
||||
knob0.setProperty('readonly', 'true');
|
||||
@@ -120,7 +115,7 @@
|
||||
knob1.setProperty('angleStart', -0.85 * Math.PI);
|
||||
knob1.setProperty('angleEnd', 0.85 * Math.PI);
|
||||
knob1.setProperty('colorFG', '#07adec');
|
||||
knob1.setProperty('trackWidth', 0.3);
|
||||
knob1.setProperty('trackWidth', 0.2);
|
||||
knob1.setProperty('valMin', parseInt(outMinB)*1000);
|
||||
knob1.setProperty('valMax', parseInt(outMaxB)*1000);
|
||||
knob1.setProperty('readonly', 'true');
|
||||
@@ -289,79 +284,85 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row my-2">
|
||||
<div class="col-6">
|
||||
<div class="card text-center">
|
||||
<div class="card-header">
|
||||
<strong>Channel A: <span id="SelChannelA"></span></strong>
|
||||
<div class="col-12 col-xl-6">
|
||||
<div class="row my-2">
|
||||
<div class="col-6">
|
||||
<div class="card text-center">
|
||||
<div class="card-header">
|
||||
<strong>Channel A: <span id="SelChannelA"></span></strong>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="divChA"></div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<span class="h3" id="OutputA"></span>
|
||||
<span class="h3" id="UniMisuA"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="divChA"></div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<span class="h3" id="OutputA"></span>
|
||||
<span class="h3" id="UniMisuA"></span>
|
||||
<div class="col-6">
|
||||
<div class="card text-center">
|
||||
<div class="card-header">
|
||||
<strong>Channel B: <span id="SelChannelB"></span></strong>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="divChB"></div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<span class="h3" id="OutputB"></span>
|
||||
<span class="h3" id="UniMisuB"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="card text-center">
|
||||
<div class="card-header">
|
||||
<strong>Channel B: <span id="SelChannelB"></span></strong>
|
||||
<div class="col-12 col-xl-6">
|
||||
<div id="Div7" class="table-secondary text-center py-2 m-2 row"> <!--Div7 ovvero pulsanti Start e Stop-->
|
||||
<div class="col-6">
|
||||
<button id="btnStart" type="button" class="btn btn-success btn-block" onclick="startLog()">Start Log</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="divChB"></div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<span class="h3" id="OutputB"></span>
|
||||
<span class="h3" id="UniMisuB"></span>
|
||||
<div class="col-6">
|
||||
<button id="btnStop" type="button" class="btn btn-warning btn-block" onclick="stopLog()">Stop Log</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card my-2">
|
||||
<div class="card-header">
|
||||
<div class="row" id="Div8"> <!--Div8 ovvero cartella attuale e sessione attuale-->
|
||||
<div class="col-6"><strong>Cartella attuale: </strong> <h5><span id="CurrentFolder"></span></h5></div>
|
||||
<div class="col-6"><strong>Sessione attuale: </strong> <h5><span id="LastSessionName"></span></h5></div>
|
||||
</div>
|
||||
<div id="Div9"> <!--Div9 ovvero selezione cartella-->
|
||||
<p id="showFolders"></p>
|
||||
<form method="POST" action="/api/v1/setup/workingtree">
|
||||
<div class="input-group my-2">
|
||||
<span class="input-group-text col-5">Seleziona o Crea Cartella: </span>
|
||||
<input type="text" class="form-control col-5" id="NewFolder" name="NewFolder"></input>
|
||||
<input type="submit" value="INVIO" class="btn btn-success col-2"></input>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="Div10"> <!--Div10 ovvero 3 pulsanti logger-->
|
||||
<div class="row mt-2">
|
||||
<div class="col-4">
|
||||
<button type="button" style="font-size: 80%" class="btn btn-info btn-block" onclick="goBack()">Torna Indietro</button>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button type="button" style="font-size: 80%" class="btn btn-primary btn-block" onclick="exportData()">Esporta Cartella</button>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button type="button" style="font-size: 80%" class="btn btn-danger btn-block" onclick="deleteData()">Cancella Cartella</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="Div7" class="table-secondary text-center py-2 m-2 row"> <!--Div7 ovvero pulsanti Start e Stop-->
|
||||
<div class="col-6">
|
||||
<button id="btnStart" type="button" class="btn btn-success btn-block" onclick="startLog()">Start Log</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button id="btnStop" type="button" class="btn btn-warning btn-block" onclick="stopLog()">Stop Log</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card my-2">
|
||||
<div class="card-header">
|
||||
<div class="row" id="Div8"> <!--Div8 ovvero cartella attuale e sessione attuale-->
|
||||
<div class="col-6"><strong>Cartella attuale: </strong> <h5><span id="CurrentFolder"></span></h5></div>
|
||||
<div class="col-6"><strong>Sessione attuale: </strong> <h5><span id="LastSessionName"></span></h5></div>
|
||||
</div>
|
||||
<div id="Div9"> <!--Div9 ovvero selezione cartella-->
|
||||
<p id="showFolders"></p>
|
||||
<form method="POST" action="/api/v1/setup/workingtree">
|
||||
<div class="input-group my-2">
|
||||
<span class="input-group-text col-5">Seleziona o Crea Cartella: </span>
|
||||
<input type="text" class="form-control col-5" id="NewFolder" name="NewFolder"></input>
|
||||
<input type="submit" value="INVIO" class="btn btn-success col-2"></input>
|
||||
<div class="card-body" id="Div11"> <!--Div11 ovvero elenco files-->
|
||||
<p class="text-center" id="showData"></p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="Div10"> <!--Div10 ovvero 3 pulsanti logger-->
|
||||
<div class="row mt-2">
|
||||
<div class="col-4">
|
||||
<button type="button" class="btn btn-info btn-block" onclick="goBack()">Torna Indietro</button>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="exportData()">Esporta Cartella</button>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button type="button" class="btn btn-danger btn-block" onclick="deleteData()">Cancella Cartella</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body" id="Div11"> <!--Div11 ovvero elenco files-->
|
||||
<p class="text-center" id="showData"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
<main>
|
||||
<script type="text/javascript">
|
||||
var intTime=300;
|
||||
refreshInput();
|
||||
|
||||
refreshInput();
|
||||
|
||||
var timeout = setTimeout(dataRefresh, intTime);
|
||||
var timeoutSetting = setTimeout(refreshSettings, intTime);
|
||||
|
||||
@@ -16,7 +18,6 @@
|
||||
$("#CurrOut").html(result.CurrOut);
|
||||
$("#LogFreq").val(result.LogFreq);
|
||||
$("#WriteFreq").val(result.WriteFreq);
|
||||
$("#LoggerTime").html(result.timeLog);
|
||||
$("#ServerTime").html(result.timeSrv);
|
||||
$("#ddlChannels").val(result.numCh);
|
||||
$("#MinOut").val(result.MinOut);
|
||||
@@ -67,7 +68,6 @@
|
||||
|
||||
$("#LogFrequency").html(result.LogFreq);
|
||||
$("#WriteFrequency").html(result.WriteFreq);
|
||||
$("#LoggerTime").html(result.timeLog);
|
||||
$("#ServerTime").html(result.timeSrv);
|
||||
$("#ChanScaleMin").html(result.ChScaleMin);
|
||||
$("#ChanScaleMax").html(result.ChScaleMax);
|
||||
|
||||
Reference in New Issue
Block a user