From 60273d6bb68a0b5a0729e3f7768984aa3fd64b28 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Mon, 21 Oct 2024 14:46:52 +0200 Subject: [PATCH] pybricks.common.IMU: Fix failing to raise on bad axes. --- CHANGELOG.md | 1 + pybricks/common/pb_type_imu.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dd34cf8b..47d64790e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ ### Fixed - Fixed `DriveBase.angle()` getting an incorrectly rounded gyro value, which could cause `turn(360)` to be off by a degree ([support#1844]). +- Fixed `hub` silently ignoring non-orthogonal base axis when it should raise. [support#943]: https://github.com/pybricks/support/issues/943 [support#1886]: https://github.com/pybricks/support/issues/1886 diff --git a/pybricks/common/pb_type_imu.c b/pybricks/common/pb_type_imu.c index a42c3c0b8..4b06aa12d 100644 --- a/pybricks/common/pb_type_imu.c +++ b/pybricks/common/pb_type_imu.c @@ -331,7 +331,7 @@ mp_obj_t pb_type_IMU_obj_new(mp_obj_t hub_in, mp_obj_t top_side_axis_in, mp_obj_ pbio_geometry_xyz_t top_side_axis; pb_type_imu_extract_axis(top_side_axis_in, &top_side_axis); - pbio_imu_set_base_orientation(&front_side_axis, &top_side_axis); + pb_assert(pbio_imu_set_base_orientation(&front_side_axis, &top_side_axis)); // Return singleton instance. singleton_imu_obj.hub = hub_in;