From c35d4c7f57c1547601e320530d3cc989159c9500 Mon Sep 17 00:00:00 2001 From: Aapo Torkkeli <aamato@utu.fi> Date: Tue, 12 Nov 2019 10:25:34 +0200 Subject: [PATCH] fix casting problem of orientation value --- project/imu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/project/imu.c b/project/imu.c index 2c62df2..dccc486 100644 --- a/project/imu.c +++ b/project/imu.c @@ -161,23 +161,23 @@ void calculate_orientation(){ if ( (z_axis_abs > x_axis_abs) && (z_axis_abs > y_axis_abs)) { // base orientation on Z if (z_axis > 0) { - orientation = 0; + orientation = (uint8_t) 0x0; } else { - orientation = 100; + orientation = (uint8_t) 0x1; } } else if ( (y_axis_abs > x_axis_abs) && (y_axis_abs > z_axis_abs)) { // base orientation on Y if (y_axis > 0) { - orientation = 200; + orientation = (uint8_t) 0x2; } else { - orientation = 300; + orientation = (uint8_t) 0x3; } } else { // base orientation on X if (x_axis < 0) { - orientation = 400; + orientation = (uint8_t) 0x4; } else { - orientation = 500; + orientation = (uint8_t) 0x5; } } } -- GitLab