From 85d79adaebf39051ee91f457963d7c5fb9c062d7 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Tue, 17 Mar 2015 21:07:24 -0500 Subject: [PATCH] auto-sync --- firmware/console/binary/tunerstudio.cpp | 10 +++++----- firmware/console/binary/tunerstudio.h | 2 +- firmware/console/console_io.cpp | 2 +- firmware/controllers/lcd_controller.cpp | 20 +++++++++++++------- firmware/rusefi.cpp | 2 +- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index de73c1d0bd..33d7613c4c 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -107,9 +107,9 @@ ts_channel_s tsChannel; extern uint8_t crcWriteBuffer[300]; -static int ts_serial_ready(void) { +static int ts_serial_ready(bool_t isConsoleRedirect) { #if EFI_PROD_CODE - if (isSerialOverUart()) { + if (isSerialOverUart() ^ isConsoleRedirect) { // TS uses USB when console uses serial return is_usb_serial_ready(); } else { @@ -401,10 +401,10 @@ static bool isKnownCommand(char command) { static uint8_t firstByte; static uint8_t secondByte; -void runBinaryProtocolLoop(ts_channel_s *tsChannel) { +void runBinaryProtocolLoop(ts_channel_s *tsChannel, bool_t isConsoleRedirect) { int wasReady = false; while (true) { - int isReady = ts_serial_ready(); + int isReady = ts_serial_ready(isConsoleRedirect); if (!isReady) { chThdSleepMilliseconds(10); wasReady = false; @@ -508,7 +508,7 @@ static msg_t tsThreadEntryPoint(void *arg) { startTsPort(); #endif - runBinaryProtocolLoop(&tsChannel); + runBinaryProtocolLoop(&tsChannel, false); #if defined __GNUC__ return 0; diff --git a/firmware/console/binary/tunerstudio.h b/firmware/console/binary/tunerstudio.h index 7dc7c1b757..4dd88fefc8 100644 --- a/firmware/console/binary/tunerstudio.h +++ b/firmware/console/binary/tunerstudio.h @@ -54,7 +54,7 @@ void requestBurn(void); void startTunerStudioConnectivity(void); void syncTunerStudioCopy(void); -void runBinaryProtocolLoop(ts_channel_s *tsChannel); +void runBinaryProtocolLoop(ts_channel_s *tsChannel, bool_t isConsoleRedirect); #if defined __GNUC__ // GCC diff --git a/firmware/console/console_io.cpp b/firmware/console/console_io.cpp index 57f4284b36..0540454fa7 100644 --- a/firmware/console/console_io.cpp +++ b/firmware/console/console_io.cpp @@ -191,7 +191,7 @@ static msg_t consoleThreadThreadEntryPoint(void *arg) { if (consoleInBinaryMode) { // switch to binary protocol - runBinaryProtocolLoop(&binaryConsole); + runBinaryProtocolLoop(&binaryConsole, true); } } #if defined __GNUC__ diff --git a/firmware/controllers/lcd_controller.cpp b/firmware/controllers/lcd_controller.cpp index 165677ef66..eef6f296ef 100644 --- a/firmware/controllers/lcd_controller.cpp +++ b/firmware/controllers/lcd_controller.cpp @@ -188,7 +188,7 @@ static void lcdPrintf(const char *fmt, ...) { lcd_HD44780_print_string(lcdLineBuffer); } -static void showLine(lcd_line_e line) { +static void showLine(lcd_line_e line, int screenY) { switch (line) { case LL_VERSION: @@ -199,6 +199,12 @@ static void showLine(lcd_line_e line) { return; case LL_RPM: lcdPrintf("RPM %d", getRpmE(engine)); + { + int seconds = getTimeNowSeconds(); + if (seconds < 10000) { + lcdPrintf(" %d", seconds); + } + } return; case LL_CLT_TEMPERATURE: lcdPrintf("Coolant %f", getCoolantTemperature(PASS_ENGINE_PARAMETER_F)); @@ -281,9 +287,9 @@ static void fillWithSpaces(void) { void updateHD44780lcd(Engine *engine) { MenuItem *p = tree.topVisible; - int count = 0; - for (; count < tree.linesCount && p != NULL; count++) { - lcd_HD44780_set_position(count, 0); + int screenY = 0; + for (; screenY < tree.linesCount && p != NULL; screenY++) { + lcd_HD44780_set_position(screenY, 0); char firstChar; if (p == tree.current) { if (p->callback != NULL) { @@ -298,14 +304,14 @@ void updateHD44780lcd(Engine *engine) { if (p->lcdLine == LL_STRING) { lcd_HD44780_print_string(p->text); } else { - showLine(p->lcdLine); + showLine(p->lcdLine, screenY); } fillWithSpaces(); p = p->next; } - for (; count < tree.linesCount; count++) { - lcd_HD44780_set_position(count, 0); + for (; screenY < tree.linesCount; screenY++) { + lcd_HD44780_set_position(screenY, 0); fillWithSpaces(); } diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index d3aef8bc64..1aac3f602e 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -276,5 +276,5 @@ int getRusEfiVersion(void) { return 1; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE[0] == 0) return 1; // this is here to make the compiler happy about the unused array - return 20150316; + return 20150317; }