PX4 FLOW: Silence alarming messages on a normal boot

This commit is contained in:
Lorenz Meier 2015-08-01 17:15:25 +02:00
parent c38c58291e
commit 3679c25125
1 changed files with 13 additions and 8 deletions

View File

@ -602,7 +602,7 @@ bool start_in_progress = false;
const int START_RETRY_COUNT = 5;
const int START_RETRY_TIMEOUT = 1000;
void start();
int start();
void stop();
void test();
void reset();
@ -611,22 +611,26 @@ void info();
/**
* Start the driver.
*/
void
int
start()
{
int fd;
/* entry check: */
if (start_in_progress) {
errx(1, "start in progress");
warnx("start already in progress");
return 1;
}
start_in_progress = true;
if (g_dev != nullptr) {
start_in_progress = false;
errx(1, "already started");
warnx("already started");
return 1;
}
warnx("scanning I2C buses for device..");
int retry_nr = 0;
while (1) {
const int busses_to_try[] = {
@ -684,11 +688,12 @@ start()
/* success! */
start_in_progress = false;
exit(0);
return 0;
}
if (retry_nr < START_RETRY_COUNT) {
warnx("PX4FLOW not found on I2C busses. Retrying in %d ms. Giving up in %d retries.", START_RETRY_TIMEOUT, START_RETRY_COUNT - retry_nr);
/* lets not be too verbose */
// warnx("PX4FLOW not found on I2C busses. Retrying in %d ms. Giving up in %d retries.", START_RETRY_TIMEOUT, START_RETRY_COUNT - retry_nr);
usleep(START_RETRY_TIMEOUT * 1000);
retry_nr++;
} else {
@ -702,7 +707,7 @@ start()
}
start_in_progress = false;
errx(1, "PX4FLOW could not be started over I2C");
return 1;
}
/**
@ -852,7 +857,7 @@ px4flow_main(int argc, char *argv[])
* Start/load the driver.
*/
if (!strcmp(argv[1], "start")) {
px4flow::start();
return px4flow::start();
}
/*