ugly copy-paste

This commit is contained in:
rusefi 2020-05-04 00:10:20 -04:00
parent ae1bd9c55d
commit 69a232e12d
2 changed files with 15 additions and 2 deletions

View File

@ -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);

View File

@ -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