mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 03:13:34 +08:00
i2c_spi_buses: add '-q' for quiet startup flag (#14969)
* [WIP] i2c_spi_buses: add '-q' for quiet startup flag And enable for optional board sensors. * ROMFS: rc.sensors try starting all optional I2C sensors quietly Co-authored-by: Daniel Agar <daniel@agar.ca>
This commit is contained in:
@@ -86,6 +86,7 @@ int BusCLIArguments::getopt(int argc, char *argv[], const char *options)
|
||||
|
||||
*(p++) = 'b'; *(p++) = ':'; // bus
|
||||
*(p++) = 'f'; *(p++) = ':'; // frequency
|
||||
*(p++) = 'q'; // quiet flag
|
||||
|
||||
// copy all options
|
||||
const char *option = options;
|
||||
@@ -158,6 +159,10 @@ int BusCLIArguments::getopt(int argc, char *argv[], const char *options)
|
||||
spi_mode = (spi_mode_e)atoi(_optarg);
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
quiet_start = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ch == '?') {
|
||||
// abort further parsing on unknown arguments
|
||||
@@ -528,6 +533,10 @@ int I2CSPIDriverBase::module_start(const BusCLIArguments &cli, BusInstanceIterat
|
||||
}
|
||||
}
|
||||
|
||||
if (!started && !cli.quiet_start) {
|
||||
PX4_WARN("%s: no instance started (no device on bus?)", px4_get_taskname());
|
||||
}
|
||||
|
||||
return started ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user