Fix build if no TS_UART_DMA_MODE, TS_UART_MODE and TS_SERIAL_DEVICE defined (#729)

This commit is contained in:
dron0gus 2019-04-02 00:39:07 +03:00 committed by rusefi
parent 99bff37869
commit 9d95127260
1 changed files with 64 additions and 70 deletions

View File

@ -82,9 +82,10 @@ static SerialConfig tsSerialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LI
void startTsPort(ts_channel_s *tsChannel) {
tsChannel->channel = (BaseChannel *) NULL;
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#if EFI_USB_SERIAL || defined(__DOXYGEN__)
if (true) {
#if defined(CONSOLE_USB_DEVICE) || defined(__DOXYGEN__)
print("TunerStudio over USB serial");
/**
* This method contains a long delay, that's the reason why this is not done on the main thread
@ -92,9 +93,9 @@ void startTsPort(ts_channel_s *tsChannel) {
usb_serial_start();
// if console uses UART then TS uses USB
tsChannel->channel = (BaseChannel *) &CONSOLE_USB_DEVICE;
} else
return;
#endif
{
#if defined(TS_UART_DEVICE) || defined(TS_SERIAL_DEVICE)
if (CONFIGB(useSerialPort)) {
print("TunerStudio over USART");
@ -118,17 +119,16 @@ void startTsPort(ts_channel_s *tsChannel) {
// start DMA driver
tsUartConfig.speed = CONFIGB(tunerStudioSerialSpeed);
uartStart(TS_UART_DEVICE, &tsUartConfig);
#else
#elif defined(TS_SERIAL_DEVICE)
print("Using Serial mode");
tsSerialConfig.speed = CONFIGB(tunerStudioSerialSpeed);
sdStart(TS_SERIAL_DEVICE, &tsSerialConfig);
tsChannel->channel = (BaseChannel *) TS_SERIAL_DEVICE;
#endif /* TS_UART_DMA_MODE */
} else
tsChannel->channel = (BaseChannel *) NULL; // actually not used
#endif
}
#endif /* TS_UART_DMA_MODE || TS_UART_MODE */
#else /* EFI_PROD_CODE */
tsChannel->channel = (BaseChannel *) TS_SIMULATOR_PORT;
#endif /* EFI_PROD_CODE */
@ -137,25 +137,19 @@ void startTsPort(ts_channel_s *tsChannel) {
bool stopTsPort(ts_channel_s *tsChannel) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#if EFI_USB_SERIAL || defined(__DOXYGEN__)
if (true) {
#if 0
usb_serial_stop();
#endif
// don't stop USB!
//usb_serial_stop();
return false;
} else
#endif
{
if (CONFIGB(useSerialPort)) {
// todo: disable Rx/Tx pads?
#if (TS_UART_DMA_MODE || TS_UART_MODE)
uartStop(TS_UART_DEVICE);
#else
#endif /* TS_UART_DMA_MODE || TS_UART_MODE */
#ifdef TS_SERIAL_DEVICE
sdStop(TS_SERIAL_DEVICE);
#endif /* TS_UART_DMA_MODE */
#endif /* TS_SERIAL_DEVICE */
}
}
tsChannel->channel = (BaseChannel *) NULL;
return true;
#else /* EFI_PROD_CODE */