Skip to content

Commit 283c72a

Browse files
committed
fix/m5: fix imu return wrong value
Signed-off-by: lbuque <[email protected]>
1 parent de83dc1 commit 283c72a

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

m5stack/components/M5Unified/mpy_m5imu.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,29 @@ namespace m5
1414
mp_obj_t imu_getAccel(mp_obj_t self) {
1515
float x = 0.0f,y = 0.0f,z = 0.0f;
1616
getImu(self)->getAccel(&x, &y, &z);
17-
mp_obj_t tuple[3] = { mp_obj_new_float(x)
18-
, mp_obj_new_float(y)
19-
, mp_obj_new_float(x)};
17+
mp_obj_t tuple[3] = {
18+
mp_obj_new_float(x),
19+
mp_obj_new_float(y),
20+
mp_obj_new_float(z),
21+
};
2022
return mp_obj_new_tuple(3, tuple);
2123
}
24+
2225
mp_obj_t imu_getGyro(mp_obj_t self) {
2326
float x = 0.0f,y = 0.0f,z = 0.0f;
2427
getImu(self)->getGyro(&x, &y, &z);
25-
mp_obj_t tuple[3] = { mp_obj_new_float(x)
26-
, mp_obj_new_float(y)
27-
, mp_obj_new_float(x)};
28+
mp_obj_t tuple[3] = {
29+
mp_obj_new_float(x),
30+
mp_obj_new_float(y),
31+
mp_obj_new_float(z),
32+
};
2833
return mp_obj_new_tuple(3, tuple);
2934
}
35+
3036
mp_obj_t imu_getType(mp_obj_t self) {
3137
return mp_obj_new_int(getImu(self)->getType());
3238
}
39+
3340
mp_obj_t imu_isEnabled(mp_obj_t self) {
3441
return mp_obj_new_bool(getImu(self)->isEnabled());
3542
}

0 commit comments

Comments
 (0)