mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 07:13:56 -04:00
AP_RangeFinder: enable SITL rangefinder for sim-on-hardware
This commit is contained in:
parent
73190d075a
commit
51246fda45
@ -565,7 +565,7 @@ void RangeFinder::detect_instance(uint8_t instance, uint8_t& serial_instance)
|
||||
break;
|
||||
|
||||
case Type::SIM:
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||
#if AP_SIM_RANGEFINDER_ENABLED
|
||||
_add_backend(new AP_RangeFinder_SITL(state[instance], params[instance], instance), instance);
|
||||
#endif
|
||||
break;
|
||||
|
@ -12,12 +12,13 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <AP_HAL/AP_HAL.h>
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||
|
||||
#include "AP_RangeFinder_SITL.h"
|
||||
|
||||
#if AP_SIM_RANGEFINDER_ENABLED
|
||||
|
||||
#include <AP_HAL/AP_HAL.h>
|
||||
|
||||
extern const AP_HAL::HAL& hal;
|
||||
|
||||
/*
|
||||
@ -49,4 +50,5 @@ void AP_RangeFinder_SITL::update(void)
|
||||
update_status();
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // AP_SIM_RANGEFINDER_ENABLED
|
||||
|
||||
|
@ -14,9 +14,15 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "AP_RangeFinder_Backend.h"
|
||||
#include <AP_BoardConfig/AP_BoardConfig.h>
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||
#ifndef AP_SIM_RANGEFINDER_ENABLED
|
||||
#define AP_SIM_RANGEFINDER_ENABLED (AP_SIM_ENABLED && !defined(HAL_BUILD_AP_PERIPH))
|
||||
#endif
|
||||
|
||||
#if AP_SIM_RANGEFINDER_ENABLED
|
||||
|
||||
#include "AP_RangeFinder_Backend.h"
|
||||
|
||||
#include <SITL/SITL.h>
|
||||
|
||||
@ -41,4 +47,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // AP_SIM_RANGEFINDER_ENABLED
|
||||
|
Loading…
Reference in New Issue
Block a user