diff --git a/CHANGELOG.md b/CHANGELOG.md index afe0ba8f6..96c6f987a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,10 +25,11 @@ pre-release ([pybricks-micropython#425]). - Fixed internal rounding error that could could cause a Drive Base to be 1 mm off after driving 3 meters, depending on configuration parameters ([support#2500]). - +- Fixed Powered Up remote light getting the wrong color ([support#2497]). [support#1962]: https://github.com/pybricks/support/issues/1962 [support#2468]: https://github.com/pybricks/support/issues/2468 +[support#2497]: https://github.com/pybricks/support/issues/2497 [support#2500]: https://github.com/pybricks/support/issues/2500 [pybricks-micropython#405]: https://github.com/pybricks/pybricks-micropython/pull/405 [pybricks-micropython#421]: https://github.com/pybricks/pybricks-micropython/pull/421 diff --git a/pybricks/iodevices/pb_type_iodevices_lwp3device.c b/pybricks/iodevices/pb_type_iodevices_lwp3device.c index 929c73290..868dbf8a2 100644 --- a/pybricks/iodevices/pb_type_iodevices_lwp3device.c +++ b/pybricks/iodevices/pb_type_iodevices_lwp3device.c @@ -241,12 +241,15 @@ static pbio_error_t pb_type_pupdevices_Remote_write_light_msg(mp_obj_t self_in, .cmd = LWP3_OUTPUT_CMD_WRITE_DIRECT_MODE_DATA, .mode = STATUS_LIGHT_MODE_RGB_0, }; - pbio_color_hsv_to_rgb(hsv, (pbio_color_rgb_t *)msg.payload); + + pbio_color_rgb_t rgb; + pbio_color_hsv_to_rgb(hsv, &rgb); // The red LED on the handset is weak, so we have to reduce green and blue // to get the colors right. - msg.payload[1] = msg.payload[1] * 3 / 8; - msg.payload[2] = msg.payload[2] * 3 / 8; + msg.payload[0] = rgb.r; + msg.payload[1] = rgb.g * 3 / 8; + msg.payload[2] = rgb.b * 3 / 8; return pbdrv_bluetooth_peripheral_write_characteristic(pb_lwp3device_char.handle, (const uint8_t *)&msg, sizeof(msg)); }