@@ -136,12 +136,15 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
136136
137137 // Set the group after initialization otherwise we may send pixels while we delay in
138138 // initialization.
139- common_hal_displayio_display_show (self , & circuitpython_splash );
139+ common_hal_displayio_display_set_root_group (self , & circuitpython_splash );
140140 common_hal_displayio_display_set_auto_refresh (self , auto_refresh );
141141}
142142
143143bool common_hal_displayio_display_show (displayio_display_obj_t * self , displayio_group_t * root_group ) {
144- return displayio_display_core_show (& self -> core , root_group );
144+ if (root_group == NULL ) {
145+ root_group = & circuitpython_splash ;
146+ }
147+ return displayio_display_core_set_root_group (& self -> core , root_group );
145148}
146149
147150uint16_t common_hal_displayio_display_get_width (displayio_display_obj_t * self ) {
@@ -206,6 +209,9 @@ mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self) {
206209}
207210
208211mp_obj_t common_hal_displayio_display_get_root_group (displayio_display_obj_t * self ) {
212+ if (self -> core .current_group == NULL ) {
213+ return mp_const_none ;
214+ }
209215 return self -> core .current_group ;
210216}
211217
@@ -398,6 +404,14 @@ void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t *self
398404 self -> auto_refresh = auto_refresh ;
399405}
400406
407+ mp_obj_t common_hal_displayio_display_set_root_group (displayio_display_obj_t * self , displayio_group_t * root_group ) {
408+ bool ok = displayio_display_core_set_root_group (& self -> core , root_group );
409+ if (!ok ) {
410+ mp_raise_ValueError (translate ("Group already used" ));
411+ }
412+ return mp_const_none ;
413+ }
414+
401415void displayio_display_background (displayio_display_obj_t * self ) {
402416 if (self -> auto_refresh && (supervisor_ticks_ms64 () - self -> core .last_refresh ) > self -> native_ms_per_frame ) {
403417 _refresh_display (self );
@@ -421,7 +435,10 @@ void release_display(displayio_display_obj_t *self) {
421435
422436void reset_display (displayio_display_obj_t * self ) {
423437 common_hal_displayio_display_set_auto_refresh (self , true);
424- common_hal_displayio_display_show (self , NULL );
438+ circuitpython_splash .x = 0 ; // reset position in case someone moved it.
439+ circuitpython_splash .y = 0 ;
440+ supervisor_start_terminal (self -> core .width , self -> core .height );
441+ common_hal_displayio_display_set_root_group (self , & circuitpython_splash );
425442}
426443
427444void displayio_display_collect_ptrs (displayio_display_obj_t * self ) {
0 commit comments