mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 04:31:37 +08:00
PX4 FLOW: Silence alarming messages on a normal boot
This commit is contained in:
@@ -642,7 +642,7 @@ bool start_in_progress = false;
|
|||||||
const int START_RETRY_COUNT = 5;
|
const int START_RETRY_COUNT = 5;
|
||||||
const int START_RETRY_TIMEOUT = 1000;
|
const int START_RETRY_TIMEOUT = 1000;
|
||||||
|
|
||||||
void start();
|
int start();
|
||||||
void stop();
|
void stop();
|
||||||
void test();
|
void test();
|
||||||
void reset();
|
void reset();
|
||||||
@@ -651,22 +651,26 @@ void info();
|
|||||||
/**
|
/**
|
||||||
* Start the driver.
|
* Start the driver.
|
||||||
*/
|
*/
|
||||||
void
|
int
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
/* entry check: */
|
/* entry check: */
|
||||||
if (start_in_progress) {
|
if (start_in_progress) {
|
||||||
errx(1, "start in progress");
|
warnx("start already in progress");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
start_in_progress = true;
|
start_in_progress = true;
|
||||||
|
|
||||||
if (g_dev != nullptr) {
|
if (g_dev != nullptr) {
|
||||||
start_in_progress = false;
|
start_in_progress = false;
|
||||||
errx(1, "already started");
|
warnx("already started");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
warnx("scanning I2C buses for device..");
|
||||||
|
|
||||||
int retry_nr = 0;
|
int retry_nr = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
const int busses_to_try[] = {
|
const int busses_to_try[] = {
|
||||||
@@ -724,11 +728,12 @@ start()
|
|||||||
|
|
||||||
/* success! */
|
/* success! */
|
||||||
start_in_progress = false;
|
start_in_progress = false;
|
||||||
exit(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retry_nr < START_RETRY_COUNT) {
|
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);
|
usleep(START_RETRY_TIMEOUT * 1000);
|
||||||
retry_nr++;
|
retry_nr++;
|
||||||
} else {
|
} else {
|
||||||
@@ -742,7 +747,7 @@ start()
|
|||||||
}
|
}
|
||||||
|
|
||||||
start_in_progress = false;
|
start_in_progress = false;
|
||||||
errx(1, "PX4FLOW could not be started over I2C");
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -892,7 +897,7 @@ px4flow_main(int argc, char *argv[])
|
|||||||
* Start/load the driver.
|
* Start/load the driver.
|
||||||
*/
|
*/
|
||||||
if (!strcmp(argv[1], "start")) {
|
if (!strcmp(argv[1], "start")) {
|
||||||
px4flow::start();
|
return px4flow::start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user