From feec03fa246de2f0b75a08e9b1d5c06992575e2a Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 1 Apr 2019 11:57:30 -0400 Subject: [PATCH] The Big Refactoring of 2019: console vs TS vs CONSOLE_MODE_SWITCH_PIN vs text protocol #725 more dead code --- firmware/console/binary/tunerstudio_io.h | 1 - firmware/console/console_io.cpp | 29 ++++-------------------- firmware/console/status_loop.cpp | 7 ------ firmware/egt2can.cpp | 2 +- firmware/util/datalogging.h | 5 ---- firmware/util/loggingcentral.cpp | 16 ------------- 6 files changed, 6 insertions(+), 54 deletions(-) diff --git a/firmware/console/binary/tunerstudio_io.h b/firmware/console/binary/tunerstudio_io.h index 4c7d29aa45..0a5b6ecd82 100644 --- a/firmware/console/binary/tunerstudio_io.h +++ b/firmware/console/binary/tunerstudio_io.h @@ -16,7 +16,6 @@ // that's hex for "~\n", see #define BINARY_SWITCH_TAG 0x7e0a -#define SWITCH_TO_BINARY_COMMAND "~" #define PROTOCOL "001" // this should match 'signature' in rusefi.ini diff --git a/firmware/console/console_io.cpp b/firmware/console/console_io.cpp index 898e0fa403..ada92d6c0f 100644 --- a/firmware/console/console_io.cpp +++ b/firmware/console/console_io.cpp @@ -143,13 +143,10 @@ static SerialConfig serialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LINE bool consoleInBinaryMode = false; void runConsoleLoop(ts_channel_s *console) { - if (true) { - // switch to binary protocol - consoleInBinaryMode = true; + #if EFI_TUNER_STUDIO || defined(__DOXYGEN__) - runBinaryProtocolLoop(console, true); + runBinaryProtocolLoop(console, true); #endif /* EFI_TUNER_STUDIO */ - } while (true) { efiAssertVoid(CUSTOM_ERR_6571, getCurrentRemainingStack() > 256, "lowstck#9e"); @@ -163,22 +160,11 @@ void runConsoleLoop(ts_channel_s *console) { (console_line_callback)(trimmed); - if (consoleInBinaryMode) { -#if EFI_SIMULATOR || defined(__DOXYGEN__) - /** - * Originally there was an attempt to have a human-readable text-based custom communication - * protocol between rusEfi console and rusEfi firmware. This is still kind of a bit functional - * but probably not very useful. - * Here we switch from that text mode into the protocol which is currently known as TunerStudio protocol - * even while historically it could be rooted in some older software. - */ - logMsg("Switching to binary mode\r\n"); -#endif // switch to binary protocol #if EFI_TUNER_STUDIO || defined(__DOXYGEN__) - runBinaryProtocolLoop(console, true); + runBinaryProtocolLoop(console, true); #endif /* EFI_TUNER_STUDIO */ - } + } } @@ -247,11 +233,6 @@ void consoleOutputBuffer(const uint8_t *buf, int size) { static Logging *logger; -static void switchToBinaryProtocol(void) { - scheduleMsg(logger, "switching to binary protocol"); - consoleInBinaryMode = true; -} - void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p) { logger = sharedLogger; console_line_callback = console_line_callback_p; @@ -279,6 +260,6 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p) #if !defined(EFI_CONSOLE_NO_THREAD) || defined(__DOXYGEN__) chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, (tfunc_t)consoleThreadThreadEntryPoint, NULL); #endif /* EFI_CONSOLE_NO_THREAD */ - addConsoleAction(SWITCH_TO_BINARY_COMMAND, switchToBinaryProtocol); + } diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 9ed0ef4e8a..149bb4a87f 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -425,8 +425,6 @@ void printOverallStatus(systime_t nowSeconds) { static systime_t timeOfPreviousReport = (systime_t) -1; -extern bool consoleInBinaryMode; - /** * @brief Sends all pending data to dev console * @@ -444,11 +442,6 @@ void updateDevConsoleState(void) { if (!isCommandLineConsoleReady()) { return; } -// looks like this is not needed anymore -// checkIfShouldHalt(); - if (!consoleInBinaryMode) { - printPending(); - } /** * this should go before the firmware error so that console can detect connection diff --git a/firmware/egt2can.cpp b/firmware/egt2can.cpp index 3beb95acd0..1c7476a948 100644 --- a/firmware/egt2can.cpp +++ b/firmware/egt2can.cpp @@ -59,7 +59,7 @@ void runRusEfi(void) { // TestThread(&SD1); chThdSleepMilliseconds(50); - printPending(); +// printPending(); } diff --git a/firmware/util/datalogging.h b/firmware/util/datalogging.h index 63702a8625..20c8431d7e 100644 --- a/firmware/util/datalogging.h +++ b/firmware/util/datalogging.h @@ -95,11 +95,6 @@ void appendFast(Logging *logging, const char *text); */ void scheduleLogging(Logging *logging); -/** - * this should only be invoked by the 'main' thread in order to keep the console safe - */ -void printPending(void); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/firmware/util/loggingcentral.cpp b/firmware/util/loggingcentral.cpp index de4715acc3..28a4328ce3 100644 --- a/firmware/util/loggingcentral.cpp +++ b/firmware/util/loggingcentral.cpp @@ -108,22 +108,6 @@ char * swapOutputBuffers(int *actualOutputBufferSize) { return outputBuffer; } -/** - * This method actually sends all the pending data to the communication layer. - * This method is invoked by the main thread - that's the only thread which should be sending - * actual data to console in order to avoid concurrent access to serial hardware. - */ -void printPending(void) { -#if EFI_TEXT_LOGGING || defined(__DOXYGEN__) - int actualOutputBufferSize; - char *output = swapOutputBuffers(&actualOutputBufferSize); - - if (actualOutputBufferSize > 0) { - printWithLength(output); - } -#endif /* EFI_TEXT_LOGGING */ -} - void initLoggingCentral(void) { pendingBuffers0[0] = 0; pendingBuffers1[0] = 0;