Skip to content
Snippets Groups Projects
Commit c35d4c7f authored by Aapo Torkkeli's avatar Aapo Torkkeli
Browse files

fix casting problem of orientation value

parent 373201e4
No related branches found
No related tags found
No related merge requests found
...@@ -161,23 +161,23 @@ void calculate_orientation(){ ...@@ -161,23 +161,23 @@ void calculate_orientation(){
if ( (z_axis_abs > x_axis_abs) && (z_axis_abs > y_axis_abs)) { if ( (z_axis_abs > x_axis_abs) && (z_axis_abs > y_axis_abs)) {
// base orientation on Z // base orientation on Z
if (z_axis > 0) { if (z_axis > 0) {
orientation = 0; orientation = (uint8_t) 0x0;
} else { } else {
orientation = 100; orientation = (uint8_t) 0x1;
} }
} else if ( (y_axis_abs > x_axis_abs) && (y_axis_abs > z_axis_abs)) { } else if ( (y_axis_abs > x_axis_abs) && (y_axis_abs > z_axis_abs)) {
// base orientation on Y // base orientation on Y
if (y_axis > 0) { if (y_axis > 0) {
orientation = 200; orientation = (uint8_t) 0x2;
} else { } else {
orientation = 300; orientation = (uint8_t) 0x3;
} }
} else { } else {
// base orientation on X // base orientation on X
if (x_axis < 0) { if (x_axis < 0) {
orientation = 400; orientation = (uint8_t) 0x4;
} else { } else {
orientation = 500; orientation = (uint8_t) 0x5;
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment