]> git.gag.com Git - fw/quantimotor/commitdiff
successfully counting calls and updating value based on call count
authorBdale Garbee <bdale@gag.com>
Wed, 7 May 2025 20:31:41 +0000 (14:31 -0600)
committerBdale Garbee <bdale@gag.com>
Wed, 7 May 2025 20:31:41 +0000 (14:31 -0600)
application/app.py

index ea64590afbf334c9285c003642ceb5e44a09b3a6..3fc23eb7de4295d1ca5ffe58e12cc83b1fc7fab1 100755 (executable)
@@ -12,6 +12,8 @@ from gpiod.line import Direction, Value
 import signal
 import sys
 
+n=0
+
 # set gpio lines
 def set_line_values(chip_path, line_values):
   value_str = {Value.ACTIVE: "Active", Value.INACTIVE: "Inactive"}
@@ -65,13 +67,15 @@ class App:
   @cherrypy.expose
   @cherrypy.tools.json_out()
   def getData(self):
-    a = 'a few'
-    b = ' psi'
-    n = 42
-    c = str(n) + b
+    global n
+    n = n + 1
+    a = ' psi'
+    b = ' N'
+    p = str(n) + a
+    t = str(n) + b
     return {
-      'pressure' : c,
-      'thrust' : 'more N'
+      'pressure' : p,
+      'thrust' : t
     }