コード例 #1
0
ファイル: fuel_math.cpp プロジェクト: owenanthonyj/rusefi
float getBaroCorrection(DECLARE_ENGINE_PARAMETER_F) {
	if (hasBaroSensor(PASS_ENGINE_PARAMETER_F)) {
		return baroCorrMap.getValue(getBaroPressure(PASS_ENGINE_PARAMETER_F), getRpm());
	} else {
		return 1;
	}
}
コード例 #2
0
static msg_t ivThread(int param) {
	chRegSetThreadName("IdleValve");

	int currentIdleValve = -1;
	while (TRUE) {
		chThdSleepMilliseconds(100);

		// this value is not used yet
		idleSwitchState = palReadPad(getHwPort(boardConfiguration->idleSwitchPin), getHwPin(boardConfiguration->idleSwitchPin));

		if (!isIdleControlActive)
			continue;

		int nowSec = chTimeNowSeconds();

		int newValue = getIdle(&idle, getRpm(), nowSec);

		if (currentIdleValve != newValue) {
			currentIdleValve = newValue;

			setIdleValvePwm(newValue);
		}
	}
#if defined __GNUC__
	return -1;
#endif
}
コード例 #3
0
ファイル: engine_math.cpp プロジェクト: rus084/rusefi
bool engineNeedSkipStokeT(engine_configuration_s *engineConfiguration) {
    if (getRpm() > engineConfiguration->rpmHardLimit) {
        return true;
    }


    return false;
}
コード例 #4
0
ファイル: lcd_controller.cpp プロジェクト: rus084/rusefi
void updateHD44780lcd(void) {

	lcd_HD44780_set_position(0, 9);
	/**
	 * this would blink so that we know the LCD is alive
	 */
	if (getTimeNowSeconds() % 2 == 0) {
		lcd_HD44780_print_char('R');
	} else {
		lcd_HD44780_print_char(' ');
	}
	lcd_HD44780_set_position(0, 10);

	char * ptr = itoa10(buffer, getRpm());
	ptr[0] = 0;
	int len = ptr - buffer;
	for (int i = 0; i < 6 - len; i++) {
		lcd_HD44780_print_char(' ');
	}
	lcd_HD44780_print_string(buffer);

	if (hasFirmwareError()) {
		memcpy(buffer, getFirmwareError(), LCD_WIDTH);
		buffer[LCD_WIDTH] = 0;
		lcd_HD44780_set_position(1, 0);
		lcd_HD44780_print_string(buffer);
		return;
	}

	lcd_HD44780_set_position(1, 0);
	memset(buffer, ' ', LCD_WIDTH);
	memcpy(buffer, getWarninig(), LCD_WIDTH);
	buffer[LCD_WIDTH] = 0;
	lcd_HD44780_print_string(buffer);

	if (engineConfiguration->HD44780height < 3) {
		return;
	}

	int index = (getTimeNowSeconds() / 2) % (NUMBER_OF_DIFFERENT_LINES / 2);

	prepareCurrentSecondLine(index);
	buffer[LCD_WIDTH] = 0;
	lcd_HD44780_set_position(2, 0);
	lcd_HD44780_print_string(buffer);

	prepareCurrentSecondLine(index + NUMBER_OF_DIFFERENT_LINES / 2);
	buffer[LCD_WIDTH] = 0;
	lcd_HD44780_set_position(3, 0);
	lcd_HD44780_print_string(buffer);

#if EFI_PROD_CODE
	dateToString(dateBuffer);
	lcd_HD44780_set_position(1, 0);
	lcd_HD44780_print_string(dateBuffer);
#endif /* EFI_PROD_CODE */
}
コード例 #5
0
ファイル: rpm_calculator.cpp プロジェクト: Vijay1190/rusefi
/**
 * This trigger callback schedules the actual physical TDC callback in relation to trigger synchronization point.
 */
static void tdcMarkCallback(trigger_event_e ckpSignalType, uint32_t index0 DECLARE_ENGINE_PARAMETER_S) {
	(void) ckpSignalType;
	bool isTriggerSynchronizationPoint = index0 == 0;
	if (isTriggerSynchronizationPoint) {
		int revIndex2 = engine->rpmCalculator.getRevolutionCounter() % 2;
		int rpm = getRpm();
		// todo: use event-based scheduling, not just time-based scheduling
		scheduleByAngle(rpm, &tdcScheduler[revIndex2], tdcPosition(),
				(schfunc_t) onTdcCallback, NULL);
	}
}
コード例 #6
0
ファイル: wave_analyzer.cpp プロジェクト: ngocphu811/rusefi
static void reportWave(Logging *logging, int index) {
	if (readers[index].hw.started) {
//	int counter = getEventCounter(index);
//	debugInt2(logging, "ev", index, counter);

		float dwellMs = getSignalOnTime(index);
		float periodMs = getSignalPeriodMs(index);

		appendPrintf(logging, "duty%d%s", index, DELIMETER);
		appendFloat(logging, 100.0f * dwellMs / periodMs, 2);
		appendPrintf(logging, "%s", DELIMETER);

		/**
		 * that's the ON time of the LAST signal
		 */
		appendPrintf(logging, "dwell%d%s", index, DELIMETER);
		appendFloat(logging, dwellMs, 2);
		appendPrintf(logging, "%s", DELIMETER);

		/**
		 * that's the total ON time during the previous engine cycle
		 */
		appendPrintf(logging, "total_dwell%d%s", index, DELIMETER);
		appendFloat(logging, readers[index].prevTotalOnTimeUs / 1000.0f, 2);
		appendPrintf(logging, "%s", DELIMETER);

		appendPrintf(logging, "period%d%s", index, DELIMETER);
		appendFloat(logging, periodMs, 2);
		appendPrintf(logging, "%s", DELIMETER);

		uint32_t offsetUs = getWaveOffset(index);
		float oneDegreeUs = getOneDegreeTimeUs(getRpm());

		appendPrintf(logging, "advance%d%s", index, DELIMETER);
		appendFloat(logging, fixAngle((offsetUs / oneDegreeUs) - engineConfiguration->globalTriggerAngleOffset), 3);
		appendPrintf(logging, "%s", DELIMETER);
	}
}
コード例 #7
0
int isCranking(void) {
	int rpm = getRpm();
	return isCrankingR(rpm);
}
コード例 #8
0
void scheduleByAngle(scheduling_s *timer, float angle, schfunc_t callback, void *param) {
	int delay = (int)(getOneDegreeTime(getRpm()) * angle);
	scheduleTask(timer, delay, callback, param);
}
コード例 #9
0
static void onTdcCallback(void) {
	itoa10(rpmBuffer, getRpm());
	addWaveChartEvent(TOP_DEAD_CENTER_MESSAGE, rpmBuffer, "");
}