The Big Refactoring of 2019: console vs TS vs CONSOLE_MODE_SWITCH_PIN vs text protocol #725

more dead code
This commit is contained in:
rusefi 2019-04-01 11:57:30 -04:00
parent 1ab6cace13
commit feec03fa24
6 changed files with 6 additions and 54 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -59,7 +59,7 @@ void runRusEfi(void) {
// TestThread(&SD1);
chThdSleepMilliseconds(50);
printPending();
// printPending();
}

View File

@ -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 */

View File

@ -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;