mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 02:36:37 +08:00
i2c: use board-specific bus numbering for '-X -b <bus>' CLI
As boards don't have their external buses labeled consistently, it was not useful to use an abstraction.
This commit is contained in:
@@ -73,7 +73,7 @@ bool I2CBusIterator::next()
|
||||
if (px4_i2c_bus_external(bus_data)) {
|
||||
++_external_bus_counter;
|
||||
|
||||
if (_bus == _external_bus_counter || _bus == -1) {
|
||||
if (_bus == bus_data.bus || _bus == -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,14 +504,8 @@ int I2CSPIDriverBase::module_start(const BusCLIArguments &cli, BusInstanceIterat
|
||||
// print some info that we are running
|
||||
switch (iterator.busType()) {
|
||||
case BOARD_I2C_BUS:
|
||||
PX4_INFO_RAW("%s #%i on I2C bus %d", instance->ItemName(), runtime_instance, iterator.bus());
|
||||
|
||||
if (iterator.external()) {
|
||||
PX4_INFO_RAW(" (external, equal to '-b %i')\n", iterator.externalBusIndex());
|
||||
|
||||
} else {
|
||||
PX4_INFO_RAW("\n");
|
||||
}
|
||||
PX4_INFO_RAW("%s #%i on I2C bus %d%s\n", instance->ItemName(), runtime_instance, iterator.bus(),
|
||||
iterator.external() ? " (external)" : "");
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ void PRINT_MODULE_USAGE_PARAMS_I2C_SPI_DRIVER(bool i2c_support, bool spi_support
|
||||
PRINT_MODULE_USAGE_PARAM_FLAG('S', "External SPI bus", true);
|
||||
}
|
||||
|
||||
PRINT_MODULE_USAGE_PARAM_INT('b', -1, 0, 16, "bus (board-specific internal (default=all) or n-th external (default=1))",
|
||||
PRINT_MODULE_USAGE_PARAM_INT('b', -1, 0, 16, "board-specific bus (default=all) (external SPI: n-th bus (default=1))",
|
||||
true);
|
||||
|
||||
if (spi_support) {
|
||||
|
||||
Reference in New Issue
Block a user