AP_RangeFinder: create a AP_RANGEFINDER_BACKEND_CAN_ENABLED

avoid cmpilation problems when rangefinder not enabled but CAN is
This commit is contained in:
Peter Barker 2023-11-08 10:56:07 +11:00 committed by Andrew Tridgell
parent c40b1627dd
commit 118f3b41ac
3 changed files with 16 additions and 9 deletions

View File

@ -13,11 +13,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AP_RangeFinder_config.h"
#if AP_RANGEFINDER_BACKEND_CAN_ENABLED
#include <AP_HAL/AP_HAL.h>
#include "AP_RangeFinder_Backend_CAN.h"
#if HAL_MAX_CAN_PROTOCOL_DRIVERS
const AP_Param::GroupInfo AP_RangeFinder_Backend_CAN::var_info[] = {
// @Param: RECV_ID
@ -87,4 +89,4 @@ bool AP_RangeFinder_Backend_CAN::is_correct_id(uint32_t id) const
return true;
}
#endif // HAL_MAX_CAN_PROTOCOL_DRIVERS
#endif // AP_RANGEFINDER_BACKEND_CAN_ENABLED

View File

@ -1,9 +1,10 @@
#pragma once
#include "AP_RangeFinder_config.h"
#if AP_RANGEFINDER_BACKEND_CAN_ENABLED
#include "AP_RangeFinder_Backend.h"
#if HAL_MAX_CAN_PROTOCOL_DRIVERS
#include <AP_CANManager/AP_CANSensor.h>
#include <AP_BoardConfig/AP_BoardConfig.h>
@ -61,4 +62,4 @@ private:
uint32_t _distance_count;
};
#endif // HAL_MAX_CAN_PROTOCOL_DRIVERS
#endif // AP_RANGEFINDER_BACKEND_CAN_ENABLED

View File

@ -15,6 +15,10 @@
#define AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED AP_RANGEFINDER_ENABLED
#endif
#ifndef AP_RANGEFINDER_BACKEND_CAN_ENABLED
#define AP_RANGEFINDER_BACKEND_CAN_ENABLED AP_RANGEFINDER_ENABLED && HAL_MAX_CAN_PROTOCOL_DRIVERS
#endif
#ifndef AP_RANGEFINDER_ANALOG_ENABLED
#define AP_RANGEFINDER_ANALOG_ENABLED AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED
#endif
@ -148,7 +152,7 @@
#endif
#ifndef AP_RANGEFINDER_TOFSENSEP_CAN_ENABLED
#define AP_RANGEFINDER_TOFSENSEP_CAN_ENABLED (HAL_MAX_CAN_PROTOCOL_DRIVERS && AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED)
#define AP_RANGEFINDER_TOFSENSEP_CAN_ENABLED AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED && AP_RANGEFINDER_BACKEND_CAN_ENABLED
#endif
#ifndef AP_RANGEFINDER_TOFSENSEF_I2C_ENABLED
@ -160,7 +164,7 @@
#endif
#ifndef AP_RANGEFINDER_USD1_CAN_ENABLED
#define AP_RANGEFINDER_USD1_CAN_ENABLED (HAL_MAX_CAN_PROTOCOL_DRIVERS && AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED)
#define AP_RANGEFINDER_USD1_CAN_ENABLED AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED && AP_RANGEFINDER_BACKEND_CAN_ENABLED
#endif
#ifndef AP_RANGEFINDER_USD1_SERIAL_ENABLED