Browse Source

Rover: always specify rangefinder instance

master
Randy Mackay 8 years ago
parent
commit
f29fe8bb88
  1. 2
      APMrover2/Rover.h
  2. 4
      APMrover2/sensors.cpp
  3. 2
      APMrover2/test.cpp

2
APMrover2/Rover.h

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

4
APMrover2/sensors.cpp

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

2
APMrover2/test.cpp

@ -365,7 +365,7 @@ int8_t Rover::test_sonar(uint8_t argc, const Menu::arg *argv)
delay(20); delay(20);
sonar.update(); 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"); cliSerial->printf("WARNING: Sonar is not enabled\n");
} }

Loading…
Cancel
Save