Two small fixes, remove hardcoded height and non-scale issues
This commit is contained in:
parent
7584363f66
commit
f134f86291
|
@ -46,4 +46,4 @@ void common_hal_is31fl3741_send_reset(is31fl3741_IS31FL3741_obj_t *self);
|
|||
void common_hal_is31fl3741_set_current(is31fl3741_IS31FL3741_obj_t *self, uint8_t current);
|
||||
uint8_t common_hal_is31fl3741_get_current(is31fl3741_IS31FL3741_obj_t *self);
|
||||
void common_hal_is31fl3741_set_led(is31fl3741_IS31FL3741_obj_t *self, uint16_t led, uint8_t level, uint8_t page);
|
||||
void common_hal_is31fl3741_draw_pixel(is31fl3741_IS31FL3741_obj_t *self, int16_t x, int16_t y, uint32_t color, uint16_t *mapping);
|
||||
void common_hal_is31fl3741_draw_pixel(is31fl3741_IS31FL3741_obj_t *self, int16_t x, int16_t y, uint32_t color, uint16_t *mapping, uint8_t display_height);
|
||||
|
|
|
@ -141,8 +141,7 @@ void common_hal_is31fl3741_FrameBuffer_refresh(is31fl3741_FrameBuffer_obj_t *sel
|
|||
if (!self->paused) {
|
||||
common_hal_is31fl3741_begin_transaction(self->is31fl3741);
|
||||
|
||||
uint8_t dirty_row_flags = 0xFF; // only supports 8 rows gotta fix
|
||||
|
||||
uint8_t dirty_row_flags = 0xFF;
|
||||
if (self->scale) {
|
||||
// Based on the Arduino IS31FL3741 driver code
|
||||
// dirtyrows flag current not implemented for scaled displays
|
||||
|
@ -173,7 +172,7 @@ void common_hal_is31fl3741_FrameBuffer_refresh(is31fl3741_FrameBuffer_obj_t *sel
|
|||
} else {
|
||||
color = (rsum << 16) + (gsum << 8) + bsum;
|
||||
}
|
||||
common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping);
|
||||
common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->height);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -194,9 +193,11 @@ void common_hal_is31fl3741_FrameBuffer_refresh(is31fl3741_FrameBuffer_obj_t *sel
|
|||
color = *buffer;
|
||||
}
|
||||
|
||||
common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping);
|
||||
common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->height);
|
||||
buffer++;
|
||||
}
|
||||
} else {
|
||||
buffer += self->width; // row did not have to be redrawn, skip it in the buffer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,16 +148,17 @@ void common_hal_is31fl3741_set_led(is31fl3741_IS31FL3741_obj_t *self, uint16_t l
|
|||
common_hal_busio_i2c_write(self->i2c, self->device_address, cmd, 2);
|
||||
}
|
||||
|
||||
void common_hal_is31fl3741_draw_pixel(is31fl3741_IS31FL3741_obj_t *self, int16_t x, int16_t y, uint32_t color, uint16_t *mapping) {
|
||||
void common_hal_is31fl3741_draw_pixel(is31fl3741_IS31FL3741_obj_t *self, int16_t x, int16_t y, uint32_t color, uint16_t *mapping, uint8_t display_height) {
|
||||
uint8_t r = color >> 16 & 0xFF;
|
||||
uint8_t g = color >> 8 & 0xFF;
|
||||
uint8_t b = color & 0xFF;
|
||||
|
||||
int16_t x1 = (x * 5 + y) * 3;
|
||||
int16_t x1 = (x * display_height + y) * 3;
|
||||
uint16_t ridx = mapping[x1 + 2];
|
||||
if (ridx != 65535) {
|
||||
uint16_t gidx = mapping[x1 + 1];
|
||||
uint16_t bidx = mapping[x1 + 0];
|
||||
|
||||
common_hal_is31fl3741_set_led(self, ridx, r, 0);
|
||||
common_hal_is31fl3741_set_led(self, gidx, g, 0);
|
||||
common_hal_is31fl3741_set_led(self, bidx, b, 0);
|
||||
|
|
Loading…
Reference in New Issue