Default binary should have more relaxed pinout: serial #4998

refactoring: it looks like we can go with simpler code?
This commit is contained in:
rusefillc 2023-01-23 06:01:10 -05:00
parent 15ae3a4591
commit f036c566f4
7 changed files with 8 additions and 22 deletions

View File

@ -10,9 +10,6 @@ DDEFS += -DFIRMWARE_ID=\"atlas\"
# DDEFS += -DSTM32_ADC_USE_ADC3=TRUE
# DEFS += -DEFI_SOFTWARE_KNOCK=TRUE
# disable hardware serial ports on H7
# DDEFS += -DTS_NO_PRIMARY=1 -DTS_NO_SECONDARY=1
# We are running on Atlas hardware!
DDEFS += -DHW_ATLAS=1

View File

@ -11,5 +11,3 @@ DDEFS += -DLED_COMMUNICATION_BRAIN_PIN_MODE=INVERTED_OUTPUT
# We are running on Hellen-One hardware!
DDEFS += -DHW_HELLEN=1
DDEFS += -DTS_NO_SECONDARY=TRUE

View File

@ -6,7 +6,7 @@ PROJECT_CPU = ARCH_STM32F4
DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::C11
# No serial ports for now
DDEFS += -DTS_NO_PRIMARY=TRUE -DTS_NO_SECONDARY=TRUE
DDEFS += -DTS_NO_PRIMARY=TRUE
# No USB
DDEFS += -DEFI_USB_SERIAL=FALSE

View File

@ -46,9 +46,6 @@
#ifndef TS_NO_PRIMARY
#define TS_NO_PRIMARY 1
#endif
#ifndef TS_NO_SECONDARY
#define TS_NO_SECONDARY 1
#endif
#define AUX_SERIAL_DEVICE (&SD6)

View File

@ -16,12 +16,6 @@
#define HAS_UxART_PRIMARY false
#endif
#if (!TS_NO_SECONDARY && defined(TS_SECONDARY_UxART_PORT))
#define HAS_UxART_SECONDARY true
#else
#define HAS_UxART_SECONDARY false
#endif
#if EFI_USB_SERIAL
#include "usbconsole.h"
#endif // EFI_USB_SERIAL

View File

@ -4,7 +4,7 @@
#include "tunerstudio_io.h"
#if HAS_UxART_PRIMARY || HAS_UxART_SECONDARY
#if HAS_UxART_PRIMARY || defined(TS_SECONDARY_UxART_PORT)
#if HAL_USE_SERIAL
void SerialTsChannel::start(uint32_t baud) {
SerialConfig cfg = {
@ -65,4 +65,4 @@ size_t UartTsChannel::readTimeout(uint8_t* buffer, size_t size, int timeout) {
return size;
}
#endif // HAL_USE_UART
#endif // HAS_UxART_PRIMARY || HAS_UxART_SECONDARY
#endif // HAS_UxART_PRIMARY || defined(TS_SECONDARY_UxART_PORT)

View File

@ -58,7 +58,7 @@ class SerialTsChannel;
static PrimaryChannelThread primaryChannelThread;
#endif // HAS_UxART_PRIMARY
#if HAS_UxART_SECONDARY
#if defined(TS_SECONDARY_UxART_PORT)
#ifdef TS_SECONDARY_UxART_PORT
std::conditional_t<
std::is_same_v<decltype(TS_SECONDARY_UxART_PORT), UARTDriver>,
@ -68,7 +68,7 @@ class SerialTsChannel;
UartTsChannel,
#endif // EFI_USE_UART_DMA
SerialTsChannel> secondaryChannel(TS_SECONDARY_UxART_PORT);
#endif // TS_SECONDARY_UxART_PORT
#endif // defined(TS_SECONDARY_UxART_PORT)
struct SecondaryChannelThread : public TunerstudioThread {
@ -87,7 +87,7 @@ class SerialTsChannel;
};
static SecondaryChannelThread secondaryChannelThread;
#endif // HAS_UxART_SECONDARY
#endif // defined(TS_SECONDARY_UxART_PORT)
void startSerialChannels() {
#if HAS_UxART_PRIMARY
@ -97,13 +97,13 @@ void startSerialChannels() {
}
#endif
#if HAS_UxART_SECONDARY
#if defined(TS_SECONDARY_UxART_PORT)
secondaryChannelThread.start();
#endif
}
SerialTsChannelBase* getBluetoothChannel() {
#if HAS_UxART_SECONDARY
#if defined(TS_SECONDARY_UxART_PORT)
// Prefer secondary channel for bluetooth
return &secondaryChannel;
#elif HAS_UxART_PRIMARY