Rover: always specify rangefinder instance

This commit is contained in:
Randy Mackay 2017-02-09 20:48:39 +09:00
parent 87df06c45f
commit f29fe8bb88
3 changed files with 4 additions and 4 deletions

View File

@ -142,7 +142,7 @@ private:
AP_Baro barometer;
Compass compass;
AP_InertialSensor ins;
RangeFinder sonar { serial_manager };
RangeFinder sonar { serial_manager, ROTATION_NONE };
AP_Button button;
// flight modes convenience array

View File

@ -56,7 +56,7 @@ void Rover::read_sonars(void)
{
sonar.update();
if (sonar.status() == RangeFinder::RangeFinder_NotConnected) {
if (sonar.status(0) == RangeFinder::RangeFinder_NotConnected) {
// this makes it possible to disable sonar at runtime
return;
}
@ -214,7 +214,7 @@ void Rover::update_sensor_status_flags(void)
if (g.sonar_trigger_cm > 0) {
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
}
if (sonar.has_data()) {
if (sonar.has_data(0)) {
control_sensors_health |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
}
}

View File

@ -365,7 +365,7 @@ int8_t Rover::test_sonar(uint8_t argc, const Menu::arg *argv)
delay(20);
sonar.update();
if (sonar.status() == RangeFinder::RangeFinder_NotConnected) {
if (sonar.status(0) == RangeFinder::RangeFinder_NotConnected && sonar.status(1) == RangeFinder::RangeFinder_NotConnected) {
cliSerial->printf("WARNING: Sonar is not enabled\n");
}