Airspeed driver: Proper start handling

This commit is contained in:
Lorenz Meier
2016-04-08 17:23:59 -07:00
parent c32310b6b4
commit b3b22b1c2c
@@ -561,7 +561,7 @@ info()
static void static void
meas_airspeed_usage() meas_airspeed_usage()
{ {
PX4_WARN("usage: meas_airspeed_sim command [options]"); PX4_WARN("usage: measairspeedsim command [options]");
PX4_WARN("options:"); PX4_WARN("options:");
PX4_WARN("\t-b --bus i2cbus (%d)", 1); PX4_WARN("\t-b --bus i2cbus (%d)", 1);
PX4_WARN("command:"); PX4_WARN("command:");
@@ -583,41 +583,41 @@ measairspeedsim_main(int argc, char *argv[])
} }
} }
int ret = 0; int ret = 1;
/* /*
* Start/load the driver. * Start/load the driver.
*/ */
if (!strcmp(argv[1], "start")) { if (!strcmp(argv[1], "start")) {
ret = meas_airspeed_sim::start(i2c_bus); return meas_airspeed_sim::start(i2c_bus);
} }
/* /*
* Stop the driver * Stop the driver
*/ */
if (!strcmp(argv[1], "stop")) { if (!strcmp(argv[1], "stop")) {
ret = meas_airspeed_sim::stop(); return meas_airspeed_sim::stop();
} }
/* /*
* Test the driver/device. * Test the driver/device.
*/ */
if (!strcmp(argv[1], "test")) { if (!strcmp(argv[1], "test")) {
ret = meas_airspeed_sim::test(); return meas_airspeed_sim::test();
} }
/* /*
* Reset the driver. * Reset the driver.
*/ */
if (!strcmp(argv[1], "reset")) { if (!strcmp(argv[1], "reset")) {
ret = meas_airspeed_sim::reset(); return meas_airspeed_sim::reset();
} }
/* /*
* Print driver information. * Print driver information.
*/ */
if (!strcmp(argv[1], "info") || !strcmp(argv[1], "status")) { if (!strcmp(argv[1], "info") || !strcmp(argv[1], "status")) {
ret = meas_airspeed_sim::info(); return meas_airspeed_sim::info();
} }
meas_airspeed_usage(); meas_airspeed_usage();