fix: Correctly reflect state of AUX1 when DEBUG build (#3814)
This commit is contained in:
+11
-3
@@ -90,7 +90,7 @@ extern "C" void dbgSerialPrintf(const char * format, ...)
|
|||||||
|
|
||||||
const char *t = tmp;
|
const char *t = tmp;
|
||||||
while (*t) {
|
while (*t) {
|
||||||
SEGGER_RTT_Write(0, (const void *)t++, 1);
|
SEGGER_RTT_Write(0, (const void*)t++, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -449,12 +449,20 @@ void serialInit(uint8_t port_nr, int mode)
|
|||||||
|
|
||||||
void initSerialPorts()
|
void initSerialPorts()
|
||||||
{
|
{
|
||||||
memset(serialPortStates, 0, sizeof(serialPortStates));
|
#if defined(DEBUG)
|
||||||
|
// AUX1 and serialPortStates was already initialized early in DEBUG config
|
||||||
|
for (uint8_t port_nr = 0; port_nr < MAX_AUX_SERIAL; port_nr++) {
|
||||||
|
if (port_nr != SP_AUX1) {
|
||||||
|
auto mode = getSerialPortMode(port_nr);
|
||||||
|
serialInit(port_nr, mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
for (uint8_t port_nr = 0; port_nr < MAX_AUX_SERIAL; port_nr++) {
|
for (uint8_t port_nr = 0; port_nr < MAX_AUX_SERIAL; port_nr++) {
|
||||||
auto mode = getSerialPortMode(port_nr);
|
auto mode = getSerialPortMode(port_nr);
|
||||||
serialInit(port_nr, mode);
|
serialInit(port_nr, mode);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int serialGetMode(uint8_t port_nr)
|
int serialGetMode(uint8_t port_nr)
|
||||||
|
|||||||
@@ -105,6 +105,13 @@ void postRadioSettingsLoad()
|
|||||||
g_eeGeneral.stickDeadZone = DEFAULT_STICK_DEADZONE;
|
g_eeGeneral.stickDeadZone = DEFAULT_STICK_DEADZONE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(DEBUG)
|
||||||
|
// clean up leftovers from a previous DEBUG config
|
||||||
|
for (uint8_t port_nr = 0; port_nr < MAX_AUX_SERIAL; port_nr++) {
|
||||||
|
if (serialGetMode(port_nr) == UART_MODE_DEBUG)
|
||||||
|
serialSetMode(port_nr, UART_MODE_NONE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool sortMixerLines()
|
static bool sortMixerLines()
|
||||||
|
|||||||
@@ -146,7 +146,8 @@ void boardInit()
|
|||||||
__enable_irq();
|
__enable_irq();
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
serialInit(SP_AUX1, UART_MODE_DEBUG);
|
serialSetMode(SP_AUX1, UART_MODE_DEBUG); // indicate AUX1 is used
|
||||||
|
serialInit(SP_AUX1, UART_MODE_DEBUG); // early AUX1 init
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACE("\nHorus board started :)");
|
TRACE("\nHorus board started :)");
|
||||||
|
|||||||
@@ -207,7 +207,8 @@ void boardInit()
|
|||||||
hardwareOptions.pcbrev = boardGetPcbRev();
|
hardwareOptions.pcbrev = boardGetPcbRev();
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
serialInit(SP_AUX1, UART_MODE_DEBUG);
|
serialSetMode(SP_AUX1, UART_MODE_DEBUG); // indicate AUX1 is used
|
||||||
|
serialInit(SP_AUX1, UART_MODE_DEBUG); // early AUX1 init
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACE("\n%s board started :)",
|
TRACE("\n%s board started :)",
|
||||||
|
|||||||
@@ -225,7 +225,8 @@ void boardInit()
|
|||||||
usbInit();
|
usbInit();
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
serialInit(SP_AUX1, UART_MODE_DEBUG);
|
serialSetMode(SP_AUX1, UART_MODE_DEBUG); // indicate AUX1 is used
|
||||||
|
serialInit(SP_AUX1, UART_MODE_DEBUG); // early AUX1 init
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAPTIC)
|
#if defined(HAPTIC)
|
||||||
|
|||||||
Reference in New Issue
Block a user