Skip to content

Commit 738b73d

Browse files
committed
check for NULL in fill_area. moved start_terminal to reset_display.
1 parent 2c479f4 commit 738b73d

File tree

2 files changed

+12
-32
lines changed

2 files changed

+12
-32
lines changed

shared-module/displayio/Display.c

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -136,30 +136,12 @@ 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-
mp_printf(&mp_plat_print, "Inside display make_new\n");
140-
is_null(&circuitpython_splash);
141-
//is_null(0);
142-
// if(circuitpython_splash == mp_const_none) {
143-
// mp_printf(&mp_plat_print, "Splash is NULL \n");
144-
// }
145-
// mp_printf(&mp_plat_print, *circuitpython_splash);
146-
// mp_printf(&mp_plat_print, "\n");
147-
//common_hal_displayio_display_show(self, &circuitpython_splash);
148-
common_hal_displayio_display_set_auto_refresh(self, auto_refresh);
149-
}
150139

151-
void is_null(displayio_group_t *root_group){
152-
if (root_group == NULL){
153-
mp_printf(&mp_plat_print, "root_group is NULL\n");
154-
}else{
155-
mp_printf(&mp_plat_print, "root_group not NULL");
156-
}
140+
common_hal_displayio_display_set_root_group(self, &circuitpython_splash);
141+
common_hal_displayio_display_set_auto_refresh(self, auto_refresh);
157142
}
158143

159144
bool common_hal_displayio_display_show(displayio_display_obj_t *self, displayio_group_t *root_group) {
160-
if(root_group == NULL){
161-
mp_printf(&mp_plat_print, "Its NULL inside display.show()\n");
162-
}
163145
return displayio_display_core_set_root_group(&self->core, root_group);
164146
}
165147

@@ -448,7 +430,10 @@ void release_display(displayio_display_obj_t *self) {
448430

449431
void reset_display(displayio_display_obj_t *self) {
450432
common_hal_displayio_display_set_auto_refresh(self, true);
451-
common_hal_displayio_display_show(self, &circuitpython_splash);
433+
circuitpython_splash.x = 0; // reset position in case someone moved it.
434+
circuitpython_splash.y = 0;
435+
supervisor_start_terminal(self->core.width, self->core.height);
436+
common_hal_displayio_display_set_root_group(self, &circuitpython_splash);
452437
}
453438

454439
void displayio_display_collect_ptrs(displayio_display_obj_t *self) {

shared-module/displayio/display_core.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,8 @@ void displayio_display_core_set_rotation(displayio_display_core_t *self,
164164

165165
bool displayio_display_core_set_root_group(displayio_display_core_t *self, displayio_group_t *root_group) {
166166

167-
if (root_group == NULL) { // set the display to the REPL, reset REPL position and size
168-
//circuitpython_splash.in_group = false;
169-
// force the circuit_python_splash out of any group (Note: could cause problems with the parent group)
170-
//circuitpython_splash.x = 0; // reset position in case someone moved it.
171-
//circuitpython_splash.y = 0;
172-
mp_printf(&mp_plat_print, "Inside set root group NULL\n");
173-
//supervisor_start_terminal(self->width, self->height);
174-
175-
//root_group = &circuitpython_splash;
176-
167+
if (root_group == NULL) {
168+
// Show nothing on the display
177169
}
178170
if (root_group == self->current_group) {
179171
return true;
@@ -367,7 +359,10 @@ void displayio_display_core_collect_ptrs(displayio_display_core_t *self) {
367359
}
368360

369361
bool displayio_display_core_fill_area(displayio_display_core_t *self, displayio_area_t *area, uint32_t *mask, uint32_t *buffer) {
370-
return displayio_group_fill_area(self->current_group, &self->colorspace, area, mask, buffer);
362+
if(self->current_group != NULL){
363+
return displayio_group_fill_area(self->current_group, &self->colorspace, area, mask, buffer);
364+
}
365+
return false;
371366
}
372367

373368
bool displayio_display_core_clip_area(displayio_display_core_t *self, const displayio_area_t *area, displayio_area_t *clipped) {

0 commit comments

Comments
 (0)