fix an overflow in the orientation sensor calculations thanks to @Mathias Agopian

Change-Id: I1a8c621ced62989ec57442b8677cee2a81a9b89c