mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 07:13:56 -04:00
AP_RangeFinder: add build option for Rangefinders
This commit is contained in:
parent
e07e22c0fe
commit
8ab92f42cd
@ -339,6 +339,7 @@ bool RangeFinder::_add_backend(AP_RangeFinder_Backend *backend, uint8_t instance
|
||||
*/
|
||||
void RangeFinder::detect_instance(uint8_t instance, uint8_t& serial_instance)
|
||||
{
|
||||
#if AP_RANGEFINDER_ENABLED
|
||||
const Type _type = (Type)params[instance].type.get();
|
||||
switch (_type) {
|
||||
case Type::PLI2C:
|
||||
@ -583,7 +584,7 @@ void RangeFinder::detect_instance(uint8_t instance, uint8_t& serial_instance)
|
||||
case Type::Benewake_CAN:
|
||||
_add_backend(new AP_RangeFinder_Benewake_CAN(state[instance], params[instance]), instance);
|
||||
break;
|
||||
#endif
|
||||
#endif //HAL_MAX_CAN_PROTOCOL_DRIVERS
|
||||
case Type::NONE:
|
||||
default:
|
||||
break;
|
||||
@ -597,6 +598,7 @@ void RangeFinder::detect_instance(uint8_t instance, uint8_t& serial_instance)
|
||||
// param count could have changed
|
||||
AP_Param::invalidate_count();
|
||||
}
|
||||
#endif //AP_RANGEFINDER_ENABLED
|
||||
}
|
||||
|
||||
AP_RangeFinder_Backend *RangeFinder::get_backend(uint8_t id) const {
|
||||
@ -841,3 +843,4 @@ RangeFinder *rangefinder()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,17 @@
|
||||
#include <AP_MSP/msp.h>
|
||||
#include "AP_RangeFinder_Params.h"
|
||||
|
||||
#ifndef AP_RANGEFINDER_ENABLED
|
||||
#define AP_RANGEFINDER_ENABLED 1
|
||||
#endif
|
||||
|
||||
// Maximum number of range finder instances available on this platform
|
||||
#ifndef RANGEFINDER_MAX_INSTANCES
|
||||
#define RANGEFINDER_MAX_INSTANCES 10
|
||||
#ifndef RANGEFINDER_MAX_INSTANCES
|
||||
#if AP_RANGEFINDER_ENABLED
|
||||
#define RANGEFINDER_MAX_INSTANCES 10
|
||||
#else
|
||||
#define RANGEFINDER_MAX_INSTANCES 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define RANGEFINDER_GROUND_CLEARANCE_CM_DEFAULT 10
|
||||
|
Loading…
Reference in New Issue
Block a user