summaryrefslogtreecommitdiff
path: root/shared-module/displayio/Display.c
diff options
context:
space:
mode:
Diffstat (limited to 'shared-module/displayio/Display.c')
-rw-r--r--shared-module/displayio/Display.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c
index 51c6f292a..c23c66b8b 100644
--- a/shared-module/displayio/Display.c
+++ b/shared-module/displayio/Display.c
@@ -85,9 +85,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
uint32_t i = 0;
while (!self->begin_transaction(self->bus)) {
-#ifdef MICROPY_VM_HOOK_LOOP
- MICROPY_VM_HOOK_LOOP ;
-#endif
+ RUN_BACKGROUND_TASKS;
}
while (i < init_sequence_len) {
uint8_t *cmd = init_sequence + i;
@@ -199,19 +197,26 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
bool common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group) {
if (root_group == NULL) {
- root_group = &circuitpython_splash;
+ if (!circuitpython_splash.in_group) {
+ root_group = &circuitpython_splash;
+ } else if (self->current_group == &circuitpython_splash) {
+ return false;
+ }
}
if (root_group == self->current_group) {
return true;
}
- if (root_group->in_group) {
+ if (root_group != NULL && root_group->in_group) {
return false;
}
if (self->current_group != NULL) {
self->current_group->in_group = false;
}
- displayio_group_update_transform(root_group, &self->transform);
- root_group->in_group = true;
+
+ if (root_group != NULL) {
+ displayio_group_update_transform(root_group, &self->transform);
+ root_group->in_group = true;
+ }
self->current_group = root_group;
self->full_refresh = true;
common_hal_displayio_display_refresh_soon(self);
@@ -235,7 +240,7 @@ int32_t common_hal_displayio_display_wait_for_frame(displayio_display_obj_t* sel
uint64_t last_refresh = self->last_refresh;
// Don't try to refresh if we got an exception.
while (last_refresh == self->last_refresh && MP_STATE_VM(mp_pending_exception) == NULL) {
- MICROPY_VM_HOOK_LOOP
+ RUN_BACKGROUND_TASKS;
}
return 0;
}
@@ -402,6 +407,10 @@ void displayio_display_update_backlight(displayio_display_obj_t* self) {
}
void release_display(displayio_display_obj_t* self) {
+ if (self->current_group != NULL) {
+ self->current_group->in_group = false;
+ }
+
if (self->backlight_pwm.base.type == &pulseio_pwmout_type) {
common_hal_pulseio_pwmout_reset_ok(&self->backlight_pwm);
common_hal_pulseio_pwmout_deinit(&self->backlight_pwm);