Ejemplo n.º 1
0
static void printState(void) {
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)

	// todo: make SWO work
//	char *msg = "hello\r\n";
//	for(int i=0;i<strlen(msg);i++) {
//		ITM_SendChar(msg[i]);
//	}

	int rpm = getRpmE(engine);
	if (subscription[(int) RO_TOTAL_REVOLUTION_COUNTER])
		debugInt(&logger, "ckp_c", getCrankEventCounter());
	if (subscription[(int) RO_RUNNING_REVOLUTION_COUNTER])
		debugInt(&logger, "ckp_r", engine->triggerCentral.triggerState.runningRevolutionCounter);

	if (subscription[(int) RO_RUNNING_TRIGGER_ERROR])
		debugInt(&logger, "trg_r_errors", engine->triggerCentral.triggerState.runningTriggerErrorCounter);

	if (subscription[(int) RO_RUNNING_ORDERING_TRIGGER_ERROR])
		debugInt(&logger, "trg_r_order_errors", engine->triggerCentral.triggerState.runningOrderingErrorCounter);

	if (subscription[(int) RO_WAVE_CHART_CURRENT_SIZE])
		debugInt(&logger, "wave_chart_current", 0);

//	debugInt(&logger, "idl", getIdleSwitch());

//	debugFloat(&logger, "table_spark", getAdvance(rpm, getMaf()), 2);

//		float map = getMap();

#endif /* EFI_SHAFT_POSITION_INPUT */
}
Ejemplo n.º 2
0
/**
 * @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);
}
Ejemplo n.º 3
0
static void printState(void) {
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)

	// todo: make SWO work
//	char *msg = "hello\r\n";
//	for(int i=0;i<strlen(msg);i++) {
//		ITM_SendChar(msg[i]);
//	}

	int rpm = getRpmE(engine);
	if (subscription[(int) RO_TOTAL_REVOLUTION_COUNTER])
		debugInt(&logger, "ckp_c", getCrankEventCounter());
	if (subscription[(int) RO_RUNNING_REVOLUTION_COUNTER])
		debugInt(&logger, "ckp_r", engine->triggerCentral.triggerState.runningRevolutionCounter);

	if (subscription[(int) RO_RUNNING_TRIGGER_ERROR])
		debugInt(&logger, "trg_r_errors", engine->triggerCentral.triggerState.runningTriggerErrorCounter);

	if (subscription[(int) RO_RUNNING_ORDERING_TRIGGER_ERROR])
		debugInt(&logger, "trg_r_order_errors", engine->triggerCentral.triggerState.runningOrderingErrorCounter);

	if (subscription[(int) RO_WAVE_CHART_CURRENT_SIZE])
		debugInt(&logger, "wave_chart_current", 0);

//	debugInt(&logger, "idl", getIdleSwitch());

//	debugFloat(&logger, "table_spark", getAdvance(rpm, getMaf()), 2);

	float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
	float baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER);
	debugFloat(&logger, "fuel_base", baseFuel, 2);
//	debugFloat(&logger, "fuel_iat", getIatCorrection(getIntakeAirTemperature()), 2);
//	debugFloat(&logger, "fuel_clt", getCltCorrection(getCoolantTemperature()), 2);
	debugFloat(&logger, "fuel_lag", engine->injectorLagMs, 2);
	debugFloat(&logger, "fuel", ENGINE(actualLastInjection), 2);

	debugFloat(&logger, "timing", engine->engineState.timingAdvance, 2);

//		float map = getMap();

#endif /* EFI_SHAFT_POSITION_INPUT */
}