diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index df5fbe9b64..278bdafab5 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -460,7 +460,7 @@ static bool isKnownCommand(char command) { || command == TS_GET_FIRMWARE_VERSION; } - +// this function runs indefinitely void runBinaryProtocolLoop(ts_channel_s *tsChannel, bool isConsoleRedirect) { int wasReady = false; diff --git a/firmware/console/console_io.cpp b/firmware/console/console_io.cpp index ada92d6c0f..6f9ec2f851 100644 --- a/firmware/console/console_io.cpp +++ b/firmware/console/console_io.cpp @@ -140,38 +140,8 @@ bool isCommandLineConsoleOverTTL(void) { static SerialConfig serialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 }; #endif -bool consoleInBinaryMode = false; - -void runConsoleLoop(ts_channel_s *console) { - -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) - runBinaryProtocolLoop(console, true); -#endif /* EFI_TUNER_STUDIO */ - - while (true) { - efiAssertVoid(CUSTOM_ERR_6571, getCurrentRemainingStack() > 256, "lowstck#9e"); - bool end = getConsoleLine((BaseSequentialStream*) console->channel, console->crcReadBuffer, sizeof(console->crcReadBuffer) - 3); - if (end) { - // firmware simulator is the only case when this happens - continue; - } - - char *trimmed = efiTrim(console->crcReadBuffer); - - (console_line_callback)(trimmed); - - // switch to binary protocol -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) - runBinaryProtocolLoop(console, true); -#endif /* EFI_TUNER_STUDIO */ - - } -} - - #if EFI_PROD_CODE || EFI_EGT || defined(__DOXYGEN__) - BaseChannel * getConsoleChannel(void) { #if defined(EFI_CONSOLE_UART_DEVICE) || defined(__DOXYGEN__) return (BaseChannel *) EFI_CONSOLE_UART_DEVICE; @@ -209,8 +179,11 @@ static THD_FUNCTION(consoleThreadThreadEntryPoint, arg) { binaryConsole.channel = (BaseChannel *) getConsoleChannel(); - if (binaryConsole.channel != NULL) - runConsoleLoop(&binaryConsole); + if (binaryConsole.channel != NULL) { +#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) + runBinaryProtocolLoop(&binaryConsole, true); +#endif /* EFI_TUNER_STUDIO */ + } } #endif /* EFI_CONSOLE_NO_THREAD */