mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 04:33: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:
@@ -45,10 +45,6 @@ PX4Magnetometer::PX4Magnetometer(uint32_t device_id, uint8_t priority, enum Rota
|
||||
|
||||
_sensor_mag_pub.get().device_id = device_id;
|
||||
_sensor_mag_pub.get().scaling = 1.0f;
|
||||
|
||||
// force initial publish to allocate uORB buffer
|
||||
// TODO: can be removed once all drivers are in threads
|
||||
_sensor_mag_pub.update();
|
||||
}
|
||||
|
||||
PX4Magnetometer::~PX4Magnetometer()
|
||||
@@ -58,7 +54,8 @@ PX4Magnetometer::~PX4Magnetometer()
|
||||
}
|
||||
}
|
||||
|
||||
int PX4Magnetometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
|
||||
int
|
||||
PX4Magnetometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case MAGIOCSSCALE: {
|
||||
@@ -94,7 +91,8 @@ int PX4Magnetometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
|
||||
}
|
||||
}
|
||||
|
||||
void PX4Magnetometer::set_device_type(uint8_t devtype)
|
||||
void
|
||||
PX4Magnetometer::set_device_type(uint8_t devtype)
|
||||
{
|
||||
// current DeviceStructure
|
||||
union device::Device::DeviceId device_id;
|
||||
@@ -107,7 +105,8 @@ void PX4Magnetometer::set_device_type(uint8_t devtype)
|
||||
_sensor_mag_pub.get().device_id = device_id.devid;
|
||||
}
|
||||
|
||||
void PX4Magnetometer::update(hrt_abstime timestamp, int16_t x, int16_t y, int16_t z)
|
||||
void
|
||||
PX4Magnetometer::update(hrt_abstime timestamp, int16_t x, int16_t y, int16_t z)
|
||||
{
|
||||
sensor_mag_s &report = _sensor_mag_pub.get();
|
||||
report.timestamp = timestamp;
|
||||
@@ -136,7 +135,8 @@ void PX4Magnetometer::update(hrt_abstime timestamp, int16_t x, int16_t y, int16_
|
||||
_sensor_mag_pub.update();
|
||||
}
|
||||
|
||||
void PX4Magnetometer::print_status()
|
||||
void
|
||||
PX4Magnetometer::print_status()
|
||||
{
|
||||
PX4_INFO(MAG_BASE_DEVICE_PATH " device instance: %d", _class_device_instance);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user