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

View File

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

View File

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

View File

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

View File

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