From 6b260a45e07ed05eb59e53a0c70f9e1b0fc90eb4 Mon Sep 17 00:00:00 2001 From: Christian Schlack Date: Wed, 12 Jan 2022 22:27:06 +0100 Subject: [PATCH] pybricks.hubs.MoveHub: Increase resolution for imu.acceleration. https://github.com/pybricks/pybricks-api/issues/94 --- CHANGELOG.md | 3 ++- pybricks/hubs/pb_type_movehub.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca1d8a901..a40b3bfaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,12 +27,13 @@ - Disabled `Motor.control` and `Motor.log` on Move Hub to save space. - Changed LED color calibration on Prime hub to make yellow less green. - Updated to upstream MicroPython v1.18. +- Changed MoveHub.imu.acceleration() units to mm/s/s ([pybricks-micropython#88]). ### Fixed - Fixed color calibration on Powered Up remote control ([support#424]). - Fixed 3x3 Light Matrix colors with hue > 255 not working correctly ([support#619]). - +[pybricks-micropython#88]: https://github.com/pybricks/pybricks-micropython/issues/49 [support#424]: https://github.com/pybricks/support/issues/424 [support#619]: https://github.com/pybricks/support/issues/619 diff --git a/pybricks/hubs/pb_type_movehub.c b/pybricks/hubs/pb_type_movehub.c index e740da3f4..84c769ca9 100644 --- a/pybricks/hubs/pb_type_movehub.c +++ b/pybricks/hubs/pb_type_movehub.c @@ -185,7 +185,7 @@ STATIC mp_obj_t hubs_MoveHub_IMU_acceleration(mp_obj_t self_in) { // Convert to appropriate units and return as tuple mp_obj_t values[3]; for (uint8_t i = 0; i < 3; i++) { - values[i] = MP_OBJ_NEW_SMALL_INT((data[i] * 10) >> 6); + values[i] = MP_OBJ_NEW_SMALL_INT((data[i] * 158)); } return mp_obj_new_tuple(3, values); }