delete gyro_report (alias for sensor_gyro_s)

This commit is contained in:
Daniel Agar
2018-11-06 07:43:43 +08:00
committed by Lorenz Meier
parent 42f9aa6e43
commit acc24da0c2
25 changed files with 79 additions and 80 deletions
+3 -3
View File
@@ -71,7 +71,7 @@ typedef struct {
int gyro_sensor_sub[max_gyros];
int sensor_correction_sub;
struct gyro_calibration_s gyro_scale[max_gyros];
struct gyro_report gyro_report_0;
sensor_gyro_s gyro_report_0;
} gyro_worker_data_t;
static calibrate_return gyro_calibration_worker(int cancel_sub, void* data)
@@ -79,7 +79,7 @@ static calibrate_return gyro_calibration_worker(int cancel_sub, void* data)
gyro_worker_data_t* worker_data = (gyro_worker_data_t*)(data);
unsigned calibration_counter[max_gyros] = { 0 }, slow_count = 0;
const unsigned calibration_count = 5000;
struct gyro_report gyro_report;
sensor_gyro_s gyro_report;
unsigned poll_errcount = 0;
struct sensor_correction_s sensor_correction; /**< sensor thermal corrections */
@@ -307,7 +307,7 @@ int do_gyro_calibration(orb_advert_t *mavlink_log_pub)
for(unsigned i = 0; i < orb_gyro_count && !found_cur_gyro; i++) {
worker_data.gyro_sensor_sub[cur_gyro] = orb_subscribe_multi(ORB_ID(sensor_gyro), i);
struct gyro_report report;
sensor_gyro_s report{};
orb_copy(ORB_ID(sensor_gyro), worker_data.gyro_sensor_sub[cur_gyro], &report);
#ifdef __PX4_NUTTX
+1 -1
View File
@@ -396,7 +396,7 @@ static calibrate_return mag_calibration_worker(detect_orientation_return orienta
int poll_ret = px4_poll(fds, fd_count, 1000);
if (poll_ret > 0) {
struct gyro_report gyro;
sensor_gyro_s gyro{};
orb_copy(ORB_ID(sensor_gyro), sub_gyro, &gyro);
/* ensure we have a valid first timestamp */
+1 -1
View File
@@ -2047,7 +2047,7 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg)
/* gyro */
{
struct gyro_report gyro = {};
sensor_gyro_s gyro = {};
gyro.timestamp = timestamp;
gyro.x_raw = imu.xgyro * 1000.0f;
+2 -2
View File
@@ -155,7 +155,7 @@ void VotedSensorsUpdate::parameters_update()
if (topic_instance < _gyro.subscription_count) {
// valid subscription, so get the driver id by getting the published sensor data
struct gyro_report report;
sensor_gyro_s report;
if (orb_copy(ORB_ID(sensor_gyro), _gyro.subscription[topic_instance], &report) == 0) {
int temp = _temperature_compensation.set_sensor_id_gyro(report.device_id, topic_instance);
@@ -652,7 +652,7 @@ void VotedSensorsUpdate::gyro_poll(struct sensor_combined_s &raw)
orb_check(_gyro.subscription[uorb_index], &gyro_updated);
if (gyro_updated) {
struct gyro_report gyro_report;
sensor_gyro_s gyro_report;
int ret = orb_copy(ORB_ID(sensor_gyro), _gyro.subscription[uorb_index], &gyro_report);
+7 -7
View File
@@ -363,7 +363,7 @@ GYROSIM::init()
sensor_accel_s arp = {};
struct gyro_report grp = {};
sensor_gyro_s grp = {};
ret = VirtDevObj::init();
@@ -381,7 +381,7 @@ GYROSIM::init()
goto out;
}
_gyro_reports = new ringbuffer::RingBuffer(2, sizeof(gyro_report));
_gyro_reports = new ringbuffer::RingBuffer(2, sizeof(sensor_gyro_s));
if (_gyro_reports == nullptr) {
PX4_WARN("_gyro_reports creation failed");
@@ -584,7 +584,7 @@ GYROSIM::self_test()
ssize_t
GYROSIM::gyro_read(void *buffer, size_t buflen)
{
unsigned count = buflen / sizeof(gyro_report);
unsigned count = buflen / sizeof(sensor_gyro_s);
/* buffer must be large enough */
if (count < 1) {
@@ -605,7 +605,7 @@ GYROSIM::gyro_read(void *buffer, size_t buflen)
perf_count(_gyro_reads);
/* copy reports out of our buffer to the caller */
gyro_report *grp = reinterpret_cast<gyro_report *>(buffer);
sensor_gyro_s *grp = reinterpret_cast<sensor_gyro_s *>(buffer);
int transferred = 0;
while (count--) {
@@ -618,7 +618,7 @@ GYROSIM::gyro_read(void *buffer, size_t buflen)
}
/* return the number of bytes transferred */
return (transferred * sizeof(gyro_report));
return (transferred * sizeof(sensor_gyro_s));
}
int
@@ -869,7 +869,7 @@ GYROSIM::_measure()
* Report buffers.
*/
sensor_accel_s arb = {};
gyro_report grb = {};
sensor_gyro_s grb = {};
// for now use local time but this should be the timestamp of the simulator
grb.timestamp = hrt_absolute_time();
@@ -1151,7 +1151,7 @@ test()
const char *path_accel = MPU_DEVICE_PATH_ACCEL;
const char *path_gyro = MPU_DEVICE_PATH_GYRO;
sensor_accel_s a_report;
gyro_report g_report;
sensor_gyro_s g_report;
ssize_t sz;
/* get the driver */
+1 -1
View File
@@ -1007,7 +1007,7 @@ int Simulator::publish_sensor_topics(mavlink_hil_sensor_t *imu)
*/
/* gyro */
{
struct gyro_report gyro = {};
sensor_gyro_s gyro = {};
gyro.timestamp = timestamp;
gyro.x_raw = imu->xgyro * 1000.0f;