@@ -88,7 +88,6 @@ def calibrate(indev, cal_data):
8888 lcd_bus ._pump_main_thread () # NOQA
8989 time .sleep_ms (5 ) # NOQA
9090
91- label .delete ()
9291 count = 0
9392 while count < 100 :
9493 count += 1
@@ -113,8 +112,16 @@ def calibrate(indev, cal_data):
113112 for i in range (3 ):
114113 print ('point' , i + 1 , 'of 3' )
115114
115+ label .set_text (f'Point { i + 1 } of 3' )
116+ label .center ()
117+
116118 target .set_pos (* coords [i ])
117119 lcd_bus ._pump_main_thread () # NOQA
120+ time .sleep_ms (2000 ) # NOQA
121+
122+ label .set_text ('Press and hold\n red circle' )
123+ label .center ()
124+ lcd_bus ._pump_main_thread () # NOQA
118125
119126 time .sleep_ms (1000 ) # NOQA
120127
@@ -126,7 +133,21 @@ def calibrate(indev, cal_data):
126133 else :
127134 state = 0
128135
136+ text_on = True
137+ text_count = 75
138+
129139 while touch is None or not state :
140+ if text_count == 75 :
141+ text_count = 0
142+ if text_on :
143+ label .set_text ('' )
144+ else :
145+ label .set_text ('Press and hold\n red circle' )
146+ label .center ()
147+
148+ text_on = not text_on
149+
150+ text_count += 1
130151 time .sleep_ms (10 ) # NOQA
131152 lcd_bus ._pump_main_thread () # NOQA
132153 touch = indev ._get_coords () # NOQA
@@ -137,10 +158,21 @@ def calibrate(indev, cal_data):
137158 state = 0
138159
139160 x , y = touch [1 :]
161+ label .set_text (
162+ f'Touch { j + 1 } of 8 collected\n '
163+ f'x: { x } \n '
164+ f'y: { y } '
165+ )
166+ label .center ()
167+ lcd_bus ._pump_main_thread () # NOQA
168+
140169 captured_points [i ]['x' ].append (x )
141170 captured_points [i ]['y' ].append (y )
142171
143172 print (' ' , j + 1 , 'of 8:' , (x , y ))
173+ time .sleep_ms (1000 ) # NOQA
174+
175+ time .sleep_ms (2000 ) # NOQA
144176
145177 print ()
146178 print ('averaged trimmed points' )
@@ -154,16 +186,31 @@ def calibrate(indev, cal_data):
154186 points ['y' ] = int (sum (points ['y' ]) / 6 )
155187
156188 print (' point' , i + 1 , 'of 3:' , (points ['x' ], points ['y' ]))
189+ label .set_text (
190+ f'Averaged trimmed point { i + 1 } \n '
191+ f'x: { points ["x" ]} \n '
192+ f'y: { points ["y" ]} '
193+ )
194+ label .center ()
195+ lcd_bus ._pump_main_thread () # NOQA
196+ time .sleep_ms (1000 ) # NOQA
157197
158- if captured_points [0 ]['x' ] > captured_points [1 ]['x' ]:
159- mirror_x = True
160- else :
161- mirror_x = False
198+ label .set_text ('' )
199+ label .center ()
200+ lcd_bus ._pump_main_thread () # NOQA
162201
163- if captured_points [0 ]['y' ] > captured_points [2 ]['y' ]:
164- mirror_y = True
165- else :
166- mirror_y = False
202+ # if captured_points[0]['x'] > captured_points[1]['x']:
203+ # mirror_x = True
204+ # else:
205+ # mirror_x = False
206+ #
207+ # if captured_points[0]['y'] > captured_points[2]['y']:
208+ # mirror_y = True
209+ # else:
210+ # mirror_y = False
211+
212+ mirror_x = False
213+ mirror_y = False
167214
168215 print ('mirroring' )
169216 print (' mirrored x:' , mirror_x )
@@ -221,10 +268,32 @@ def calibrate(indev, cal_data):
221268 cal_data .mirrorX = mirror_x
222269 cal_data .mirrorY = mirror_y
223270
271+ label .set_text (
272+ f'Calibration values\n '
273+ f'alphaX: { round (alphaX , 6 )} \n '
274+ f'betaX: { round (betaX , 6 )} \n '
275+ f'deltaX: { round (deltaX , 6 )} \n '
276+ f'alphaY: { round (betaX , 6 )} \n '
277+ f'betaY: { round (alphaX , 6 )} \n '
278+ f'deltaY: { round (betaX , 6 )} '
279+ )
280+ label .center ()
281+ lcd_bus ._pump_main_thread () # NOQA
282+ time .sleep_ms (5000 ) # NOQA
283+
224284 except ZeroDivisionError :
225285 print ('Error in calculation please try again.' )
226286 res = False
287+ label .set_text ('ERROR' )
288+ label .center ()
289+ lcd_bus ._pump_main_thread () # NOQA
290+ time .sleep_ms (1000 ) # NOQA
291+
227292 else :
293+ label .set_text ('FINISHED' )
294+ label .center ()
295+ lcd_bus ._pump_main_thread () # NOQA
296+ time .sleep_ms (1000 ) # NOQA
228297 res = True
229298
230299 lv .screen_load (old_scrn ) # NOQA
0 commit comments