2015/08/14
Dependencies: VNH5019
Fork of cansat by
Revision 8:bc3365988ee1, committed 2015-08-12
- Comitter:
- s1200058
- Date:
- Wed Aug 12 12:10:26 2015 +0000
- Parent:
- 7:b24799407d03
- Child:
- 9:ea6a71ec9f9d
- Commit message:
- change fanction about angle
Changed in this revision
cansat.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/cansat.cpp Tue Aug 11 01:15:26 2015 +0000 +++ b/cansat.cpp Wed Aug 12 12:10:26 2015 +0000 @@ -111,10 +111,18 @@ CanSat::gyro_z = z; } void CanSat::set_compass(int16_t x, int16_t y, int16_t z, double angle){ - CanSat::compass_x = x; - CanSat::compass_y = y; - CanSat::compass_z = z; - CanSat::compass_angle = angle; + double setAngle; + CanSat::compass_x = x; + CanSat::compass_y = y; + CanSat::compass_z = z; + + setAngle = angle-90; + if(setAngle < 0){ + setAngle = setAngle + 360; + } + setAngle = 360 - setAngle; + + CanSat::compass_angle = setAngle; } void CanSat::set_pressure(double p){ CanSat::pressure = p;