@@ -226,7 +226,10 @@ def __init__(self, *, url=None, headers=None, json_path=None, regexp_path=None,
226226 self .set_backlight (i / 100 )
227227 time .sleep (0.005 )
228228 self .set_background (bootscreen )
229- board .DISPLAY .wait_for_frame ()
229+ try :
230+ board .DISPLAY .refresh (target_frames_per_second = 60 )
231+ except AttributeError :
232+ board .DISPLAY .wait_for_frame ()
230233 for i in range (100 ): # dim up
231234 self .set_backlight (i / 100 )
232235 time .sleep (0.005 )
@@ -446,9 +449,13 @@ def set_background(self, file_or_color, position=None):
446449 else :
447450 raise RuntimeError ("Unknown type of background" )
448451 self ._bg_group .append (self ._bg_sprite )
449- board .DISPLAY .refresh_soon ()
450- gc .collect ()
451- board .DISPLAY .wait_for_frame ()
452+ try :
453+ board .DISPLAY .refresh (target_frames_per_second = 60 )
454+ gc .collect ()
455+ except AttributeError :
456+ board .DISPLAY .refresh_soon ()
457+ gc .collect ()
458+ board .DISPLAY .wait_for_frame ()
452459
453460 def set_backlight (self , val ):
454461 """Adjust the TFT backlight.
@@ -498,8 +505,11 @@ def set_caption(self, caption_text, caption_position, caption_color):
498505
499506 if self ._caption :
500507 self ._caption ._update_text (str (caption_text )) # pylint: disable=protected-access
501- board .DISPLAY .refresh_soon ()
502- board .DISPLAY .wait_for_frame ()
508+ try :
509+ board .DISPLAY .refresh (target_frames_per_second = 60 )
510+ except AttributeError :
511+ board .DISPLAY .refresh_soon ()
512+ board .DISPLAY .wait_for_frame ()
503513 return
504514
505515 self ._caption = Label (self ._caption_font , text = str (caption_text ))
0 commit comments