Browse Source

SITL: add compilation option AP_SIM_CRSF_ENABLED

gps-1.3.1
Peter Barker 3 years ago committed by Peter Barker
parent
commit
ee341bc4eb
  1. 4
      libraries/AP_HAL_SITL/SITL_State.cpp
  2. 2
      libraries/AP_HAL_SITL/SITL_State.h
  3. 4
      libraries/SITL/SIM_CRSF.cpp
  4. 10
      libraries/SITL/SIM_CRSF.h

4
libraries/AP_HAL_SITL/SITL_State.cpp

@ -323,12 +323,14 @@ SITL::SerialDevice *SITL_State::create_serial_sim(const char *name, const char *
// } // }
// frsky_sport = new SITL::Frsky_SPortPassthrough(); // frsky_sport = new SITL::Frsky_SPortPassthrough();
// return frsky_sportpassthrough; // return frsky_sportpassthrough;
#if AP_SIM_CRSF_ENABLED
} else if (streq(name, "crsf")) { } else if (streq(name, "crsf")) {
if (crsf != nullptr) { if (crsf != nullptr) {
AP_HAL::panic("Only one crsf at a time"); AP_HAL::panic("Only one crsf at a time");
} }
crsf = new SITL::CRSF(); crsf = new SITL::CRSF();
return crsf; return crsf;
#endif
#if HAL_SIM_PS_RPLIDARA2_ENABLED #if HAL_SIM_PS_RPLIDARA2_ENABLED
} else if (streq(name, "rplidara2")) { } else if (streq(name, "rplidara2")) {
if (rplidara2 != nullptr) { if (rplidara2 != nullptr) {
@ -615,9 +617,11 @@ void SITL_State::_fdm_input_local(void)
// frsky_sportpassthrough->update(); // frsky_sportpassthrough->update();
// } // }
#if AP_SIM_CRSF_ENABLED
if (crsf != nullptr) { if (crsf != nullptr) {
crsf->update(); crsf->update();
} }
#endif
#if HAL_SIM_PS_RPLIDARA2_ENABLED #if HAL_SIM_PS_RPLIDARA2_ENABLED
if (rplidara2 != nullptr) { if (rplidara2 != nullptr) {

2
libraries/AP_HAL_SITL/SITL_State.h

@ -262,8 +262,10 @@ private:
SITL::PS_TeraRangerTower *terarangertower; SITL::PS_TeraRangerTower *terarangertower;
#endif #endif
#if AP_SIM_CRSF_ENABLED
// simulated CRSF devices // simulated CRSF devices
SITL::CRSF *crsf; SITL::CRSF *crsf;
#endif
// simulated VectorNav system: // simulated VectorNav system:
SITL::VectorNav *vectornav; SITL::VectorNav *vectornav;

4
libraries/SITL/SIM_CRSF.cpp

@ -18,6 +18,8 @@
#include "SIM_CRSF.h" #include "SIM_CRSF.h"
#if AP_SIM_CRSF_ENABLED
using namespace SITL; using namespace SITL;
extern const AP_HAL::HAL& hal; extern const AP_HAL::HAL& hal;
@ -80,3 +82,5 @@ void CRSF::update()
return; return;
} }
} }
#endif // AP_SIM_CRSF_ENABLED

10
libraries/SITL/SIM_CRSF.h

@ -27,6 +27,14 @@ rc 3 1600
#pragma once #pragma once
#include <AP_HAL/AP_HAL_Boards.h>
#ifndef AP_SIM_CRSF_ENABLED
#define AP_SIM_CRSF_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif
#if AP_SIM_CRSF_ENABLED
#include "SIM_Aircraft.h" #include "SIM_Aircraft.h"
#include <SITL/SITL.h> #include <SITL/SITL.h>
#include "SIM_SerialDevice.h" #include "SIM_SerialDevice.h"
@ -58,3 +66,5 @@ protected:
}; };
} }
#endif // AP_SIM_CRSF_ENABLED

Loading…
Cancel
Save