Browse Source

make sure connection graph finishes

Thomas Buck 1 year ago
parent
commit
d0d15c4d67
2 changed files with 17 additions and 23 deletions
  1. 8
    14
      python-test/poll.py
  2. 9
    9
      python-test/state_connect.py

+ 8
- 14
python-test/poll.py View File

52
             characteristicc = c
52
             characteristicc = c
53
             if cb != None:
53
             if cb != None:
54
                 val += 1
54
                 val += 1
55
-                #await cb(val)
55
+                await cb(val)
56
 
56
 
57
         if c.uuid == uuidd:
57
         if c.uuid == uuidd:
58
             characteristicd = c
58
             characteristicd = c
59
             if cb != None:
59
             if cb != None:
60
                 val += 1
60
                 val += 1
61
-                #await cb(val)
62
-
63
-    if cb != None:
64
-        await cb(val)
61
+                await cb(val)
65
 
62
 
66
     # -------------------------------------------------------------------------
63
     # -------------------------------------------------------------------------
67
 
64
 
81
             characteristic1 = c
78
             characteristic1 = c
82
             if cb != None:
79
             if cb != None:
83
                 val += 1
80
                 val += 1
84
-                #await cb(val)
81
+                await cb(val)
85
 
82
 
86
         if c.uuid == uuid3:
83
         if c.uuid == uuid3:
87
             characteristic3 = c
84
             characteristic3 = c
88
             if cb != None:
85
             if cb != None:
89
                 val += 1
86
                 val += 1
90
-                #await cb(val)
87
+                await cb(val)
91
 
88
 
92
         if c.uuid == uuidf:
89
         if c.uuid == uuidf:
93
             characteristicf = c
90
             characteristicf = c
94
             if cb != None:
91
             if cb != None:
95
                 val += 1
92
                 val += 1
96
-                #await cb(val)
93
+                await cb(val)
97
 
94
 
98
         if c.uuid == uuid10:
95
         if c.uuid == uuid10:
99
             characteristic10 = c
96
             characteristic10 = c
100
             if cb != None:
97
             if cb != None:
101
                 val += 1
98
                 val += 1
102
-                #await cb(val)
99
+                await cb(val)
103
 
100
 
104
         if c.uuid == uuid13:
101
         if c.uuid == uuid13:
105
             characteristic13 = c
102
             characteristic13 = c
106
             if cb != None:
103
             if cb != None:
107
                 val += 1
104
                 val += 1
108
-                #await cb(val)
105
+                await cb(val)
109
 
106
 
110
         if c.uuid == uuid14:
107
         if c.uuid == uuid14:
111
             characteristic14 = c
108
             characteristic14 = c
112
             if cb != None:
109
             if cb != None:
113
                 val += 1
110
                 val += 1
114
-                #await cb(val)
115
-
116
-    if cb != None:
117
-        await cb(val)
111
+                await cb(val)
118
 
112
 
119
     return (val >= 10)
113
     return (val >= 10)
120
 
114
 

+ 9
- 9
python-test/state_connect.py View File

66
                 return 0
66
                 return 0
67
 
67
 
68
         async with self.lock:
68
         async with self.lock:
69
+            if self.state == False:
70
+                self.lcd.textC("Disconnecting...", int(self.lcd.width / 2), int(self.lcd.height / 2), self.lcd.white)
71
+            else:
72
+                if self.step == False:
73
+                    self.lcd.textC("Connecting...", int(self.lcd.width / 2), int(self.lcd.height / 2), self.lcd.white)
74
+                else:
75
+                    draw_graph(self.lcd, 0, self.iteration, 10)
76
+                    self.lcd.textC("Fetching parameters...", int(self.lcd.width / 2), int(self.lcd.height / 2) - 10, self.lcd.white, self.lcd.black)
77
+
69
             if self.done:
78
             if self.done:
70
                 if self.state:
79
                 if self.state:
71
                     return 3
80
                     return 3
72
                 else:
81
                 else:
73
                     return 0
82
                     return 0
74
-            else:
75
-                if self.state == False:
76
-                    self.lcd.textC("Disconnecting...", int(self.lcd.width / 2), int(self.lcd.height / 2), self.lcd.white)
77
-                else:
78
-                    if self.step == False:
79
-                        self.lcd.textC("Connecting...", int(self.lcd.width / 2), int(self.lcd.height / 2), self.lcd.white)
80
-                    else:
81
-                        draw_graph(self.lcd, 0, self.iteration, 10)
82
-                        self.lcd.textC("Fetching parameters...", int(self.lcd.width / 2), int(self.lcd.height / 2) - 10, self.lcd.white, self.lcd.black)
83
 
83
 
84
         return -1
84
         return -1

Loading…
Cancel
Save