Browse Source

AP_Compass_VRBrain: add support for two compasses

mission-4.1.18
Emile Castelnuovo 11 years ago committed by Randy Mackay
parent
commit
1092447360
  1. 16
      libraries/AP_Compass/AP_Compass_VRBRAIN.cpp

16
libraries/AP_Compass/AP_Compass_VRBRAIN.cpp

@ -44,18 +44,18 @@ extern const AP_HAL::HAL& hal; @@ -44,18 +44,18 @@ extern const AP_HAL::HAL& hal;
bool AP_Compass_VRBRAIN::init(void)
{
_mag_fd[0] = open(MAG_DEVICE_PATH, O_RDONLY);
if (_mag_fd[0] < 0) {
_mag_fd[1] = open(MAG_DEVICE_PATH "1", O_RDONLY);
_num_instances = 0;
for (uint8_t i=0; i<COMPASS_MAX_INSTANCES; i++) {
if (_mag_fd[i] >= 0) {
_num_instances = i+1;
}
}
if (_num_instances == 0) {
hal.console->printf("Unable to open " MAG_DEVICE_PATH "\n");
return false;
}
_mag_fd[1] = open(MAG_DEVICE_PATH "1", O_RDONLY);
if (_mag_fd[1] >= 0) {
_num_instances = 2;
} else {
_num_instances = 1;
}
for (uint8_t i=0; i<_num_instances; i++) {
#ifdef DEVIOCGDEVICEID
// get device id

Loading…
Cancel
Save