inserimento bootstrap corretto e relarivo .js corretto

This commit is contained in:
Marco Locatelli
2021-03-25 09:48:15 +01:00
parent f1efc6bde1
commit ea269a7e5d
10 changed files with 118 additions and 10346 deletions
+2 -2
View File
@@ -59,13 +59,13 @@ try:
now = datetime.datetime.now()
redSrv0.set(redTime,str(now))
#print(logStatus)
# solo se su redis LOG è attivo eseguo il ciclo principale
# solo se su redis LOG è 1 eseguo il ciclo principale
logStatus = redSrv0.get('RTDATA:LOG:STATUS').decode('utf-8')
if logStatus == "1" :
CHvalue = CH.ADS1256_GetAll()
redisSave(CHvalue)
#videoPrint(CHvalue)
#fileSave(CHvalue)
redisSave(CHvalue)
time.sleep(int(redSrv0.get(redSampleFreq))/1000)
#eccezione da ctrl+c in terminale e chiusura
+2 -1
View File
@@ -53,4 +53,5 @@ Program end. Ctrl+C from user at time: 2021-03-23 14:12:15.324783
Program end. Ctrl+C from user at time: 2021-03-23 15:23:23.456196
Program end. Ctrl+C from user at time: 2021-03-23 15:31:55.154641
Program end. Ctrl+C from user at time: 2021-03-23 15:33:33.517326
Program end. Ctrl+C from user at time: 2021-03-24 12:35:48.198605
Program end. Ctrl+C from user at time: 2021-03-24 12:35:48.198605
Program end. Ctrl+C from user at time: 2021-03-24 15:27:56.660342
+27 -11
View File
@@ -35,17 +35,17 @@ flaskApp = Flask(__name__)
def main():
channelsData = {
'title' : 'Home',
'timeSrv' : redSrv0.get('RTDATA:CH:SRVTIME').decode('utf-8'),
'timeLog' : redSrv0.get('RTDATA:CH:RECTIME').decode('utf-8'),
'Freq' : redSrv0.get('RTDATA:LOG:FREQ').decode('utf-8'),
'Ch0' : redSrv0.get('RTDATA:CH:0').decode('utf-8'),
'Ch1' : redSrv0.get('RTDATA:CH:1').decode('utf-8'),
'Ch2' : redSrv0.get('RTDATA:CH:2').decode('utf-8'),
'Ch3' : redSrv0.get('RTDATA:CH:3').decode('utf-8'),
'Ch4' : redSrv0.get('RTDATA:CH:4').decode('utf-8'),
'Ch5' : redSrv0.get('RTDATA:CH:5').decode('utf-8'),
'Ch6' : redSrv0.get('RTDATA:CH:6').decode('utf-8'),
'Ch7' : redSrv0.get('RTDATA:CH:7').decode('utf-8')
'timeSrv' : redSrv0.get('RTDATA:CH:SRVTIME').decode('utf-8')
# 'timeLog' : redSrv0.get('RTDATA:CH:RECTIME').decode('utf-8'),
# 'Freq' : redSrv0.get('RTDATA:LOG:FREQ').decode('utf-8'),
# 'Ch0' : redSrv0.get('RTDATA:CH:0').decode('utf-8'),
# 'Ch1' : redSrv0.get('RTDATA:CH:1').decode('utf-8'),
# 'Ch2' : redSrv0.get('RTDATA:CH:2').decode('utf-8'),
# 'Ch3' : redSrv0.get('RTDATA:CH:3').decode('utf-8'),
# 'Ch4' : redSrv0.get('RTDATA:CH:4').decode('utf-8'),
# 'Ch5' : redSrv0.get('RTDATA:CH:5').decode('utf-8'),
# 'Ch6' : redSrv0.get('RTDATA:CH:6').decode('utf-8'),
# 'Ch7' : redSrv0.get('RTDATA:CH:7').decode('utf-8')
}
#assegno il template html di riferimento
return render_template('home.html', **channelsData)
@@ -151,6 +151,22 @@ def setFrequency():
# rimando in settings
return redirect("/settings")
@flaskApp.route("/api/v1/rmin1", methods=['POST'])
def setRealMin1():
#funzione set frequenza scrive su redis LOG:FREQ prendendolo dall'input in pagina html con nome LogFreq
realMin1 = request.form['MinReal1']
redSrv0.set('RTDATA:SET:RMIN1', realMin1)
# rimando in settings
return redirect("/settings")
@flaskApp.route("/api/v1/rmax1", methods=['POST'])
def setRealMax1():
#funzione set frequenza scrive su redis LOG:FREQ prendendolo dall'input in pagina html con nome LogFreq
realMax1 = request.form['MaxReal1']
redSrv0.set('RTDATA:SET:RMAX1', realMax1)
# rimando in settings
return redirect("/settings")
#dichiaro host ipv4 (ottenuto sopra utilizzando il modulo socket)
if __name__ == "__main__":
flaskApp.run(host=ipv4, port=80, debug=True)
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
-22
View File
@@ -1,22 +0,0 @@
/*!
* Start Bootstrap - SB Admin v6.0.2 (https://startbootstrap.com/template/sb-admin)
* Copyright 2013-2020 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-sb-admin/blob/master/LICENSE)
*/
(function($) {
"use strict";
// Add active state to sidbar nav links
var path = window.location.href; // because the 'href' property of the DOM element is the absolute path
$("#layoutSidenav_nav .sb-sidenav a.nav-link").each(function() {
if (this.href === path) {
$(this).addClass("active");
}
});
// Toggle the side navigation
$("#sidebarToggle").on("click", function(e) {
e.preventDefault();
$("body").toggleClass("sb-sidenav-toggled");
});
})(jQuery);
+31 -30
View File
@@ -8,43 +8,44 @@
<meta name="author" content="Marco Loca" />
<title>{{ title }}</title>
<link rel="shortcut icon" href="../static/img/steam.ico">
<link rel="stylesheet" href="../static/css/styles.css"/>
<link rel="stylesheet" href="../static/css/fonts.css">
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<script src="../static/js/jquery-3.6.0.min.js"></script>
<script src="../static/js/bootstrap.bundle.min.js"></script>
</head>
<body class="sb-nav-fixed">
<script>
var intTime=250;
// fix visualizzazioni
fixDisplay();
// avvio timer
var timeout = setTimeout(dataRefresh, intTime);
function fixDisplay(){
$("#divNewFile").toggle();
//console.log("div hidden");
}
// var intTime=250;
// // fix visualizzazioni
// fixDisplay();
function dataRefresh() {
// scarico i dati aggioranti
$.ajax({url: "/api/v1/channels/all", success: function(result){
// compilo i dati scaricati
$("#Chan0").html(result.Ch0);
$("#Chan1").html(result.Ch1);
$("#Chan2").html(result.Ch2);
$("#Chan3").html(result.Ch3);
$("#Chan4").html(result.Ch4);
$("#Chan5").html(result.Ch5);
$("#Chan6").html(result.Ch6);
$("#Chan7").html(result.Ch7);
$("#LogFrequency").html(result.Freq);
$("#ServerTime").html(result.timeSrv);
$("#LoggerTime").html(result.timeLog);
//console.log(result);
}});
timeout = setTimeout(dataRefresh, intTime);
}
// // avvio timer
// var timeout = setTimeout(dataRefresh, intTime);
// function fixDisplay(){
// $("#divNewFile").toggle();
// //console.log("div hidden");
// }
// function dataRefresh() {
// // scarico i dati aggioranti
// $.ajax({url: "/api/v1/channels/all", success: function(result){
// // compilo i dati scaricati
// $("#Chan0").html(result.Ch0);
// $("#Chan1").html(result.Ch1);
// $("#Chan2").html(result.Ch2);
// $("#Chan3").html(result.Ch3);
// $("#Chan4").html(result.Ch4);
// $("#Chan5").html(result.Ch5);
// $("#Chan6").html(result.Ch6);
// $("#Chan7").html(result.Ch7);
// $("#LogFrequency").html(result.Freq);
// $("#ServerTime").html(result.timeSrv);
// $("#LoggerTime").html(result.timeLog);
// //console.log(result);
// }});
// timeout = setTimeout(dataRefresh, intTime);
// }
function startLog(){
$.ajax({
+30
View File
@@ -2,6 +2,36 @@
{% block content %}
<main>
<script>
var intTime=350;
// fix visualizzazioni
fixDisplay();
// avvio timer
var timeout = setTimeout(dataRefresh, intTime);
function fixDisplay(){
$("#divNewFile").toggle();
//console.log("div hidden");
}
function dataRefresh() {
// scarico i dati aggioranti
$.ajax({url: "/api/v1/channels/all", success: function(result){
// compilo i dati scaricati
$("#Chan0").html(result.Ch0);
$("#Chan1").html(result.Ch1);
$("#Chan2").html(result.Ch2);
$("#Chan3").html(result.Ch3);
$("#Chan4").html(result.Ch4);
$("#Chan5").html(result.Ch5);
$("#Chan6").html(result.Ch6);
$("#Chan7").html(result.Ch7);
$("#LogFrequency").html(result.Freq);
$("#LoggerTime").html(result.timeLog);
//console.log(result);
}});
timeout = setTimeout(dataRefresh, intTime);
}
</script>
<div class="container-fluid py-2">
<div class="card mb-4">
<div class="card-header">
+12 -12
View File
@@ -31,11 +31,11 @@
Valori Reali
</div>
<div class="col-5">
<form method="POST" action="/api/v1/min1">
<form method="POST" action="/api/v1/rmin1">
<div class="input-group mb-3">
<span class="input-group-text">Valore Minimo</span>
<span class="input-group-text">Min</span>
<button type="button" style="text-align: right;" class="btn btn-primary" onclick="">Get current</button>
<input type="number" class="form-control" id="MinCh1" name="MinCh1"></input>
<input type="float" class="form-control" id="MinReal1" name="MinReal1"></input>
<div class="input-group-append">
<input type="submit" value="SET" class="btn btn-success"></input>
</div>
@@ -43,11 +43,11 @@
</form>
</div>
<div class="col-5">
<form method="POST" action="/api/v1/max1">
<form method="POST" action="/api/v1/rmax1">
<div class="input-group mb-3">
<span class="input-group-text">Valore Massimo</span>
<span class="input-group-text">Max</span>
<button type="button" style="text-align: right;" class="btn btn-primary" onclick="">Get current</button>
<input type="number" class="form-control" id="MaxCh1" name="MaxCh1"></input>
<input type="float" class="form-control" id="MaxReal1" name="MaxReal1"></input>
<div class="input-group-append">
<input type="submit" value="SET" class="btn btn-success"></input>
</div>
@@ -60,11 +60,11 @@
Valori Scalati
</div>
<div class="col-5">
<form method="POST" action="/api/v1/min1">
<form method="POST" action="/api/v1/smin1">
<div class="input-group mb-3">
<span class="input-group-text">Valore Minimo</span>
<span class="input-group-text">Min</span>
<button type="button" style="text-align: right;" class="btn btn-primary" onclick="">Get current</button>
<input type="number" class="form-control" id="MinCh1" name="MinCh1"></input>
<input type="number" class="form-control" id="MinScaled1" name="MinScaled1"></input>
<div class="input-group-append">
<input type="submit" value="SET" class="btn btn-success"></input>
</div>
@@ -72,11 +72,11 @@
</form>
</div>
<div class="col-5">
<form method="POST" action="/api/v1/max1">
<form method="POST" action="/api/v1/smax1">
<div class="input-group mb-3">
<span class="input-group-text">Valore Massimo</span>
<span class="input-group-text">Max</span>
<button type="button" style="text-align: right;" class="btn btn-primary" onclick="">Get current</button>
<input type="number" class="form-control" id="MaxCh1" name="MaxCh1"></input>
<input type="number" class="form-control" id="MaxScaled1" name="MaxScaled1"></input>
<div class="input-group-append">
<input type="submit" value="SET" class="btn btn-success"></input>
</div>