Browse Source

AP_RPM: add explicit RPM_TYPE_SITL

Old behaviour is that anything that wasn't claimed (or failed to
allocate) would become a SITL RPM sensor.  This meant we always had at
least one RPM sensor which was allocated but never provided valid data.

New behaviour is that if you want a SITL RPM sensor you have to set type
to 10.
zr-v5.1
Peter Barker 4 years ago committed by Peter Barker
parent
commit
370db00096
  1. 2
      libraries/AP_RPM/AP_RPM.cpp
  2. 5
      libraries/AP_RPM/AP_RPM.h

2
libraries/AP_RPM/AP_RPM.cpp

@ -132,7 +132,7 @@ void AP_RPM::init(void) @@ -132,7 +132,7 @@ void AP_RPM::init(void)
drivers[i] = new AP_RPM_HarmonicNotch(*this, i, state[i]);
}
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
if (drivers[i] == nullptr) {
if (type == RPM_TYPE_SITL) {
drivers[i] = new AP_RPM_SITL(*this, i, state[i]);
}
#endif

5
libraries/AP_RPM/AP_RPM.h

@ -41,7 +41,10 @@ public: @@ -41,7 +41,10 @@ public:
RPM_TYPE_PWM = 1,
RPM_TYPE_PIN = 2,
RPM_TYPE_EFI = 3,
RPM_TYPE_HNTCH = 4
RPM_TYPE_HNTCH = 4,
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
RPM_TYPE_SITL = 10,
#endif
};
// The RPM_State structure is filled in by the backend driver

Loading…
Cancel
Save