mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-29 05:40:35 +08:00
Fixed gyrosim
Was not calling base class init() Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -308,7 +308,7 @@ private:
|
||||
extern "C" { __EXPORT int gyrosim_main(int argc, char *argv[]); }
|
||||
|
||||
GYROSIM::GYROSIM(const char *path_accel, const char *path_gyro, enum Rotation rotation) :
|
||||
VirtDevObj("GYROSIM", path_accel, nullptr, 1000),
|
||||
VirtDevObj("GYROSIM", path_accel, ACCEL_BASE_DEVICE_PATH, 1000),
|
||||
_gyro(new GYROSIM_gyro(this, path_gyro)),
|
||||
_product(GYROSIMES_REV_C4),
|
||||
_accel_reports(nullptr),
|
||||
@@ -390,6 +390,13 @@ GYROSIM::init()
|
||||
|
||||
struct gyro_report grp = {};
|
||||
|
||||
ret = VirtDevObj::init();
|
||||
if (ret != 0) {
|
||||
PX4_WARN("Base class init failed");
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* allocate basic report buffers */
|
||||
_accel_reports = new ringbuffer::RingBuffer(2, sizeof(accel_report));
|
||||
|
||||
@@ -1158,7 +1165,7 @@ GYROSIM::print_registers()
|
||||
|
||||
GYROSIM_gyro::GYROSIM_gyro(GYROSIM *parent, const char *path) :
|
||||
// Set sample interval to 0 since device is read by parent
|
||||
VirtDevObj("GYROSIM_gyro", path, "", 0),
|
||||
VirtDevObj("GYROSIM_gyro", path, GYRO_BASE_DEVICE_PATH, 0),
|
||||
_parent(parent),
|
||||
_gyro_topic(nullptr),
|
||||
_gyro_orb_class_instance(-1)
|
||||
|
||||
Reference in New Issue
Block a user