mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 09:58:28 -04:00
AP_Compass_VRBrain: add support for two compasses
This commit is contained in:
parent
4deafffb3e
commit
1092447360
@ -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…
Reference in New Issue
Block a user