* dead code

* do nothing

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2021-02-19 04:58:52 -08:00 committed by GitHub
parent 7808449263
commit 10efd25764
3 changed files with 1 additions and 97 deletions

View File

@ -73,86 +73,6 @@ void onDataArrived(void) {
consoleByteArrived = true;
}
/**
* @brief Reads a whole line from the input channel.
*
* @param[in] chp pointer to a @p BaseChannel object
* @param[in] line pointer to the line buffer
* @param[in] size buffer maximum length
* @return The operation status.
* @retval TRUE the channel was reset or CTRL-D pressed.
* @retval FALSE operation successful.
*/
/* let's keep this dead code for a bit
static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size) {
char *p = line;
while (true) {
if (!isCommandLineConsoleReady()) {
// we better do not read from serial before it is ready
chThdSleepMilliseconds(10);
continue;
}
short c = (short) streamGet(chp);
onDataArrived();
#if defined(EFI_CONSOLE_SERIAL_DEVICE)
uint32_t flags;
chSysLock()
;
flags = chEvtGetAndClearFlagsI(&consoleEventListener);
chSysUnlock()
;
if (flags & SD_OVERRUN_ERROR) {
// firmwareError(OBD_PCM_Processor_Fault, "serial overrun");
}
#endif
#if EFI_UART_ECHO_TEST_MODE
// That's test code - let's test connectivity
consolePutChar((uint8_t) c);
continue;
#endif
if (c < 0 || c == 4) {
return true;
}
if (c == 8) {
if (p != line) {
// backspace
consolePutChar((uint8_t) c);
consolePutChar(0x20);
consolePutChar((uint8_t) c);
p--;
}
continue;
}
if (c == '\r') {
consolePutChar('\r');
consolePutChar('\n');
*p = 0;
return false;
}
if (c == '\n') {
consolePutChar('\n');
*p = 0;
return false;
}
if (c < 0x20) {
continue;
}
if (p < line + size - 1) {
consolePutChar((uint8_t) c);
*p++ = (char) c;
}
}
}
*/
CommandHandler console_line_callback;
#if (defined(EFI_CONSOLE_SERIAL_DEVICE) && ! EFI_SIMULATOR )
@ -304,13 +224,6 @@ static THD_FUNCTION(consoleThreadEntryPoint, arg) {
#endif /* EFI_CONSOLE_NO_THREAD */
void consolePutChar(int x) {
BaseChannel * channel = getConsoleChannel();
if (channel != nullptr) {
chnWriteTimeout(channel, (const uint8_t *)&x, 1, CONSOLE_WRITE_TIMEOUT);
}
}
void consoleOutputBuffer(const uint8_t *buf, int size) {
#if !EFI_UART_ECHO_TEST_MODE
BaseChannel * channel = getConsoleChannel();

View File

@ -21,7 +21,6 @@ typedef void (*CommandHandler)(char *);
#include "datalogging.h"
void consolePutChar(int x);
void consoleOutputBuffer(const uint8_t *buf, int size);
void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p);
void onDataArrived(void);

View File

@ -37,14 +37,6 @@ static void myerror(void) {
firmwareError(CUSTOM_ERR_TEST_ERROR, "firmwareError: %d", getRusEfiVersion());
}
static void sayNothing(void) {
/**
* @see EngineState#TS_PROTOCOL_TAG
* this empty response is part of protocol check
* todo: make this logic smarter?
*/
}
static void sayHello(void) {
scheduleMsg(&logger, PROTOCOL_HELLO_PREFIX " rusEFI LLC (c) 2012-2021. All rights reserved.");
scheduleMsg(&logger, PROTOCOL_HELLO_PREFIX " rusEFI v%d@%s", getRusEfiVersion(), VCS_VERSION);
@ -205,7 +197,7 @@ void initializeConsole(Logging *sharedLogger) {
startConsole(sharedLogger, &handleConsoleLine);
sayHello();
addConsoleAction("test", sayNothing);
addConsoleAction("test", [](){ /* do nothing */});
addConsoleAction("hello", sayHello);
#if EFI_HAS_RESET
addConsoleAction("reset", scheduleReset);