@@ -136,12 +136,15 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
136
136
137
137
// Set the group after initialization otherwise we may send pixels while we delay in
138
138
// initialization.
139
- common_hal_displayio_display_show (self , & circuitpython_splash );
139
+ common_hal_displayio_display_set_root_group (self , & circuitpython_splash );
140
140
common_hal_displayio_display_set_auto_refresh (self , auto_refresh );
141
141
}
142
142
143
143
bool 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 );
145
148
}
146
149
147
150
uint16_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) {
206
209
}
207
210
208
211
mp_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
+ }
209
215
return self -> core .current_group ;
210
216
}
211
217
@@ -398,6 +404,14 @@ void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t *self
398
404
self -> auto_refresh = auto_refresh ;
399
405
}
400
406
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
+
401
415
void displayio_display_background (displayio_display_obj_t * self ) {
402
416
if (self -> auto_refresh && (supervisor_ticks_ms64 () - self -> core .last_refresh ) > self -> native_ms_per_frame ) {
403
417
_refresh_display (self );
@@ -421,7 +435,10 @@ void release_display(displayio_display_obj_t *self) {
421
435
422
436
void reset_display (displayio_display_obj_t * self ) {
423
437
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 );
425
442
}
426
443
427
444
void displayio_display_collect_ptrs (displayio_display_obj_t * self ) {
0 commit comments