浏览代码

make sure connection graph finishes

Thomas Buck 1年前
父节点
当前提交
d0d15c4d67
共有 2 个文件被更改,包括 17 次插入23 次删除
  1. 8
    14
      python-test/poll.py
  2. 9
    9
      python-test/state_connect.py

+ 8
- 14
python-test/poll.py 查看文件

@@ -52,16 +52,13 @@ async def cache_services_characteristics(device, cb = None):
52 52
             characteristicc = c
53 53
             if cb != None:
54 54
                 val += 1
55
-                #await cb(val)
55
+                await cb(val)
56 56
 
57 57
         if c.uuid == uuidd:
58 58
             characteristicd = c
59 59
             if cb != None:
60 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,40 +78,37 @@ async def cache_services_characteristics(device, cb = None):
81 78
             characteristic1 = c
82 79
             if cb != None:
83 80
                 val += 1
84
-                #await cb(val)
81
+                await cb(val)
85 82
 
86 83
         if c.uuid == uuid3:
87 84
             characteristic3 = c
88 85
             if cb != None:
89 86
                 val += 1
90
-                #await cb(val)
87
+                await cb(val)
91 88
 
92 89
         if c.uuid == uuidf:
93 90
             characteristicf = c
94 91
             if cb != None:
95 92
                 val += 1
96
-                #await cb(val)
93
+                await cb(val)
97 94
 
98 95
         if c.uuid == uuid10:
99 96
             characteristic10 = c
100 97
             if cb != None:
101 98
                 val += 1
102
-                #await cb(val)
99
+                await cb(val)
103 100
 
104 101
         if c.uuid == uuid13:
105 102
             characteristic13 = c
106 103
             if cb != None:
107 104
                 val += 1
108
-                #await cb(val)
105
+                await cb(val)
109 106
 
110 107
         if c.uuid == uuid14:
111 108
             characteristic14 = c
112 109
             if cb != None:
113 110
                 val += 1
114
-                #await cb(val)
115
-
116
-    if cb != None:
117
-        await cb(val)
111
+                await cb(val)
118 112
 
119 113
     return (val >= 10)
120 114
 

+ 9
- 9
python-test/state_connect.py 查看文件

@@ -66,19 +66,19 @@ class StateConnect:
66 66
                 return 0
67 67
 
68 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 78
             if self.done:
70 79
                 if self.state:
71 80
                     return 3
72 81
                 else:
73 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 84
         return -1

正在加载...
取消
保存