File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454pyloton .setup_display ()
5555
5656while ((not HEART or hr_connection .connected ) and
57- ((not SPEED or not CADENCE ) or speed_cadence_connections [0 ].connected ) and
57+ ((not SPEED or not CADENCE ) or
58+ (speed_cadence_connections and speed_cadence_connections [0 ].connected )) and
5859 (not AMS or ams .connected )):
5960 pyloton .update_display ()
6061 pyloton .ams_remote ()
Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ def _status_update(self, message):
206206
207207 if len (message ) > 25 :
208208 self .status .text = message [:25 ]
209- self .status1 .text = message [25 :]
209+ self .status1 .text = message [25 :50 ]
210210
211211 else :
212212 self .status .text = message
@@ -382,6 +382,12 @@ def read_s_and_c(self):
382382
383383 cadence = self ._compute_cadence (values , cadence )
384384
385+ if speed :
386+ if len (str (speed )) > 8 :
387+ speed = str (speed )[:8 ]
388+ if cadence :
389+ if len (str (cadence )) > 8 :
390+ cadence = str (cadence )[:8 ]
385391 return speed , cadence
386392
387393
@@ -395,6 +401,9 @@ def read_heart(self):
395401 else :
396402 heart = measurement .heart_rate
397403 self ._previous_heart = measurement .heart_rate
404+ if heart :
405+ if len (str (heart )) > 4 :
406+ heart = str (heart )[:4 ]
398407 return heart
399408
400409
@@ -412,9 +421,12 @@ def read_ams(self):
412421 data = self .ams .artist
413422 if not self .track_artist :
414423 data = self .ams .title
415- except RuntimeError :
424+ except ( RuntimeError , UnicodeError ) :
416425 data = None
417426
427+ if data :
428+ if len (data ) > 20 :
429+ data = data [:20 ]
418430 return data
419431
420432
You can’t perform that action at this time.
0 commit comments