AP_RangeFinder: Console output can be disabled

This commit is contained in:
murata 2022-03-21 18:25:36 +09:00 committed by Andrew Tridgell
parent 324f5e3ac9
commit 5728d2fd7c
3 changed files with 16 additions and 16 deletions

View File

@ -245,12 +245,12 @@ void AP_RangeFinder_Bebop::_loop(void)
_capture();
if (_apply_averaging_filter() < 0) {
hal.console->printf(
DEV_PRINTF(
"AR_RangeFinder_Bebop: could not apply averaging filter");
}
if (_search_local_maxima() < 0) {
hal.console->printf("Did not find any local maximum");
DEV_PRINTF("Did not find any local maximum");
}
max_index = _search_maximum_with_max_amplitude();
@ -296,7 +296,7 @@ void AP_RangeFinder_Bebop::_configure_gpio(int value)
_gpio->write(LINUX_GPIO_ULTRASOUND_VOLTAGE, 0);
break;
default:
hal.console->printf("bad gpio value (%d)", value);
DEV_PRINTF("bad gpio value (%d)", value);
break;
}
}
@ -310,10 +310,10 @@ void AP_RangeFinder_Bebop::_reconfigure_wave()
/* configure the output buffer for a purge */
/* perform a purge */
if (_launch_purge() < 0) {
hal.console->printf("purge could not send data overspi");
DEV_PRINTF("purge could not send data overspi");
}
if (_capture() < 0) {
hal.console->printf("purge could not capture data");
DEV_PRINTF("purge could not capture data");
}
_tx_buf = _tx[_mode];
@ -325,7 +325,7 @@ void AP_RangeFinder_Bebop::_reconfigure_wave()
_configure_gpio(1);
break;
default:
hal.console->printf("WARNING, invalid value to configure gpio\n");
DEV_PRINTF("WARNING, invalid value to configure gpio\n");
break;
}
}
@ -355,13 +355,13 @@ int AP_RangeFinder_Bebop::_configure_capture()
_adc.device = iio_context_find_device(_iio, adcname);
if (!_adc.device) {
hal.console->printf("Unable to find %s", adcname);
DEV_PRINTF("Unable to find %s", adcname);
goto error_destroy_context;
}
_adc.channel = iio_device_find_channel(_adc.device, adcchannel,
false);
if (!_adc.channel) {
hal.console->printf("Fail to init adc channel %s", adcchannel);
DEV_PRINTF("Fail to init adc channel %s", adcchannel);
goto error_destroy_context;
}
@ -374,13 +374,13 @@ int AP_RangeFinder_Bebop::_configure_capture()
/* Create input buffer */
_adc.buffer_size = RNFD_BEBOP_P7_COUNT;
if (iio_device_set_kernel_buffers_count(_adc.device, 1)) {
hal.console->printf("cannot set buffer count");
DEV_PRINTF("cannot set buffer count");
goto error_destroy_context;
}
_adc.buffer = iio_device_create_buffer(_adc.device,
_adc.buffer_size, false);
if (!_adc.buffer) {
hal.console->printf("Fail to create buffer : %s", strerror(errno));
DEV_PRINTF("Fail to create buffer : %s", strerror(errno));
goto error_destroy_context;
}

View File

@ -107,13 +107,13 @@ bool AP_RangeFinder_Benewake_TFMiniPlus::init()
goto fail;
}
hal.console->printf(DRIVER ": found fw version %u.%u.%u\n",
DEV_PRINTF(DRIVER ": found fw version %u.%u.%u\n",
val[5], val[4], val[3]);
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
ret = _dev->transfer(cmds[i], cmds[i][1], nullptr, 0);
if (!ret) {
hal.console->printf(DRIVER ": Unable to set configuration register %u\n",
DEV_PRINTF(DRIVER ": Unable to set configuration register %u\n",
cmds[i][2]);
goto fail;
}

View File

@ -188,14 +188,14 @@ void AP_RangeFinder_LightWareI2C::sf20_get_version(const char* send_msg, const c
bool AP_RangeFinder_LightWareI2C::init()
{
if (sf20_init()) {
hal.console->printf("Found SF20 native Lidar\n");
DEV_PRINTF("Found SF20 native Lidar\n");
return true;
}
if (legacy_init()) {
hal.console->printf("Found SF20 legacy Lidar\n");
DEV_PRINTF("Found SF20 legacy Lidar\n");
return true;
}
hal.console->printf("SF20 not found\n");
DEV_PRINTF("SF20 not found\n");
return false;
}
@ -242,7 +242,7 @@ bool AP_RangeFinder_LightWareI2C::sf20_init()
sf20_get_version("?P\r\n", "p:", version);
if (version[0]) {
hal.console->printf("SF20 Lidar version %s\n", version);
DEV_PRINTF("SF20 Lidar version %s\n", version);
}
// Makes sure that "address tagging" is turned off.