void runRusEfi(void) { #if defined(EFI_CONSOLE_UART_DEVICE) /* * Activates the serial driver 1 using the driver default configuration. * PA9 and PA10 are routed to USART1. */ sdStart(&SD1, NULL); palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(1)); /* USART1 TX. */ palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(1)); /* USART1 RX. */ #endif /* * Creates the blinker threads. */ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); initMax31855(NULL, max31855_cs); /* * Normal main() thread activity, in this demo it does nothing except * sleeping in a loop and check the button state, when the button is * pressed the test procedure is launched with output on the serial * driver 1. */ while (true) { // if (palReadPad(GPIOA, GPIOA_BUTTON)) // TestThread(&SD1); chThdSleepMilliseconds(50); printPending(); } }
/** * @brief Sends all pending data to dev console */ void updateDevConsoleState(Engine *engine) { if (!isConsoleReady()) { return; } // looks like this is not needed anymore // checkIfShouldHalt(); printPending(); /** * this should go before the firmware error so that console can detect connection */ printSensors(&logger, false); #if EFI_PROD_CODE || defined(__DOXYGEN__) // todo: unify with simulator! if (hasFirmwareError()) { scheduleMsg(&logger, "FATAL error: %s", errorMessageBuffer); warningEnabled = false; scheduleLogging(&logger); return; } #endif #if (EFI_PROD_CODE && HAL_USE_ADC) || defined(__DOXYGEN__) pokeAdcInputs(); #endif if (!fullLog) { return; } systime_t nowSeconds = getTimeNowSeconds(); printInfo(nowSeconds); #if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) int currentCkpEventCounter = getCrankEventCounter(); if (prevCkpEventCounter == currentCkpEventCounter && timeOfPreviousReport == nowSeconds) { return; } timeOfPreviousReport = nowSeconds; prevCkpEventCounter = currentCkpEventCounter; #else chThdSleepMilliseconds(200); #endif printState(); #if EFI_WAVE_ANALYZER printWave(&logger); #endif scheduleLogging(&logger); }