@@ -215,7 +215,7 @@ STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in)
215
215
}
216
216
MP_DEFINE_CONST_FUN_OBJ_2 (displayio_display_show_obj , displayio_display_obj_show );
217
217
218
- //| def refresh(self, *, target_frames_per_second: int = 60 , minimum_frames_per_second: int = 1) -> bool:
218
+ //| def refresh(self, *, target_frames_per_second: int = None , minimum_frames_per_second: int = 1) -> bool:
219
219
//| """When auto refresh is off, waits for the target frame rate and then refreshes the display,
220
220
//| returning True. If the call has taken too long since the last refresh call for the given
221
221
//| target frame rate, then the refresh returns False immediately without updating the screen to
@@ -231,13 +231,14 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show
231
231
//| the display immediately.
232
232
//|
233
233
//| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated.
234
+ //| Set to None for immediate refresh.
234
235
//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second."""
235
236
//| ...
236
237
//|
237
238
STATIC mp_obj_t displayio_display_obj_refresh (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
238
239
enum { ARG_target_frames_per_second , ARG_minimum_frames_per_second };
239
240
static const mp_arg_t allowed_args [] = {
240
- { MP_QSTR_target_frames_per_second , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_OBJ_NEW_SMALL_INT ( 60 ) } },
241
+ { MP_QSTR_target_frames_per_second , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = mp_const_none } },
241
242
{ MP_QSTR_minimum_frames_per_second , MP_ARG_KW_ONLY | MP_ARG_INT , {.u_int = 1 } },
242
243
};
243
244
@@ -252,8 +253,7 @@ STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos
252
253
}
253
254
254
255
uint32_t target_ms_per_frame ;
255
- if ( (args [ARG_target_frames_per_second ].u_obj == mp_const_none ) || (n_args == 1 ) ) {
256
- // if None or no arguments
256
+ if (args [ARG_target_frames_per_second ].u_obj == mp_const_none ) {
257
257
target_ms_per_frame = 0xffffffff ;
258
258
}
259
259
else {
0 commit comments