diff --git a/logger/FlythisLogger.py b/logger/FlythisLogger.py index 0e2b94b..6e8972b 100644 --- a/logger/FlythisLogger.py +++ b/logger/FlythisLogger.py @@ -42,8 +42,8 @@ try: #funzione salva time+data e otto valori letti su redis def redisSave(CHvalue): - redTime = 'RTDATA:CH:TIME' - redSrv0.set(redTime,str(now)) + redLastTime = 'RTDATA:CH:RECTIME' + redSrv0.set(redLastTime,str(now)) for CHcount in range(0,8,+1): redArea = 'RTDATA:CH:'+str(CHcount) strVal = "%lf" % (CHvalue[CHcount]*5.0/0x7fffff) @@ -51,11 +51,20 @@ try: #ciclo principale, chiama le tre funzioni definite sopra while(1): + redTime = 'RTDATA:CH:TIME' now = datetime.datetime.now() - CHvalue = CH.ADS1256_GetAll() - #videoPrint(CHvalue) - #fileSave(CHvalue) - redisSave(CHvalue) + redSrv0.set(redTime,str(now)) + + # solo se su redis LOG รจ attivo... + logStatus = redSrv0.get('RTDATA:LOG:STATUS').decode('utf-8') + #print(logStatus) + if logStatus == "1" : + CHvalue = CH.ADS1256_GetAll() + redisSave(CHvalue) + #videoPrint(CHvalue) + #fileSave(CHvalue) + + time.sleep(sampleTime/1000) #eccezione da ctrl+c in terminale e chiusura diff --git a/logger/PyLog.txt b/logger/PyLog.txt index e9e4db9..5f78d90 100644 --- a/logger/PyLog.txt +++ b/logger/PyLog.txt @@ -16,4 +16,10 @@ Program end. Ctrl+C from user at time: 2021-03-09 16:09:05.759802 Program end. Ctrl+C from user at time: 2021-03-15 16:01:16.217190 Program end. Ctrl+C from user at time: 2021-03-16 12:13:05.400117 Program end. Ctrl+C from user at time: 2021-03-18 08:58:50.018800 -Caught error: Error 111 connecting to 127.0.0.1:6379. Connection refused. at time: 2021-03-18 10:21:27.190143 \ No newline at end of file +Caught error: Error 111 connecting to 127.0.0.1:6379. Connection refused. at time: 2021-03-18 10:21:27.190143 +Program end. Ctrl+C from user at time: 2021-03-18 12:11:40.393985 +Program end. Ctrl+C from user at time: 2021-03-18 12:12:18.995260 +Program end. Ctrl+C from user at time: 2021-03-18 12:13:20.497212 +Program end. Ctrl+C from user at time: 2021-03-18 12:13:25.594680 +Program end. Ctrl+C from user at time: 2021-03-18 12:14:18.546804 +Program end. Ctrl+C from user at time: 2021-03-18 12:14:41.216737 \ No newline at end of file diff --git a/server/FlythisServer.py b/server/FlythisServer.py index eba1a11..c6c5a9b 100644 --- a/server/FlythisServer.py +++ b/server/FlythisServer.py @@ -69,16 +69,18 @@ def api_channels_all(): # Route di comando x LOG -@flaskApp.route("/api/v1/log/start", methods=['POST']) +@flaskApp.route("/api/v1/log/start", methods=['PUT']) def start_log(): - #funzione start_log: scrive su redis + #funzione start_log: scrive su redis LOG:STATUS -> 1 redSrv0.set('RTDATA:LOG:STATUS', 1) + return "OK" -@flaskApp.route("/api/v1/log/stop", methods=['POST']) +@flaskApp.route("/api/v1/log/stop", methods=['PUT']) def stop_log(): - #funzione start_log: scrive su redis + #funzione stop_log: scrive su redis LOG:STATUS -> 0 redSrv0.set('RTDATA:LOG:STATUS', 0) + return "OK" #dichiaro host ipv4 (ottenuto sopra utilizzando il modulo socket) diff --git a/server/templates/FlythisTrap.html b/server/templates/FlythisTrap.html index fe8f07a..ce98e81 100644 --- a/server/templates/FlythisTrap.html +++ b/server/templates/FlythisTrap.html @@ -29,16 +29,30 @@ $("#Chan7").html(result.Ch7); $("#ServerTime").html(result.timeNow); $("#LoggerTime").html(result.timeLog); - console.log(result); + //console.log(result); }}); timeout = setTimeout(dataRefresh, 200); } function startLog(){ - + $.ajax({ + type: 'PUT' + ,url: "/api/v1/log/start" + ,data: "" + ,success: function(){ + alert('Log Started'); + } + }) }; function stopLog(){ - + $.ajax({ + type: 'PUT' + ,url: "/api/v1/log/stop" + ,data: "" + ,success: function(){ + alert('Log Stopped'); + } + }) }; @@ -64,17 +78,17 @@
-
- - Server time -
+
+ + Server time +

-
- - Last log time -
+
+ + Last log time +

@@ -116,6 +130,7 @@
+
@@ -128,6 +143,8 @@ Record Log
+
+
check
Inizio