Skip to content

Commit

Permalink
fix(core): TS5 - wait for frame to appear on display before raising b…
Browse files Browse the repository at this point in the history
…acklight

[no changelog]
  • Loading branch information
TychoVrahe committed Dec 13, 2024
1 parent e196413 commit 7c73dd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/embed/io/display/st-7789/display_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ void display_fb_clear(void) {
static void bg_copy_callback(void) {
display_driver_t *drv = &g_display_driver;

drv->update_pending = 1;

fb_queue_put(&drv->empty_frames, fb_queue_take(&drv->ready_frames));
}

Expand All @@ -144,6 +146,10 @@ static void display_te_interrupt_handler(void) {

__HAL_GPIO_EXTI_CLEAR_FLAG(DISPLAY_TE_PIN);

if (drv->update_pending > 0) {
drv->update_pending--;
}

if (!fb_queue_peeked(&drv->ready_frames)) {
int16_t fb_idx = fb_queue_peek(&drv->ready_frames);

Expand Down Expand Up @@ -256,7 +262,9 @@ void display_ensure_refreshed(void) {
// so we can be sure there's not scheduled or pending
// background copying
do {
copy_pending = !fb_queue_empty(&drv->ready_frames);
irq_key_t irq_key = irq_lock();
copy_pending = !fb_queue_empty(&drv->ready_frames) || drv->update_pending;
irq_unlock(irq_key);
__WFI();
} while (copy_pending);

Expand Down
1 change: 1 addition & 0 deletions core/embed/io/display/st-7789/display_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ typedef struct {

// Current display orientation (0, 90, 180, 270)
int orientation_angle;
int update_pending;

} display_driver_t;

Expand Down

0 comments on commit 7c73dd2

Please sign in to comment.