@@ -114,7 +114,7 @@ void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_fr
114
114
115
115
esp_lcd_rgb_panel_config_t * cfg = & self -> panel_config ;
116
116
cfg -> timings .pclk_hz = frequency ;
117
- cfg -> timings .h_res = width + overscan_left ;
117
+ cfg -> timings .h_res = ( width + overscan_left + 15 ) / 16 * 16 ; // round up to multiple of 16
118
118
cfg -> timings .v_res = height ;
119
119
cfg -> timings .hsync_pulse_width = hsync_pulse_width ;
120
120
cfg -> timings .hsync_back_porch = hsync_back_porch ;
@@ -174,9 +174,10 @@ void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_fr
174
174
cp_check_esp_error (esp_lcd_rgb_panel_get_frame_buffer (self -> panel_handle , 1 , & fb ));
175
175
176
176
self -> frequency = frequency ;
177
- self -> row_stride = 2 * (width + overscan_left );
177
+ self -> width = width ;
178
+ self -> row_stride = 2 * (cfg -> timings .h_res );
178
179
self -> first_pixel_offset = 2 * overscan_left ;
179
- self -> refresh_rate = frequency / (width + hsync_front_porch + hsync_back_porch ) / (height + vsync_front_porch + vsync_back_porch );
180
+ self -> refresh_rate = frequency / (cfg -> timings . h_res + hsync_front_porch + hsync_back_porch ) / (height + vsync_front_porch + vsync_back_porch );
180
181
self -> bufinfo .buf = (uint8_t * )fb ;
181
182
self -> bufinfo .len = 2 * (cfg -> timings .h_res * cfg -> timings .v_res );
182
183
self -> bufinfo .typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW ;
@@ -203,7 +204,7 @@ bool common_hal_dotclockframebuffer_framebuffer_deinitialized(dotclockframebuffe
203
204
204
205
205
206
mp_int_t common_hal_dotclockframebuffer_framebuffer_get_width (dotclockframebuffer_framebuffer_obj_t * self ) {
206
- return self -> panel_config . timings . h_res - self -> first_pixel_offset / 2 ;
207
+ return self -> width ;
207
208
}
208
209
209
210
mp_int_t common_hal_dotclockframebuffer_framebuffer_get_height (dotclockframebuffer_framebuffer_obj_t * self ) {
0 commit comments