Skip to content

Commit 15b24ba

Browse files
committed
Hopefully fixes RGB driver sync issues.
It just dawned on me how to get the synchronization between the buffers without having to add a stall into the code.
1 parent 50327e5 commit 15b24ba

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

ext_mod/lcd_bus/esp32_include/rgb_bus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
mp_obj_array_t *view1;
4040
mp_obj_array_t *view2;
4141

42-
void *transmitting_buf;
42+
void *last_buf;
4343

4444
} mp_lcd_rgb_bus_obj_t;
4545

ext_mod/lcd_bus/esp32_src/rgb_bus.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,15 @@
5656
rgb_panel_t *rgb_panel = __containerof(panel, rgb_panel_t, base);
5757
mp_lcd_rgb_bus_obj_t *self = (mp_lcd_rgb_bus_obj_t *)user_ctx;
5858

59-
if (!self->trans_done && rgb_panel->fbs[rgb_panel->cur_fb_index] == self->transmitting_buf) {
60-
if (self->callback != mp_const_none && mp_obj_is_callable(self->callback)) {
61-
cb_isr(self->callback);
62-
}
63-
self->trans_done = true;
59+
void *curr_buf = rgb_panel->fbs[rgb_panel->cur_fb_index]
60+
61+
if (self->view2 != NULL && self->last_buf != curr_buf) {
62+
self->last_buf = curr_buf;
63+
self->trans_done = true;
64+
65+
if (self->callback != mp_const_none) cb_isr(self->callback);
66+
} else if (self->view2 == NULL) {
67+
self->trans_done = true;
6468
}
6569

6670
return false;
@@ -534,7 +538,6 @@
534538
mp_lcd_rgb_bus_obj_t *self = (mp_lcd_rgb_bus_obj_t *)obj;
535539

536540
self->trans_done = false;
537-
self->transmitting_buf = color;
538541

539542
esp_err_t ret = esp_lcd_panel_draw_bitmap(
540543
self->panel_handle,
@@ -550,7 +553,7 @@
550553
return LCD_OK;
551554
}
552555

553-
if (self->callback == mp_const_none || !self->panel_io_config.flags.double_fb) {
556+
if (self->callback == mp_const_none || self->view2 == NULL) {
554557
while (!self->trans_done) {}
555558
self->trans_done = false;
556559
}

0 commit comments

Comments
 (0)