fix clang

This commit is contained in:
Tomasz Duda 2024-07-24 19:19:03 +02:00
parent 1e552bb458
commit 8d8939eaf4

View file

@ -13,6 +13,7 @@ namespace logger {
static const char *const TAG = "logger"; static const char *const TAG = "logger";
#ifdef USE_LOGGER_USB_CDC
void Logger::loop() { void Logger::loop() {
if (this->uart_ != UART_SELECTION_USB_CDC || nullptr == this->uart_dev_) { if (this->uart_ != UART_SELECTION_USB_CDC || nullptr == this->uart_dev_) {
return; return;
@ -31,6 +32,7 @@ void Logger::loop() {
} }
opened = !opened; opened = !opened;
} }
#endif
void Logger::pre_setup() { void Logger::pre_setup() {
if (this->baud_rate_ > 0) { if (this->baud_rate_ > 0) {
@ -42,12 +44,14 @@ void Logger::pre_setup() {
case UART_SELECTION_UART1: case UART_SELECTION_UART1:
uart_dev = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(uart1)); uart_dev = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(uart1));
break; break;
#ifdef USE_LOGGER_USB_CDC
case UART_SELECTION_USB_CDC: case UART_SELECTION_USB_CDC:
uart_dev = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(cdc_acm_uart0)); uart_dev = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(cdc_acm_uart0));
if (device_is_ready(uart_dev)) { if (device_is_ready(uart_dev)) {
usb_enable(nullptr); usb_enable(nullptr);
} }
break; break;
#endif
} }
if (!device_is_ready(uart_dev)) { if (!device_is_ready(uart_dev)) {
ESP_LOGE(TAG, "%s is not ready.", get_uart_selection_()); ESP_LOGE(TAG, "%s is not ready.", get_uart_selection_());