@@ -114,7 +114,7 @@ void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_fr
114114
115115 esp_lcd_rgb_panel_config_t * cfg = & self -> panel_config ;
116116 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
118118 cfg -> timings .v_res = height ;
119119 cfg -> timings .hsync_pulse_width = hsync_pulse_width ;
120120 cfg -> timings .hsync_back_porch = hsync_back_porch ;
@@ -174,9 +174,10 @@ void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_fr
174174 cp_check_esp_error (esp_lcd_rgb_panel_get_frame_buffer (self -> panel_handle , 1 , & fb ));
175175
176176 self -> frequency = frequency ;
177- self -> row_stride = 2 * (width + overscan_left );
177+ self -> width = width ;
178+ self -> row_stride = 2 * (cfg -> timings .h_res );
178179 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 );
180181 self -> bufinfo .buf = (uint8_t * )fb ;
181182 self -> bufinfo .len = 2 * (cfg -> timings .h_res * cfg -> timings .v_res );
182183 self -> bufinfo .typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW ;
@@ -203,7 +204,7 @@ bool common_hal_dotclockframebuffer_framebuffer_deinitialized(dotclockframebuffe
203204
204205
205206mp_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 ;
207208}
208209
209210mp_int_t common_hal_dotclockframebuffer_framebuffer_get_height (dotclockframebuffer_framebuffer_obj_t * self ) {
0 commit comments