Browse Source

AP_AHRS: pass vector by const reference

master
Pierre Kancir 6 years ago committed by Randy Mackay
parent
commit
d87853d93e
  1. 6
      libraries/AP_AHRS/AP_AHRS.cpp
  2. 2
      libraries/AP_AHRS/AP_AHRS.h

6
libraries/AP_AHRS/AP_AHRS.cpp

@ -187,7 +187,7 @@ bool AP_AHRS::airspeed_estimate(float *airspeed_ret) const @@ -187,7 +187,7 @@ bool AP_AHRS::airspeed_estimate(float *airspeed_ret) const
}
// set_trim
void AP_AHRS::set_trim(Vector3f new_trim)
void AP_AHRS::set_trim(const Vector3f &new_trim)
{
Vector3f trim;
trim.x = constrain_float(new_trim.x, ToRad(-AP_AHRS_TRIM_LIMIT), ToRad(AP_AHRS_TRIM_LIMIT));
@ -216,7 +216,7 @@ void AP_AHRS::add_trim(float roll_in_radians, float pitch_in_radians, bool save_ @@ -216,7 +216,7 @@ void AP_AHRS::add_trim(float roll_in_radians, float pitch_in_radians, bool save_
// Set the board mounting orientation, may be called while disarmed
void AP_AHRS::set_orientation()
{
enum Rotation orientation = (enum Rotation)_board_orientation.get();
const enum Rotation orientation = (enum Rotation)_board_orientation.get();
if (orientation != ROTATION_CUSTOM) {
AP::ins().set_board_orientation(orientation);
if (_compass != nullptr) {
@ -289,7 +289,7 @@ Vector2f AP_AHRS::groundspeed_vector(void) @@ -289,7 +289,7 @@ Vector2f AP_AHRS::groundspeed_vector(void)
Vector2f ret(cosf(yaw), sinf(yaw));
ret *= airspeed;
// adjust for estimated wind
Vector3f wind = wind_estimate();
const Vector3f wind = wind_estimate();
ret.x += wind.x;
ret.y += wind.y;
return ret;

2
libraries/AP_AHRS/AP_AHRS.h

@ -391,7 +391,7 @@ public: @@ -391,7 +391,7 @@ public:
}
// set trim
virtual void set_trim(Vector3f new_trim);
virtual void set_trim(const Vector3f &new_trim);
// add_trim - adjust the roll and pitch trim up to a total of 10 degrees
virtual void add_trim(float roll_in_radians, float pitch_in_radians, bool save_to_eeprom = true);

Loading…
Cancel
Save