From dc7ee4247f3cfee6647876ba1873e0508e29ae00 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 3 Jan 2015 17:54:22 +0100 Subject: [PATCH] HMC5883 startup: Ensure sensor configuration is always performed --- src/drivers/hmc5883/hmc5883.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/drivers/hmc5883/hmc5883.cpp b/src/drivers/hmc5883/hmc5883.cpp index 80b2c5f13b..fe70bd37fe 100644 --- a/src/drivers/hmc5883/hmc5883.cpp +++ b/src/drivers/hmc5883/hmc5883.cpp @@ -1320,10 +1320,9 @@ start(int external_bus, enum Rotation rotation) int fd; /* create the driver, attempt expansion bus first */ - if (external_bus == HMC5883_BUS_ALL || external_bus == HMC5883_BUS_EXTERNAL) { - if (g_dev_ext != nullptr) { - errx(0, "already started external"); - } + if (g_dev_ext != nullptr) { + warnx("already started external"); + } else if (external_bus == HMC5883_BUS_ALL || external_bus == HMC5883_BUS_EXTERNAL) { device::Device *interface = nullptr; @@ -1364,10 +1363,9 @@ start(int external_bus, enum Rotation rotation) /* if this failed, attempt onboard sensor */ - if (external_bus == HMC5883_BUS_ALL || external_bus == HMC5883_BUS_INTERNAL) { - if (g_dev_int != nullptr) { - errx(0, "already started internal"); - } + if (g_dev_int != nullptr) { + warnx("already started internal"); + } else if (external_bus == HMC5883_BUS_ALL || external_bus == HMC5883_BUS_INTERNAL) { device::Device *interface = nullptr;