Fix set_window() boundaries

pull/7/head
Ivan Belokobylskiy 2019-12-27 14:51:32 +03:00
rodzic 81132e0d1b
commit 73530516df
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -92,10 +92,10 @@ STATIC void write_cmd(st7789_ST7789_obj_t *self, uint8_t cmd, const uint8_t *dat
}
STATIC void set_window(st7789_ST7789_obj_t *self, uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) {
if (x0 > x1 || x1 > self->width) {
if (x0 > x1 || x1 >= self->width) {
return;
}
if (y0 > y1 || y1 > self->height) {
if (y0 > y1 || y1 >= self->height) {
return;
}
uint8_t bufx[4] = {x0 >> 8, x0 & 0xFF, x1 >> 8, x1 & 0xFF};
@ -260,7 +260,7 @@ STATIC mp_obj_t st7789_ST7789_fill(mp_obj_t self_in, mp_obj_t _color) {
st7789_ST7789_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t color = mp_obj_get_int(_color);
set_window(self, 0, 0, self->width, self->height);
set_window(self, 0, 0, self->width - 1, self->height - 1);
DC_HIGH();
CS_LOW();
fill_color_buffer(self->spi_obj, color, self->width * self->height);