From 69a232e12df951662a011100fffeefcfe389b0fb Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 4 May 2020 00:10:20 -0400 Subject: [PATCH] ugly copy-paste --- firmware/console/binary/bluetooth.cpp | 15 ++++++++++++++- firmware/console/console_io.cpp | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/firmware/console/binary/bluetooth.cpp b/firmware/console/binary/bluetooth.cpp index 9d2d1de65e..484001859e 100644 --- a/firmware/console/binary/bluetooth.cpp +++ b/firmware/console/binary/bluetooth.cpp @@ -80,10 +80,17 @@ static void runCommands() { // if the baud rate is changed, reinit the UART if (baudIdx != prevBaudIdx || restoreAndExit) { #if EFI_USB_SERIAL - extern SerialConfig serialConfig; // if we have USB we assume BT operates on primary TTL // todo: we need to clean a lot in this area :( +#ifdef EFI_CONSOLE_SERIAL_DEVICE + extern SerialConfig serialConfig; sdStop(EFI_CONSOLE_SERIAL_DEVICE); +#endif /* EFI_CONSOLE_SERIAL_DEVICE */ +#ifdef EFI_CONSOLE_UART_DEVICE + extern UARTConfig uartConfig; + uartStop(EFI_CONSOLE_UART_DEVICE); +#endif /* EFI_CONSOLE_UART_DEVICE */ + #else // deinit UART if (!stopTsPort(tsChannel)) { @@ -96,8 +103,14 @@ static void runCommands() { CONFIG(tunerStudioSerialSpeed) = restoreAndExit ? savedSerialSpeed : baudRates[baudIdx]; #if EFI_USB_SERIAL +#ifdef EFI_CONSOLE_SERIAL_DEVICE serialConfig.speed = CONFIG(tunerStudioSerialSpeed); sdStart(EFI_CONSOLE_SERIAL_DEVICE, &serialConfig); +#endif /* EFI_CONSOLE_SERIAL_DEVICE */ +#ifdef EFI_CONSOLE_UART_DEVICE + uartConfig.speed = CONFIG(tunerStudioSerialSpeed); + uartStart(EFI_CONSOLE_UART_DEVICE, &uartConfig); +#endif /* EFI_CONSOLE_UART_DEVICE */ #else // init UART startTsPort(tsChannel); diff --git a/firmware/console/console_io.cpp b/firmware/console/console_io.cpp index 7d96feacd1..2ebf9d9f04 100644 --- a/firmware/console/console_io.cpp +++ b/firmware/console/console_io.cpp @@ -136,7 +136,7 @@ SerialConfig serialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 }; #if (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR ) /* Note: This structure is modified from the default ChibiOS layout! */ -static UARTConfig uartConfig = { +UARTConfig uartConfig = { .txend1_cb = NULL, .txend2_cb = NULL, .rxend_cb = NULL, .rxchar_cb = NULL, .rxerr_cb = NULL, .speed = 0, .cr1 = 0, .cr2 = 0/*USART_CR2_STOP1_BITS*/ | USART_CR2_LINEN, .cr3 = 0, .timeout_cb = NULL, .rxhalf_cb = NULL