Browse Source

mpu9250:mag rework the setup to veify HW first

If the setup is unsucessful fo not register the devices or
   allocate resources.
sbg
David Sidrane 8 years ago committed by Lorenz Meier
parent
commit
8bd044e80e
  1. 6
      src/drivers/mpu9250/mag.cpp

6
src/drivers/mpu9250/mag.cpp

@ -123,7 +123,9 @@ MPU9250_mag::~MPU9250_mag() @@ -123,7 +123,9 @@ MPU9250_mag::~MPU9250_mag()
int
MPU9250_mag::init()
{
int ret;
int ret = ak8963_setup();
if (ret == OK) {
ret = CDev::init();
@ -141,7 +143,6 @@ MPU9250_mag::init() @@ -141,7 +143,6 @@ MPU9250_mag::init()
_mag_class_instance = register_class_devname(MAG_BASE_DEVICE_PATH);
ak8963_setup();
/* advertise sensor topic, measure manually to initialize valid report */
struct mag_report mrp;
@ -154,6 +155,7 @@ MPU9250_mag::init() @@ -154,6 +155,7 @@ MPU9250_mag::init()
if (_mag_topic == nullptr) {
warnx("ADVERT FAIL");
}
}
out:
return ret;

Loading…
Cancel
Save