1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-15 02:48:11 +00:00

fix(core): TS5 - wait for frame to appear on display before raising backlight

[no changelog]
This commit is contained in:
tychovrahe 2024-12-11 22:51:13 +01:00
parent e196413bb7
commit 7c73dd228f
2 changed files with 10 additions and 1 deletions

View File

@ -135,6 +135,8 @@ void display_fb_clear(void) {
static void bg_copy_callback(void) { static void bg_copy_callback(void) {
display_driver_t *drv = &g_display_driver; display_driver_t *drv = &g_display_driver;
drv->update_pending = 1;
fb_queue_put(&drv->empty_frames, fb_queue_take(&drv->ready_frames)); fb_queue_put(&drv->empty_frames, fb_queue_take(&drv->ready_frames));
} }
@ -144,6 +146,10 @@ static void display_te_interrupt_handler(void) {
__HAL_GPIO_EXTI_CLEAR_FLAG(DISPLAY_TE_PIN); __HAL_GPIO_EXTI_CLEAR_FLAG(DISPLAY_TE_PIN);
if (drv->update_pending > 0) {
drv->update_pending--;
}
if (!fb_queue_peeked(&drv->ready_frames)) { if (!fb_queue_peeked(&drv->ready_frames)) {
int16_t fb_idx = fb_queue_peek(&drv->ready_frames); int16_t fb_idx = fb_queue_peek(&drv->ready_frames);
@ -256,7 +262,9 @@ void display_ensure_refreshed(void) {
// so we can be sure there's not scheduled or pending // so we can be sure there's not scheduled or pending
// background copying // background copying
do { 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(); __WFI();
} while (copy_pending); } while (copy_pending);

View File

@ -25,6 +25,7 @@ typedef struct {
// Current display orientation (0, 90, 180, 270) // Current display orientation (0, 90, 180, 270)
int orientation_angle; int orientation_angle;
int update_pending;
} display_driver_t; } display_driver_t;