replace mag_report with sensor_mag_s

This commit is contained in:
Daniel Agar
2020-01-10 12:15:18 -05:00
parent e19e0bd616
commit ceec0238c4
20 changed files with 61 additions and 62 deletions
+6 -6
View File
@@ -192,7 +192,7 @@ RM3100::collect()
float yraw_f;
float zraw_f;
struct mag_report new_mag_report;
sensor_mag_s new_mag_report;
bool sensor_is_onboard = false;
perf_begin(_sample_perf);
@@ -326,7 +326,7 @@ RM3100::init()
}
/* allocate basic report buffers */
_reports = new ringbuffer::RingBuffer(2, sizeof(mag_report));
_reports = new ringbuffer::RingBuffer(2, sizeof(sensor_mag_s));
if (_reports == nullptr) {
return PX4_ERROR;
@@ -500,8 +500,8 @@ RM3100::reset()
int
RM3100::read(struct file *file_pointer, char *buffer, size_t buffer_len)
{
unsigned count = buffer_len / sizeof(struct mag_report);
struct mag_report *mag_buf = reinterpret_cast<struct mag_report *>(buffer);
unsigned count = buffer_len / sizeof(sensor_mag_s);
sensor_mag_s *mag_buf = reinterpret_cast<sensor_mag_s *>(buffer);
int ret = 0;
/* buffer must be large enough */
@@ -518,7 +518,7 @@ RM3100::read(struct file *file_pointer, char *buffer, size_t buffer_len)
*/
while (count--) {
if (_reports->get(mag_buf)) {
ret += sizeof(struct mag_report);
ret += sizeof(sensor_mag_s);
mag_buf++;
}
}
@@ -548,7 +548,7 @@ RM3100::read(struct file *file_pointer, char *buffer, size_t buffer_len)
}
if (_reports->get(mag_buf)) {
ret = sizeof(struct mag_report);
ret = sizeof(sensor_mag_s);
}
} while (0);
+1 -1
View File
@@ -152,7 +152,7 @@ private:
struct mag_calibration_s _scale;
struct mag_report _last_report {}; /**< used for info() */
sensor_mag_s _last_report {}; /**< used for info() */
orb_advert_t _mag_topic;
@@ -154,7 +154,7 @@ bool
rm3100::test(RM3100_BUS bus_id)
{
struct rm3100_bus_option &bus = find_bus(bus_id);
struct mag_report report;
sensor_mag_s report;
ssize_t sz;
int ret;
const char *path = bus.devpath;