fix 'white' byte for dotstars
This commit is contained in:
parent
5c08182c73
commit
3cf9a475b9
|
@ -119,8 +119,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_a
|
|||
byteorder_details.byteorder.r = r - byteorder;
|
||||
byteorder_details.byteorder.g = g - byteorder;
|
||||
byteorder_details.byteorder.b = b - byteorder;
|
||||
if (w)
|
||||
byteorder_details.byteorder.w = w - byteorder;
|
||||
byteorder_details.byteorder.w = w ? w - byteorder : 0;
|
||||
// The dotstar brightness byte is always first (as it goes with the pixel start bits)
|
||||
// if 'D' is found at the end, adjust byte position
|
||||
// if 'D' is elsewhere, error out
|
||||
|
@ -130,6 +129,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_a
|
|||
byteorder_details.byteorder.b += 1;
|
||||
byteorder_details.byteorder.g += 1;
|
||||
byteorder_details.byteorder.r += 1;
|
||||
byteorder_details.byteorder.w = 0;
|
||||
} else if (dotstar_pos != 0) {
|
||||
mp_raise_ValueError(translate("Invalid byteorder string"));
|
||||
}
|
||||
|
|
|
@ -47,11 +47,11 @@ void pixelbuf_set_pixel(uint8_t *buf, uint8_t *rawbuf, float brightness, mp_obj_
|
|||
if (MP_OBJ_IS_INT(item)) {
|
||||
uint8_t *target = rawbuf ? rawbuf : buf;
|
||||
pixelbuf_set_pixel_int(target, mp_obj_get_int_truncated(item), byteorder);
|
||||
if (dotstar) {
|
||||
if (dotstar) {
|
||||
buf[0] = DOTSTAR_LED_START_FULL_BRIGHT;
|
||||
if (rawbuf)
|
||||
rawbuf[0] = DOTSTAR_LED_START_FULL_BRIGHT;
|
||||
}
|
||||
}
|
||||
if (rawbuf) {
|
||||
buf[byteorder->byteorder.r] = rawbuf[byteorder->byteorder.r] * brightness;
|
||||
buf[byteorder->byteorder.g] = rawbuf[byteorder->byteorder.g] * brightness;
|
||||
|
|
Loading…
Reference in New Issue