auto-sync

This commit is contained in:
rusEfi 2017-01-05 05:01:46 -05:00
parent 278263528c
commit 902f87b635
4 changed files with 15 additions and 15 deletions

View File

@ -118,7 +118,7 @@ ts_channel_s tsChannel;
static int ts_serial_ready(bool isConsoleRedirect) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
if (isSerialOverUart() ^ isConsoleRedirect) {
if (isCommandLineConsoleOverTTL() ^ isConsoleRedirect) {
// TS uses USB when console uses serial
return is_usb_serial_ready();
} else {
@ -154,7 +154,7 @@ static void printErrorCounters(void) {
void printTsStats(void) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
if (!isSerialOverUart()) {
if (!isCommandLineConsoleOverTTL()) {
scheduleMsg(&tsLogger, "TS RX on %s", hwPortname(engineConfiguration->binarySerialRxPin));
scheduleMsg(&tsLogger, "TS TX on %s @%d", hwPortname(engineConfiguration->binarySerialTxPin),

View File

@ -30,7 +30,7 @@ static SerialConfig tsSerialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LI
void startTsPort(void) {
#if EFI_USB_SERIAL || defined(__DOXYGEN__)
if (isSerialOverUart()) {
if (isCommandLineConsoleOverTTL()) {
print("TunerStudio over USB serial");
/**
* This method contains a long delay, that's the reason why this is not done on the main thread
@ -56,7 +56,7 @@ void startTsPort(void) {
BaseChannel * getTsSerialDevice(void) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
if (isSerialOverUart()) {
if (isCommandLineConsoleOverTTL()) {
// if console uses UART then TS uses USB
return (BaseChannel *) &SDU1;
} else {

View File

@ -72,7 +72,7 @@ static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size)
short c = (short) chSequentialStreamGet(chp);
onDataArrived();
if (isSerialOverUart()) {
if (isCommandLineConsoleOverTTL()) {
uint32_t flags;
chSysLock()
;
@ -131,10 +131,10 @@ static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size)
CommandHandler console_line_callback;
static bool isCommandLineConsoleOverTTL;
static bool b_isCommandLineConsoleOverTTL;
bool isSerialOverUart(void) {
return isCommandLineConsoleOverTTL;
bool isCommandLineConsoleOverTTL(void) {
return b_isCommandLineConsoleOverTTL;
}
#if (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR ) || defined(__DOXYGEN__)
@ -178,7 +178,7 @@ void runConsoleLoop(ts_channel_s *console) {
SerialDriver * getConsoleChannel(void) {
#if defined(EFI_CONSOLE_UART_DEVICE) || defined(__DOXYGEN__)
if (isSerialOverUart()) {
if (isCommandLineConsoleOverTTL()) {
return (SerialDriver *) EFI_CONSOLE_UART_DEVICE;
}
#endif /* EFI_CONSOLE_UART_DEVICE */
@ -191,7 +191,7 @@ SerialDriver * getConsoleChannel(void) {
}
bool isCommandLineConsoleReady(void) {
if (isSerialOverUart()) {
if (isCommandLineConsoleOverTTL()) {
return isSerialConsoleStarted;
} else {
return is_usb_serial_ready();
@ -207,7 +207,7 @@ static THD_FUNCTION(consoleThreadThreadEntryPoint, arg) {
chRegSetThreadName("console thread");
#if (EFI_PROD_CODE && EFI_USB_SERIAL) || defined(__DOXYGEN__)
if (!isSerialOverUart()) {
if (!isCommandLineConsoleOverTTL()) {
/**
* This method contains a long delay, that's the reason why this is not done on the main thread
*/
@ -252,9 +252,9 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p)
palSetPadMode(CONSOLE_MODE_SWITCH_PORT, CONSOLE_MODE_SWITCH_PIN, PAL_MODE_INPUT_PULLUP);
isCommandLineConsoleOverTTL = GET_CONSOLE_MODE_VALUE() == EFI_USE_UART_FOR_CONSOLE;
b_isCommandLineConsoleOverTTL = GET_CONSOLE_MODE_VALUE() == EFI_USE_UART_FOR_CONSOLE;
if (isSerialOverUart()) {
if (isCommandLineConsoleOverTTL()) {
/*
* Activates the serial using the driver default configuration (that's 38400)
* it is important to set 'NONE' as flow control! in terminal application on the PC
@ -270,7 +270,7 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p)
chEvtRegisterMask((event_source_t *) chnGetEventSource(EFI_CONSOLE_UART_DEVICE), &consoleEventListener, 1);
}
#else
isCommandLineConsoleOverTTL = false;
b_isCommandLineConsoleOverTTL = false;
#endif /* EFI_PROD_CODE */
chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, (tfunc_t)consoleThreadThreadEntryPoint, NULL);

View File

@ -25,7 +25,7 @@ SerialDriver * getConsoleChannel(void);
void consolePutChar(int x);
void consoleOutputBuffer(const uint8_t *buf, int size);
void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p);
bool isSerialOverUart(void);
bool isCommandLineConsoleOverTTL(void);
void onDataArrived(void);
#if EFI_PROD_CODE || EFI_SIMULATOR || EFI_EGT