Browse Source

AP_Compass: setup HIL/SITL for two compasses

master
Andrew Tridgell 10 years ago
parent
commit
2475ee9630
  1. 2
      libraries/AP_Compass/AP_Compass_HIL.cpp
  2. 8
      libraries/AP_Compass/AP_Compass_HIL.h

2
libraries/AP_Compass/AP_Compass_HIL.cpp

@ -51,7 +51,7 @@ bool @@ -51,7 +51,7 @@ bool
AP_Compass_HIL::init(void)
{
// register two compass instances
for (uint8_t i=0; i<COMPASS_MAX_INSTANCES; i++) {
for (uint8_t i=0; i<HIL_NUM_COMPASSES; i++) {
_compass_instance[i] = register_compass();
}
return true;

8
libraries/AP_Compass/AP_Compass_HIL.h

@ -4,6 +4,12 @@ @@ -4,6 +4,12 @@
#include "Compass.h"
#if COMPASS_MAX_INSTANCES == 1
# define HIL_NUM_COMPASSES 1
#else
# define HIL_NUM_COMPASSES 2
#endif
class AP_Compass_HIL : public AP_Compass_Backend
{
public:
@ -15,7 +21,7 @@ public: @@ -15,7 +21,7 @@ public:
static AP_Compass_Backend *detect(Compass &compass);
private:
uint8_t _compass_instance[COMPASS_MAX_INSTANCES];
uint8_t _compass_instance[HIL_NUM_COMPASSES];
};
#endif

Loading…
Cancel
Save