mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 16:53:34 +08:00
drivers helper classes remove empty publication (forced advertise)
- this is no longer necessary with all publications outside of ISRs
This commit is contained in:
@@ -50,10 +50,6 @@ PX4Accelerometer::PX4Accelerometer(uint32_t device_id, uint8_t priority, enum Ro
|
||||
// set software low pass filter for controllers
|
||||
updateParams();
|
||||
configure_filter(_param_imu_accel_cutoff.get());
|
||||
|
||||
// force initial publish to allocate uORB buffer
|
||||
// TODO: can be removed once all drivers are in threads
|
||||
_sensor_accel_pub.update();
|
||||
}
|
||||
|
||||
PX4Accelerometer::~PX4Accelerometer()
|
||||
@@ -63,7 +59,8 @@ PX4Accelerometer::~PX4Accelerometer()
|
||||
}
|
||||
}
|
||||
|
||||
int PX4Accelerometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
|
||||
int
|
||||
PX4Accelerometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case ACCELIOCSSCALE: {
|
||||
@@ -85,7 +82,8 @@ int PX4Accelerometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
|
||||
}
|
||||
}
|
||||
|
||||
void PX4Accelerometer::set_device_type(uint8_t devtype)
|
||||
void
|
||||
PX4Accelerometer::set_device_type(uint8_t devtype)
|
||||
{
|
||||
// current DeviceStructure
|
||||
union device::Device::DeviceId device_id;
|
||||
@@ -98,13 +96,15 @@ void PX4Accelerometer::set_device_type(uint8_t devtype)
|
||||
_sensor_accel_pub.get().device_id = device_id.devid;
|
||||
}
|
||||
|
||||
void PX4Accelerometer::set_sample_rate(unsigned rate)
|
||||
void
|
||||
PX4Accelerometer::set_sample_rate(unsigned rate)
|
||||
{
|
||||
_sample_rate = rate;
|
||||
_filter.set_cutoff_frequency(_sample_rate, _filter.get_cutoff_freq());
|
||||
}
|
||||
|
||||
void PX4Accelerometer::update(hrt_abstime timestamp, float x, float y, float z)
|
||||
void
|
||||
PX4Accelerometer::update(hrt_abstime timestamp, float x, float y, float z)
|
||||
{
|
||||
sensor_accel_s &report = _sensor_accel_pub.get();
|
||||
report.timestamp = timestamp;
|
||||
@@ -145,7 +145,8 @@ void PX4Accelerometer::update(hrt_abstime timestamp, float x, float y, float z)
|
||||
}
|
||||
}
|
||||
|
||||
void PX4Accelerometer::print_status()
|
||||
void
|
||||
PX4Accelerometer::print_status()
|
||||
{
|
||||
PX4_INFO(ACCEL_BASE_DEVICE_PATH " device instance: %d", _class_device_instance);
|
||||
PX4_INFO("sample rate: %d Hz", _sample_rate);
|
||||
|
||||
Reference in New Issue
Block a user