diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 5576e2cbfc..5d3c29b8aa 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -239,33 +239,6 @@ static displayio_display_obj_t *native_display(mp_obj_t display_obj) { return MP_OBJ_TO_PTR(native_display); } -//| def show(self, group: Group) -> None: -//| """ -//| .. note:: `show()` is deprecated and will be removed in CircuitPython 9.0.0. -//| Use ``.root_group = group`` instead. -//| -//| Switches to displaying the given group of layers. When group is None, the default -//| CircuitPython terminal will be shown. -//| -//| :param Group group: The group to show. -//| -//| """ -//| ... -STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) { - displayio_display_obj_t *self = native_display(self_in); - displayio_group_t *group = NULL; - if (group_in != mp_const_none) { - group = MP_OBJ_TO_PTR(native_group(group_in)); - } - - bool ok = common_hal_displayio_display_show(self, group); - if (!ok) { - mp_raise_ValueError(translate("Group already used")); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show); - //| def refresh( //| self, //| *, @@ -512,7 +485,6 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_fill_row_obj, 1, displayio_display_obj_fill_row); STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_display_show_obj) }, { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_display_refresh_obj) }, { MP_ROM_QSTR(MP_QSTR_fill_row), MP_ROM_PTR(&displayio_display_fill_row_obj) }, diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index 35f23ae40f..50fb7c4bfd 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -46,9 +46,6 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second, bool backlight_on_high, bool SH1107_addressing, uint16_t backlight_pwm_frequency); -bool common_hal_displayio_display_show(displayio_display_obj_t *self, - displayio_group_t *root_group); - bool common_hal_displayio_display_refresh(displayio_display_obj_t *self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame); bool common_hal_displayio_display_get_auto_refresh(displayio_display_obj_t *self); diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index cca8c919cc..afda693c7e 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -245,31 +245,6 @@ static displayio_epaperdisplay_obj_t *native_display(mp_obj_t display_obj) { return MP_OBJ_TO_PTR(native_display); } -//| def show(self, group: Group) -> None: -//| """ -//| .. note:: `show()` is deprecated and will be removed in CircuitPython 9.0.0. -//| Use ``.root_group = group`` instead. -//| -//| Switches to displaying the given group of layers. When group is None, the default -//| CircuitPython terminal will be shown. -//| -//| :param Group group: The group to show.""" -//| ... -STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t group_in) { - displayio_epaperdisplay_obj_t *self = native_display(self_in); - displayio_group_t *group = NULL; - if (group_in != mp_const_none) { - group = MP_OBJ_TO_PTR(native_group(group_in)); - } - - bool ok = common_hal_displayio_epaperdisplay_show(self, group); - if (!ok) { - mp_raise_ValueError(translate("Group already used")); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show); - //| def update_refresh_mode( //| self, start_sequence: ReadableBuffer, seconds_per_frame: float = 180 //| ) -> None: @@ -415,7 +390,6 @@ MP_PROPERTY_GETSET(displayio_epaperdisplay_root_group_obj, (mp_obj_t)&displayio_epaperdisplay_set_root_group_obj); STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_epaperdisplay_show_obj) }, { MP_ROM_QSTR(MP_QSTR_update_refresh_mode), MP_ROM_PTR(&displayio_epaperdisplay_update_refresh_mode_obj) }, { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_epaperdisplay_refresh_obj) }, diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index bdaad61300..ba0b6d0695 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -52,8 +52,6 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t *self); -bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group); - mp_obj_t common_hal_displayio_epaperdisplay_get_root_group(displayio_epaperdisplay_obj_t *self); bool common_hal_displayio_epaperdisplay_set_root_group(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group); diff --git a/shared-bindings/displayio/OnDiskBitmap.c b/shared-bindings/displayio/OnDiskBitmap.c index d0dcba2339..99cf3c4576 100644 --- a/shared-bindings/displayio/OnDiskBitmap.c +++ b/shared-bindings/displayio/OnDiskBitmap.c @@ -50,7 +50,7 @@ //| //| board.DISPLAY.brightness = 0 //| splash = displayio.Group() -//| board.DISPLAY.show(splash) +//| board.DISPLAY.root_group = splash //| //| odb = displayio.OnDiskBitmap('/sample.bmp') //| face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader) diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index d57081e16f..45eedcaa95 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -99,27 +99,6 @@ static framebufferio_framebufferdisplay_obj_t *native_display(mp_obj_t display_o return MP_OBJ_TO_PTR(native_display); } -//| def show(self, group: displayio.Group) -> None: -//| """Switches to displaying the given group of layers. When group is None, the default -//| CircuitPython terminal will be shown. -//| -//| :param Group group: The group to show.""" -//| ... -STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_obj_t group_in) { - framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); - displayio_group_t *group = NULL; - if (group_in != mp_const_none) { - group = MP_OBJ_TO_PTR(native_group(group_in)); - } - - bool ok = common_hal_framebufferio_framebufferdisplay_show(self, group); - if (!ok) { - mp_raise_ValueError(translate("Group already used")); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebufferio_framebufferdisplay_obj_show); - //| def refresh( //| self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1 //| ) -> bool: @@ -354,7 +333,6 @@ MP_PROPERTY_GETSET(framebufferio_framebufferdisplay_root_group_obj, (mp_obj_t)&framebufferio_framebufferdisplay_set_root_group_obj); STATIC const mp_rom_map_elem_t framebufferio_framebufferdisplay_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&framebufferio_framebufferdisplay_show_obj) }, { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&framebufferio_framebufferdisplay_refresh_obj) }, { MP_ROM_QSTR(MP_QSTR_fill_row), MP_ROM_PTR(&framebufferio_framebufferdisplay_fill_row_obj) }, diff --git a/shared-bindings/framebufferio/FramebufferDisplay.h b/shared-bindings/framebufferio/FramebufferDisplay.h index 6526e25afb..96d39e6aef 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.h +++ b/shared-bindings/framebufferio/FramebufferDisplay.h @@ -42,9 +42,6 @@ void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebu uint16_t rotation, bool auto_refresh); -bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t *self, - displayio_group_t *root_group); - bool common_hal_framebufferio_framebufferdisplay_refresh(framebufferio_framebufferdisplay_obj_t *self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame); bool common_hal_framebufferio_framebufferdisplay_get_auto_refresh(framebufferio_framebufferdisplay_obj_t *self); diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 093604214d..5d9cc2357c 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -140,13 +140,6 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, common_hal_displayio_display_set_auto_refresh(self, auto_refresh); } -bool common_hal_displayio_display_show(displayio_display_obj_t *self, displayio_group_t *root_group) { - if (root_group == NULL) { - root_group = &circuitpython_splash; - } - return displayio_display_core_set_root_group(&self->core, root_group); -} - uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t *self) { return displayio_display_core_get_width(&self->core); } diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index e79c692766..4db1b7cb5c 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -116,14 +116,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t // Set the group after initialization otherwise we may send pixels while we delay in // initialization. - common_hal_displayio_epaperdisplay_show(self, &circuitpython_splash); -} - -bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group) { - if (root_group == NULL) { - root_group = &circuitpython_splash; - } - return displayio_display_core_set_root_group(&self->core, root_group); + common_hal_displayio_epaperdisplay_set_root_group(self, &circuitpython_splash); } bool common_hal_displayio_epaperdisplay_set_root_group(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group) { @@ -503,6 +496,11 @@ void release_epaperdisplay(displayio_epaperdisplay_obj_t *self) { } } +void displayio_epaperdisplay_reset(displayio_epaperdisplay_obj_t *self) { + displayio_display_core_set_root_group(&self->core, &circuitpython_splash); + self->core.full_refresh = true; +} + void displayio_epaperdisplay_collect_ptrs(displayio_epaperdisplay_obj_t *self) { displayio_display_core_collect_ptrs(&self->core); gc_collect_ptr((void *)self->start_sequence); diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index 13cf84dbd3..d527ed2f50 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -62,6 +62,7 @@ typedef struct { void displayio_epaperdisplay_change_refresh_mode_parameters(displayio_epaperdisplay_obj_t *self, mp_buffer_info_t *start_sequence, float seconds_per_frame); void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t *self); +void displayio_epaperdisplay_reset(displayio_epaperdisplay_obj_t *self); void release_epaperdisplay(displayio_epaperdisplay_obj_t *self); size_t maybe_refresh_epaperdisplay(void); diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index a62b0a8bb5..c81dcb18c1 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -302,7 +302,7 @@ void reset_displays(void) { reset_display(&displays[i].display); } else if (display_type == &displayio_epaperdisplay_type) { displayio_epaperdisplay_obj_t *display = &displays[i].epaper_display; - common_hal_displayio_epaperdisplay_show(display, NULL); + displayio_epaperdisplay_reset(display); #if CIRCUITPY_FRAMEBUFFERIO } else if (display_type == &framebufferio_framebufferdisplay_type) { framebufferio_framebufferdisplay_reset(&displays[i].framebuffer_display); diff --git a/shared-module/framebufferio/FramebufferDisplay.c b/shared-module/framebufferio/FramebufferDisplay.c index 737cef5ad0..ec59efef4a 100644 --- a/shared-module/framebufferio/FramebufferDisplay.c +++ b/shared-module/framebufferio/FramebufferDisplay.c @@ -100,17 +100,10 @@ void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebu // Set the group after initialization otherwise we may send pixels while we delay in // initialization. - common_hal_framebufferio_framebufferdisplay_show(self, &circuitpython_splash); + displayio_display_core_set_root_group(&self->core, &circuitpython_splash); common_hal_framebufferio_framebufferdisplay_set_auto_refresh(self, auto_refresh); } -bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t *self, displayio_group_t *root_group) { - if (root_group == NULL) { - root_group = &circuitpython_splash; - } - return displayio_display_core_set_root_group(&self->core, root_group); -} - uint16_t common_hal_framebufferio_framebufferdisplay_get_width(framebufferio_framebufferdisplay_obj_t *self) { return displayio_display_core_get_width(&self->core); } @@ -360,7 +353,7 @@ void framebufferio_framebufferdisplay_reset(framebufferio_framebufferdisplay_obj const mp_obj_type_t *fb_type = mp_obj_get_type(self->framebuffer); if (fb_type != NULL && fb_type != &mp_type_NoneType) { common_hal_framebufferio_framebufferdisplay_set_auto_refresh(self, true); - common_hal_framebufferio_framebufferdisplay_show(self, NULL); + displayio_display_core_set_root_group(&self->core, &circuitpython_splash); self->core.full_refresh = true; } else { release_framebufferdisplay(self);