auto-sync

This commit is contained in:
rusEfi 2015-03-17 21:07:24 -05:00
parent c300701348
commit 85d79adaeb
5 changed files with 21 additions and 15 deletions

View File

@ -107,9 +107,9 @@ ts_channel_s tsChannel;
extern uint8_t crcWriteBuffer[300]; extern uint8_t crcWriteBuffer[300];
static int ts_serial_ready(void) { static int ts_serial_ready(bool_t isConsoleRedirect) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
if (isSerialOverUart()) { if (isSerialOverUart() ^ isConsoleRedirect) {
// TS uses USB when console uses serial // TS uses USB when console uses serial
return is_usb_serial_ready(); return is_usb_serial_ready();
} else { } else {
@ -401,10 +401,10 @@ static bool isKnownCommand(char command) {
static uint8_t firstByte; static uint8_t firstByte;
static uint8_t secondByte; static uint8_t secondByte;
void runBinaryProtocolLoop(ts_channel_s *tsChannel) { void runBinaryProtocolLoop(ts_channel_s *tsChannel, bool_t isConsoleRedirect) {
int wasReady = false; int wasReady = false;
while (true) { while (true) {
int isReady = ts_serial_ready(); int isReady = ts_serial_ready(isConsoleRedirect);
if (!isReady) { if (!isReady) {
chThdSleepMilliseconds(10); chThdSleepMilliseconds(10);
wasReady = false; wasReady = false;
@ -508,7 +508,7 @@ static msg_t tsThreadEntryPoint(void *arg) {
startTsPort(); startTsPort();
#endif #endif
runBinaryProtocolLoop(&tsChannel); runBinaryProtocolLoop(&tsChannel, false);
#if defined __GNUC__ #if defined __GNUC__
return 0; return 0;

View File

@ -54,7 +54,7 @@ void requestBurn(void);
void startTunerStudioConnectivity(void); void startTunerStudioConnectivity(void);
void syncTunerStudioCopy(void); void syncTunerStudioCopy(void);
void runBinaryProtocolLoop(ts_channel_s *tsChannel); void runBinaryProtocolLoop(ts_channel_s *tsChannel, bool_t isConsoleRedirect);
#if defined __GNUC__ #if defined __GNUC__
// GCC // GCC

View File

@ -191,7 +191,7 @@ static msg_t consoleThreadThreadEntryPoint(void *arg) {
if (consoleInBinaryMode) { if (consoleInBinaryMode) {
// switch to binary protocol // switch to binary protocol
runBinaryProtocolLoop(&binaryConsole); runBinaryProtocolLoop(&binaryConsole, true);
} }
} }
#if defined __GNUC__ #if defined __GNUC__

View File

@ -188,7 +188,7 @@ static void lcdPrintf(const char *fmt, ...) {
lcd_HD44780_print_string(lcdLineBuffer); lcd_HD44780_print_string(lcdLineBuffer);
} }
static void showLine(lcd_line_e line) { static void showLine(lcd_line_e line, int screenY) {
switch (line) { switch (line) {
case LL_VERSION: case LL_VERSION:
@ -199,6 +199,12 @@ static void showLine(lcd_line_e line) {
return; return;
case LL_RPM: case LL_RPM:
lcdPrintf("RPM %d", getRpmE(engine)); lcdPrintf("RPM %d", getRpmE(engine));
{
int seconds = getTimeNowSeconds();
if (seconds < 10000) {
lcdPrintf(" %d", seconds);
}
}
return; return;
case LL_CLT_TEMPERATURE: case LL_CLT_TEMPERATURE:
lcdPrintf("Coolant %f", getCoolantTemperature(PASS_ENGINE_PARAMETER_F)); lcdPrintf("Coolant %f", getCoolantTemperature(PASS_ENGINE_PARAMETER_F));
@ -281,9 +287,9 @@ static void fillWithSpaces(void) {
void updateHD44780lcd(Engine *engine) { void updateHD44780lcd(Engine *engine) {
MenuItem *p = tree.topVisible; MenuItem *p = tree.topVisible;
int count = 0; int screenY = 0;
for (; count < tree.linesCount && p != NULL; count++) { for (; screenY < tree.linesCount && p != NULL; screenY++) {
lcd_HD44780_set_position(count, 0); lcd_HD44780_set_position(screenY, 0);
char firstChar; char firstChar;
if (p == tree.current) { if (p == tree.current) {
if (p->callback != NULL) { if (p->callback != NULL) {
@ -298,14 +304,14 @@ void updateHD44780lcd(Engine *engine) {
if (p->lcdLine == LL_STRING) { if (p->lcdLine == LL_STRING) {
lcd_HD44780_print_string(p->text); lcd_HD44780_print_string(p->text);
} else { } else {
showLine(p->lcdLine); showLine(p->lcdLine, screenY);
} }
fillWithSpaces(); fillWithSpaces();
p = p->next; p = p->next;
} }
for (; count < tree.linesCount; count++) { for (; screenY < tree.linesCount; screenY++) {
lcd_HD44780_set_position(count, 0); lcd_HD44780_set_position(screenY, 0);
fillWithSpaces(); fillWithSpaces();
} }

View File

@ -276,5 +276,5 @@ int getRusEfiVersion(void) {
return 1; // this is here to make the compiler happy about the unused array return 1; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] == 0) if (UNUSED_CCM_SIZE[0] == 0)
return 1; // this is here to make the compiler happy about the unused array return 1; // this is here to make the compiler happy about the unused array
return 20150316; return 20150317;
} }