mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 00:43:33 +08:00
DriverFramework purge
The bulk of this change was tightly coupled and needed to be deleted in one pass. Some of the smaller changes were things that broke as a result of the initial purge and subsequently fixed by further eradicating unnecessary platform differences. Finally, I deleted any dead code I came across in the related files I touched while going through everything.
- DriverFramework (src/lib/DriverFramework submodule) completely removed
- added dspal submodule in qurt platform (was brought in via DriverFramework)
- all df wrapper drivers removed
- all boards using df wrapper drivers updated to use in tree equivalents
- unused empty arch/board.h on posix and qurt removed
- unused IOCTLs removed (pub block, priv, etc)
- Integrator delete methods only used from df wrapper drivers
- commander: sensor calibration use "NuttX version" everywhere for now
- sensors: update to px4_{open, read, close} instead of DevMgr wrapper (adc open for analog differential pressure)
- battery_status: update to px4_{open, read, close} instead of DevMgr wrapper (adc open for analog differential pressure)
- cdev cleanup conflicting typedefs and names with actual OS (pollevent_t, etc)
- load_mon and top remove from linux boards (unused)
- delete unused PX4_MAIN_FUNCTION
- delete unused getreg32 macro
- delete unused SIOCDEVPRIVATE define
- named each platform tasks consistently
- posix list_devices and list_topics removed (list_files now shows all virtual files)
This commit is contained in:
@@ -74,8 +74,6 @@ PX4Barometer::update(hrt_abstime timestamp, float pressure)
|
||||
report.timestamp = timestamp;
|
||||
report.pressure = pressure;
|
||||
|
||||
poll_notify(POLLIN);
|
||||
|
||||
_sensor_baro_pub.update();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,10 +53,9 @@ CDev::CDev(const char *name, const char *devname) :
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
CDev::init()
|
||||
int CDev::init()
|
||||
{
|
||||
DEVICE_DEBUG("CDev::init");
|
||||
PX4_DEBUG("CDev::init");
|
||||
|
||||
// base class init first
|
||||
int ret = Device::init();
|
||||
@@ -78,29 +77,12 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
CDev::ioctl(file_t *filep, int cmd, unsigned long arg)
|
||||
int CDev::ioctl(file_t *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
DEVICE_DEBUG("CDev::ioctl");
|
||||
PX4_DEBUG("CDev::ioctl");
|
||||
int ret = -ENOTTY;
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
/* fetch a pointer to the driver's private data */
|
||||
case DIOC_GETPRIV:
|
||||
*(void **)(uintptr_t)arg = (void *)this;
|
||||
ret = PX4_OK;
|
||||
break;
|
||||
|
||||
case DEVIOCSPUBBLOCK:
|
||||
_pub_blocked = (arg != 0);
|
||||
ret = PX4_OK;
|
||||
break;
|
||||
|
||||
case DEVIOCGPUBBLOCK:
|
||||
ret = _pub_blocked;
|
||||
break;
|
||||
|
||||
case DEVIOCGDEVICEID:
|
||||
ret = (int)_device_id.devid;
|
||||
break;
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
/**
|
||||
* Perform an ioctl operation on the device.
|
||||
*
|
||||
* The default implementation handles DIOC_GETPRIV, and otherwise
|
||||
* The default implementation handles DEVIOCGDEVICEID, and otherwise
|
||||
* returns -ENOTTY. Subclasses should call the default implementation
|
||||
* for any command they do not handle themselves.
|
||||
*
|
||||
|
||||
@@ -114,50 +114,6 @@ Integrator::put(const hrt_abstime ×tamp, const matrix::Vector3f &val, matri
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Integrator::put_with_interval(unsigned interval_us, matrix::Vector3f &val, matrix::Vector3f &integral,
|
||||
uint32_t &integral_dt)
|
||||
{
|
||||
if (_last_integration_time == 0) {
|
||||
/* this is the first item in the integrator */
|
||||
hrt_abstime now = hrt_absolute_time();
|
||||
_last_integration_time = now;
|
||||
_last_reset_time = now;
|
||||
_last_val = val;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the timestamp artifically.
|
||||
const hrt_abstime timestamp = _last_integration_time + interval_us;
|
||||
|
||||
return put(timestamp, val, integral, integral_dt);
|
||||
}
|
||||
|
||||
matrix::Vector3f
|
||||
Integrator::get(bool reset, uint32_t &integral_dt)
|
||||
{
|
||||
matrix::Vector3f val = _alpha;
|
||||
|
||||
if (reset) {
|
||||
_reset(integral_dt);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
matrix::Vector3f
|
||||
Integrator::get_and_filtered(bool reset, uint32_t &integral_dt, matrix::Vector3f &filtered_val)
|
||||
{
|
||||
// Do the usual get with reset first but don't return yet.
|
||||
const matrix::Vector3f ret_integral = get(reset, integral_dt);
|
||||
|
||||
// Because we need both the integral and the integral_dt.
|
||||
filtered_val = ret_integral * 1000000 / integral_dt;
|
||||
|
||||
return ret_integral;
|
||||
}
|
||||
|
||||
void
|
||||
Integrator::_reset(uint32_t &integral_dt)
|
||||
{
|
||||
|
||||
@@ -51,12 +51,6 @@ public:
|
||||
Integrator(uint32_t auto_reset_interval = 4000 /* 250 Hz */, bool coning_compensation = false);
|
||||
~Integrator() = default;
|
||||
|
||||
// no copy, assignment, move, move assignment
|
||||
Integrator(const Integrator &) = delete;
|
||||
Integrator &operator=(const Integrator &) = delete;
|
||||
Integrator(Integrator &&) = delete;
|
||||
Integrator &operator=(Integrator &&) = delete;
|
||||
|
||||
/**
|
||||
* Put an item into the integral.
|
||||
*
|
||||
@@ -69,42 +63,6 @@ public:
|
||||
*/
|
||||
bool put(const uint64_t ×tamp, const matrix::Vector3f &val, matrix::Vector3f &integral, uint32_t &integral_dt);
|
||||
|
||||
/**
|
||||
* Put an item into the integral but provide an interval instead of a timestamp.
|
||||
*
|
||||
* @param interval_us Interval in us since last integration.
|
||||
* @param val Item to put.
|
||||
* @param integral Current integral in case the integrator did reset, else the value will not be modified
|
||||
* @param integral_dt Get the dt in us of the current integration (only if reset). Note that this
|
||||
* values might not be accurate vs. hrt_absolute_time because it is just the sum of the
|
||||
* supplied intervals.
|
||||
* @return true if putting the item triggered an integral reset and the integral should be
|
||||
* published.
|
||||
*/
|
||||
bool put_with_interval(unsigned interval_us, matrix::Vector3f &val, matrix::Vector3f &integral, uint32_t &integral_dt);
|
||||
|
||||
/**
|
||||
* Get the current integral and reset the integrator if needed.
|
||||
*
|
||||
* @param reset Reset the integral to zero.
|
||||
* @param integral_dt Get the dt in us of the current integration (only if reset).
|
||||
* @return the integral since the last read-reset
|
||||
*/
|
||||
matrix::Vector3f get(bool reset, uint32_t &integral_dt);
|
||||
|
||||
|
||||
/**
|
||||
* Get the current integral and reset the integrator if needed. Additionally give the
|
||||
* integral over the samples differentiated by the integration time (mean filtered values).
|
||||
*
|
||||
* @param reset Reset the integral to zero.
|
||||
* @param integral_dt Get the dt in us of the current integration (only if reset).
|
||||
* @param filtered_val The integral differentiated by the integration time.
|
||||
* @return the integral since the last read-reset
|
||||
*/
|
||||
matrix::Vector3f get_and_filtered(bool reset, uint32_t &integral_dt, matrix::Vector3f &filtered_val);
|
||||
|
||||
|
||||
/**
|
||||
* Set auto reset interval during runtime. This won't reset the integrator.
|
||||
*
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
|
||||
#include "../CDev.hpp"
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
namespace device __EXPORT
|
||||
{
|
||||
|
||||
|
||||
@@ -131,7 +131,6 @@ PX4Magnetometer::update(hrt_abstime timestamp, int16_t x, int16_t y, int16_t z)
|
||||
report.y = val_calibrated(1);
|
||||
report.z = val_calibrated(2);
|
||||
|
||||
poll_notify(POLLIN);
|
||||
_sensor_mag_pub.update();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user