From aaaa5247e33e1e9a65c5695ae2c20f648caf2ee7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 3 Jun 2013 16:52:28 +1000 Subject: [PATCH] AP_AHRS: make it possible to setup board orientation at runtime --- libraries/AP_AHRS/AP_AHRS.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libraries/AP_AHRS/AP_AHRS.h b/libraries/AP_AHRS/AP_AHRS.h index cbbf6a5c9f..5ad7a2a34a 100644 --- a/libraries/AP_AHRS/AP_AHRS.h +++ b/libraries/AP_AHRS/AP_AHRS.h @@ -46,7 +46,7 @@ public: // init sets up INS board orientation virtual void init() { - _ins->set_board_orientation((enum Rotation)_board_orientation.get()); + set_orientation(); }; // Accessors @@ -60,10 +60,19 @@ public: void set_compass(Compass *compass) { _compass = compass; + set_orientation(); + } + + + // allow for runtime change of orientation + // this makes initial config easier + void set_orientation() { + _ins->set_board_orientation((enum Rotation)_board_orientation.get()); if (_compass != NULL) { _compass->set_board_orientation((enum Rotation)_board_orientation.get()); } } + void set_airspeed(AP_Airspeed *airspeed) { _airspeed = airspeed; }