Skip to content

Commit e14de38

Browse files
committed
Revise .refresh input default value for target_frames_per_second to None
1 parent 8be862e commit e14de38

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

shared-bindings/displayio/Display.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in)
215215
}
216216
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show);
217217

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:
219219
//| """When auto refresh is off, waits for the target frame rate and then refreshes the display,
220220
//| returning True. If the call has taken too long since the last refresh call for the given
221221
//| 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
231231
//| the display immediately.
232232
//|
233233
//| :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.
234235
//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second."""
235236
//| ...
236237
//|
237238
STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
238239
enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second };
239240
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} },
241242
{ MP_QSTR_minimum_frames_per_second, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
242243
};
243244

@@ -252,8 +253,7 @@ STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos
252253
}
253254

254255
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) {
257257
target_ms_per_frame = 0xffffffff;
258258
}
259259
else {

0 commit comments

Comments
 (0)