]> git.gag.com Git - fw/quantimotor/commitdiff
now displaying UTC date and time too
authorBdale Garbee <bdale@gag.com>
Wed, 7 May 2025 22:46:02 +0000 (16:46 -0600)
committerBdale Garbee <bdale@gag.com>
Wed, 7 May 2025 22:46:02 +0000 (16:46 -0600)
application/app.py
application/index.html

index 5aaa322eb507f22933a4df0750672ccdf75e65d4..f870275c18ce740d61e6c6b441246b434bfc24f4 100755 (executable)
@@ -12,6 +12,7 @@ from gpiod.line import Direction, Value
 import iio
 import signal
 import sys
+import time
 
 n = 0
 pressure = 0
@@ -90,6 +91,7 @@ class App:
 
   @cherrypy.expose
   @cherrypy.tools.json_out()
+
   def getData(self):
     global n
     global pressure
@@ -97,6 +99,9 @@ class App:
     global pyro
     global battery
 
+    t = time.localtime()
+    current_time = time.strftime("%Y:%m:%d %H:%M:%S", t)
+
     for id in VOLTAGES:
       chan = ctrl.find_channel(id)
       rawstring = chan.attrs['raw'].value
@@ -114,6 +119,7 @@ class App:
     armed = sense_armed()
 
     return {
+      'time' : current_time,
       'pressure' : pressure,
       'thrust' : thrust,
       'pyro' : pyro,
index 2fdf1b6a66bb54307a2db2085f26c9f862114192..aaeca09b5494a904258f26e99358d95e7180b37f 100644 (file)
@@ -12,6 +12,7 @@
       var request = $.ajax({'url': '/getData'});
       request.done(function(response) 
       {
+        $('#time').text(response.time);
         $('#pressure').text(response.pressure);
         $('#thrust').text(response.thrust);
         $('#pyro').text(response.pyro);
@@ -29,6 +30,8 @@
 <body>
   <h1>QuantiMotor</h1>
   <button>make ajax call</button>
+  <h2>Time</h2>
+  <div id='time'></div>
   <h2>Pressure</h2>
   <div id='pressure'></div>
   <h2>Thrust</h2>