mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 11:03:34 +08:00
enable reading sensor data from simulator module for SITL
This commit is contained in:
@@ -118,22 +118,26 @@ BARO_SIM::init()
|
||||
int
|
||||
BARO_SIM::dev_read(unsigned offset, void *data, unsigned count)
|
||||
{
|
||||
/*
|
||||
union _cvt {
|
||||
uint8_t b[4];
|
||||
uint32_t w;
|
||||
} *cvt = (_cvt *)data;
|
||||
uint8_t buf[3];
|
||||
*/
|
||||
|
||||
/* read the most recent measurement */
|
||||
uint8_t cmd = 0;
|
||||
int ret = transfer(&cmd, 1, &buf[0], 3);
|
||||
int ret = transfer(&cmd, 1, static_cast<uint8_t *>(data), 3);
|
||||
|
||||
/*
|
||||
if (ret == PX4_OK) {
|
||||
/* fetch the raw value */
|
||||
// fetch the raw value
|
||||
cvt->b[0] = buf[2];
|
||||
cvt->b[1] = buf[1];
|
||||
cvt->b[2] = buf[0];
|
||||
cvt->b[3] = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user