fix broken master, inject engine ptr to rpmcalculator (#1759)

* fix

* oops
This commit is contained in:
Matthew Kennedy 2020-09-05 15:49:42 -07:00 committed by GitHub
parent b2eb02ddb2
commit 95798a5246
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 104 additions and 86 deletions

View File

@ -304,7 +304,7 @@ static void showFuelInfo2(float rpm, float engineLoad) {
scheduleMsg(&logger, "base cranking fuel %.2f", engineConfiguration->cranking.baseFuel); scheduleMsg(&logger, "base cranking fuel %.2f", engineConfiguration->cranking.baseFuel);
scheduleMsg(&logger2, "cranking fuel: %.2f", ENGINE(engineState.cranking.fuel)); scheduleMsg(&logger2, "cranking fuel: %.2f", ENGINE(engineState.cranking.fuel));
if (!engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (!engine->rpmCalculator.isStopped()) {
float iatCorrection = engine->engineState.running.intakeTemperatureCoefficient; float iatCorrection = engine->engineState.running.intakeTemperatureCoefficient;
float cltCorrection = engine->engineState.running.coolantTemperatureCoefficient; float cltCorrection = engine->engineState.running.coolantTemperatureCoefficient;
floatms_t injectorLag = engine->engineState.running.injectorLag; floatms_t injectorLag = engine->engineState.running.injectorLag;

View File

@ -500,7 +500,7 @@ static percent_t automaticIdleController(float tpsPos DECLARE_ENGINE_PARAMETER_S
const auto [cltValid, clt] = Sensor::get(SensorType::Clt); const auto [cltValid, clt] = Sensor::get(SensorType::Clt);
#if EFI_SHAFT_POSITION_INPUT #if EFI_SHAFT_POSITION_INPUT
bool isRunning = engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE); bool isRunning = engine->rpmCalculator.isRunning();
#else #else
bool isRunning = false; bool isRunning = false;
#endif /* EFI_SHAFT_POSITION_INPUT */ #endif /* EFI_SHAFT_POSITION_INPUT */

View File

@ -49,7 +49,7 @@ floatms_t WallFuel::adjust(floatms_t desiredFuel DECLARE_ENGINE_PARAMETER_SUFFIX
return desiredFuel; return desiredFuel;
} }
// disable this correction for cranking // disable this correction for cranking
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (ENGINE(rpmCalculator).isCranking()) {
return desiredFuel; return desiredFuel;
} }

View File

@ -203,7 +203,7 @@ angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) {
angle_t angle; angle_t angle;
bool isCranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE); bool isCranking = ENGINE(rpmCalculator).isCranking();
if (isCranking) { if (isCranking) {
angle = getCrankingAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER_SUFFIX); angle = getCrankingAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER_SUFFIX);
assertAngleRange(angle, "crAngle", CUSTOM_ERR_6680); assertAngleRange(angle, "crAngle", CUSTOM_ERR_6680);

View File

@ -138,7 +138,7 @@ static void cylinderCleanupControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
bool newValue; bool newValue;
if (engineConfiguration->isCylinderCleanupEnabled) { if (engineConfiguration->isCylinderCleanupEnabled) {
newValue = !engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE) && Sensor::get(SensorType::DriverThrottleIntent).value_or(0) > CLEANUP_MODE_TPS; newValue = !engine->rpmCalculator.isRunning() && Sensor::get(SensorType::DriverThrottleIntent).value_or(0) > CLEANUP_MODE_TPS;
} else { } else {
newValue = false; newValue = false;
} }
@ -179,7 +179,7 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if (BOARD_TLE8888_COUNT > 0) #if (BOARD_TLE8888_COUNT > 0)
static efitick_t tle8888CrankingResetTime = 0; static efitick_t tle8888CrankingResetTime = 0;
if (CONFIG(useTLE8888_cranking_hack) && ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (CONFIG(useTLE8888_cranking_hack) && ENGINE(rpmCalculator).isCranking()) {
efitick_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
if (nowNt - tle8888CrankingResetTime > MS2NT(300)) { if (nowNt - tle8888CrankingResetTime > MS2NT(300)) {
requestTLE8888initialization(); requestTLE8888initialization();
@ -332,7 +332,7 @@ void Engine::OnTriggerStateProperState(efitick_t nowNt) {
triggerCentral.triggerState.runtimeStatistics(&triggerCentral.triggerFormDetails, nowNt PASS_ENGINE_PARAMETER_SUFFIX); triggerCentral.triggerState.runtimeStatistics(&triggerCentral.triggerFormDetails, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
rpmCalculator.setSpinningUp(nowNt PASS_ENGINE_PARAMETER_SUFFIX); rpmCalculator.setSpinningUp(nowNt);
} }
void Engine::OnTriggerSynchronizationLost() { void Engine::OnTriggerSynchronizationLost() {
@ -340,7 +340,7 @@ void Engine::OnTriggerSynchronizationLost() {
EXPAND_Engine; EXPAND_Engine;
// Needed for early instant-RPM detection // Needed for early instant-RPM detection
engine->rpmCalculator.setStopSpinning(PASS_ENGINE_PARAMETER_SIGNATURE); engine->rpmCalculator.setStopSpinning();
} }
void Engine::OnTriggerInvalidIndex(int currentIndex) { void Engine::OnTriggerInvalidIndex(int currentIndex) {
@ -499,7 +499,7 @@ bool Engine::isInShutdownMode() const {
} }
injection_mode_e Engine::getCurrentInjectionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) { injection_mode_e Engine::getCurrentInjectionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return rpmCalculator.isCranking(PASS_ENGINE_PARAMETER_SIGNATURE) ? CONFIG(crankingInjectionMode) : CONFIG(injectionMode); return rpmCalculator.isCranking() ? CONFIG(crankingInjectionMode) : CONFIG(injectionMode);
} }
// see also in TunerStudio project '[doesTriggerImplyOperationMode] tag // see also in TunerStudio project '[doesTriggerImplyOperationMode] tag

View File

@ -116,7 +116,7 @@ EngineState::EngineState() {
void EngineState::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void EngineState::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// this feeds rusEfi console Live Data // this feeds rusEfi console Live Data
engine->engineState.isCrankingState = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE); engine->engineState.isCrankingState = ENGINE(rpmCalculator).isCranking();
} }
void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
@ -127,7 +127,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
warning(CUSTOM_SLOW_NOT_INVOKED, "Slow not invoked yet"); warning(CUSTOM_SLOW_NOT_INVOKED, "Slow not invoked yet");
} }
efitick_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (ENGINE(rpmCalculator).isCranking()) {
crankingTime = nowNt; crankingTime = nowNt;
timeSinceCranking = 0.0f; timeSinceCranking = 0.0f;
} else { } else {
@ -135,7 +135,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} }
updateAuxValves(PASS_ENGINE_PARAMETER_SIGNATURE); updateAuxValves(PASS_ENGINE_PARAMETER_SIGNATURE);
int rpm = ENGINE(rpmCalculator).getRpm(PASS_ENGINE_PARAMETER_SIGNATURE); int rpm = ENGINE(rpmCalculator).getRpm();
sparkDwell = getSparkDwell(rpm PASS_ENGINE_PARAMETER_SUFFIX); sparkDwell = getSparkDwell(rpm PASS_ENGINE_PARAMETER_SUFFIX);
dwellAngle = cisnan(rpm) ? NAN : sparkDwell / getOneDegreeTimeMs(rpm); dwellAngle = cisnan(rpm) ? NAN : sparkDwell / getOneDegreeTimeMs(rpm);

View File

@ -324,7 +324,7 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
// Always update base fuel - some cranking modes use it // Always update base fuel - some cranking modes use it
floatms_t baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER_SUFFIX); floatms_t baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER_SUFFIX);
bool isCranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE); bool isCranking = ENGINE(rpmCalculator).isCranking();
floatms_t fuelPerCycle = getFuel(isCranking, baseFuel PASS_ENGINE_PARAMETER_SUFFIX); floatms_t fuelPerCycle = getFuel(isCranking, baseFuel PASS_ENGINE_PARAMETER_SUFFIX);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(fuelPerCycle), "NaN fuelPerCycle", 0); efiAssert(CUSTOM_ERR_ASSERT, !cisnan(fuelPerCycle), "NaN fuelPerCycle", 0);

View File

@ -471,7 +471,7 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
* todo: convert to FSIO? * todo: convert to FSIO?
* open question if heater should be ON during cranking * open question if heater should be ON during cranking
*/ */
enginePins.o2heater.setValue(engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE)); enginePins.o2heater.setValue(engine->rpmCalculator.isRunning());
if (CONFIG(acRelayPin) != GPIO_UNASSIGNED) { if (CONFIG(acRelayPin) != GPIO_UNASSIGNED) {
setPinState("A/C", &enginePins.acRelay, acRelayLogic PASS_ENGINE_PARAMETER_SUFFIX); setPinState("A/C", &enginePins.acRelay, acRelayLogic PASS_ENGINE_PARAMETER_SUFFIX);
@ -767,7 +767,7 @@ void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
enginePins.fuelPumpRelay.setValue((getTimeNowSeconds() < engineConfiguration->startUpFuelPumpDuration) || (engine->rpmCalculator.getRpm() > 0)); enginePins.fuelPumpRelay.setValue((getTimeNowSeconds() < engineConfiguration->startUpFuelPumpDuration) || (engine->rpmCalculator.getRpm() > 0));
} }
enginePins.o2heater.setValue(engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE)); enginePins.o2heater.setValue(engine->rpmCalculator.isRunning());
} }
#endif /* EFI_FSIO */ #endif /* EFI_FSIO */

View File

@ -170,7 +170,7 @@ class EngineStateBlinkingTask : public PeriodicTimerController {
void PeriodicTask() override { void PeriodicTask() override {
counter++; counter++;
#if EFI_SHAFT_POSITION_INPUT #if EFI_SHAFT_POSITION_INPUT
bool is_running = ENGINE(rpmCalculator).isRunning(PASS_ENGINE_PARAMETER_SIGNATURE); bool is_running = ENGINE(rpmCalculator).isRunning();
#else #else
bool is_running = false; bool is_running = false;
#endif /* EFI_SHAFT_POSITION_INPUT */ #endif /* EFI_SHAFT_POSITION_INPUT */
@ -179,7 +179,7 @@ class EngineStateBlinkingTask : public PeriodicTimerController {
// blink in running mode // blink in running mode
enginePins.runningLedPin.setValue(counter % 2); enginePins.runningLedPin.setValue(counter % 2);
} else { } else {
int is_cranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE); int is_cranking = ENGINE(rpmCalculator).isCranking();
enginePins.runningLedPin.setValue(is_cranking); enginePins.runningLedPin.setValue(is_cranking);
} }
} }
@ -240,7 +240,7 @@ static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engine->rpmCalculator.setStopSpinning(PASS_ENGINE_PARAMETER_SIGNATURE); engine->rpmCalculator.setStopSpinning(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
if (ENGINE(directSelfStimulation) || engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (ENGINE(directSelfStimulation) || engine->rpmCalculator.isStopped()) {
/** /**
* rusEfi usually runs on hardware which halts execution while writing to internal flash, so we * rusEfi usually runs on hardware which halts execution while writing to internal flash, so we
* postpone writes to until engine is stopped. Writes in case of self-stimulation are fine. * postpone writes to until engine is stopped. Writes in case of self-stimulation are fine.
@ -254,7 +254,7 @@ static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} }
if (!engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (!engine->rpmCalculator.isStopped()) {
updatePrimeInjectionPulseState(PASS_ENGINE_PARAMETER_SIGNATURE); updatePrimeInjectionPulseState(PASS_ENGINE_PARAMETER_SIGNATURE);
} }

View File

@ -154,14 +154,14 @@ void touchTimeCounter() {
static void onStartStopButtonToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void onStartStopButtonToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engine->startStopStateToggleCounter++; engine->startStopStateToggleCounter++;
if (engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (engine->rpmCalculator.isStopped()) {
engine->startStopStateLastPushTime = getTimeNowNt(); engine->startStopStateLastPushTime = getTimeNowNt();
bool wasStarterEngaged = enginePins.starterControl.getAndSet(1); bool wasStarterEngaged = enginePins.starterControl.getAndSet(1);
if (!wasStarterEngaged) { if (!wasStarterEngaged) {
scheduleMsg(&sharedLogger, "Let's crank this engine for up to %dseconds!", CONFIG(startCrankingDuration)); scheduleMsg(&sharedLogger, "Let's crank this engine for up to %dseconds!", CONFIG(startCrankingDuration));
} }
} else if (engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE)) { } else if (engine->rpmCalculator.isRunning()) {
scheduleMsg(&sharedLogger, "Let's stop this engine!"); scheduleMsg(&sharedLogger, "Let's stop this engine!");
scheduleStopEngine(); scheduleStopEngine();
} }
@ -192,7 +192,7 @@ void slowStartStopButtonCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// todo: should this be simply FSIO? // todo: should this be simply FSIO?
if (engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (engine->rpmCalculator.isRunning()) {
// turn starter off once engine is running // turn starter off once engine is running
bool wasStarterEngaged = enginePins.starterControl.getAndSet(0); bool wasStarterEngaged = enginePins.starterControl.getAndSet(0);
if (wasStarterEngaged) { if (wasStarterEngaged) {

View File

@ -217,7 +217,7 @@ void InjectionEvent::onTriggerTooth(size_t trgEventIndex, int rpm, efitick_t now
} }
#endif /*EFI_PRINTF_FUEL_DETAILS */ #endif /*EFI_PRINTF_FUEL_DETAILS */
bool isCranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE); bool isCranking = ENGINE(rpmCalculator).isCranking();
/** /**
* todo: pre-calculate 'numberOfInjections' * todo: pre-calculate 'numberOfInjections'
* see also injectorDutyCycle * see also injectorDutyCycle
@ -464,7 +464,7 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent
// Check if the engine is not stopped or cylinder cleanup is activated // Check if the engine is not stopped or cylinder cleanup is activated
static bool isPrimeInjectionPulseSkipped(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static bool isPrimeInjectionPulseSkipped(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (!engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) if (!engine->rpmCalculator.isStopped())
return true; return true;
return CONFIG(isCylinderCleanupEnabled) && (Sensor::get(SensorType::Tps1).value_or(0) > CLEANUP_MODE_TPS); return CONFIG(isCylinderCleanupEnabled) && (Sensor::get(SensorType::Tps1).value_or(0) > CLEANUP_MODE_TPS);
} }
@ -520,7 +520,7 @@ void updatePrimeInjectionPulseState(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (counterWasReset) if (counterWasReset)
return; return;
if (!engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (!engine->rpmCalculator.isStopped()) {
backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, 0); backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, 0);
counterWasReset = true; counterWasReset = true;
} }

View File

@ -48,17 +48,17 @@ float RpmCalculator::getRpmAcceleration() const {
return 1.0 * previousRpmValue / rpmValue; return 1.0 * previousRpmValue / rpmValue;
} }
bool RpmCalculator::isStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { bool RpmCalculator::isStopped() const {
// Spinning-up with zero RPM means that the engine is not ready yet, and is treated as 'stopped'. // Spinning-up with zero RPM means that the engine is not ready yet, and is treated as 'stopped'.
return state == STOPPED || (state == SPINNING_UP && rpmValue == 0); return state == STOPPED || (state == SPINNING_UP && rpmValue == 0);
} }
bool RpmCalculator::isCranking(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { bool RpmCalculator::isCranking() const {
// Spinning-up with non-zero RPM is suitable for all engine math, as good as cranking // Spinning-up with non-zero RPM is suitable for all engine math, as good as cranking
return state == CRANKING || (state == SPINNING_UP && rpmValue > 0); return state == CRANKING || (state == SPINNING_UP && rpmValue > 0);
} }
bool RpmCalculator::isSpinningUp(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { bool RpmCalculator::isSpinningUp() const {
return state == SPINNING_UP; return state == SPINNING_UP;
} }
@ -71,7 +71,7 @@ uint32_t RpmCalculator::getRevolutionCounterSinceStart(void) const {
* See NOISY_RPM * See NOISY_RPM
*/ */
// todo: migrate to float return result or add a float version? this would have with calculations // todo: migrate to float return result or add a float version? this would have with calculations
int RpmCalculator::getRpm(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { int RpmCalculator::getRpm() const {
#if !EFI_PROD_CODE #if !EFI_PROD_CODE
if (mockRpm != MOCK_UNDEFINED) { if (mockRpm != MOCK_UNDEFINED) {
return mockRpm; return mockRpm;
@ -87,7 +87,7 @@ EXTERN_ENGINE;
static Logging * logger; static Logging * logger;
RpmCalculator::RpmCalculator() : RpmCalculator::RpmCalculator() :
rpmSensor(SensorType::Rpm, 0) StoredValueSensor(SensorType::Rpm, 0)
{ {
#if !EFI_PROD_CODE #if !EFI_PROD_CODE
mockRpm = MOCK_UNDEFINED; mockRpm = MOCK_UNDEFINED;
@ -102,14 +102,14 @@ RpmCalculator::RpmCalculator() :
/** /**
* @return true if there was a full shaft revolution within the last second * @return true if there was a full shaft revolution within the last second
*/ */
bool RpmCalculator::isRunning(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { bool RpmCalculator::isRunning() const {
return state == RUNNING; return state == RUNNING;
} }
/** /**
* @return true if engine is spinning (cranking or running) * @return true if engine is spinning (cranking or running)
*/ */
bool RpmCalculator::checkIfSpinning(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) const { bool RpmCalculator::checkIfSpinning(efitick_t nowNt) const {
if (ENGINE(needToStopEngine(nowNt))) { if (ENGINE(needToStopEngine(nowNt))) {
return false; return false;
} }
@ -130,18 +130,17 @@ bool RpmCalculator::checkIfSpinning(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUF
return true; return true;
} }
void RpmCalculator::assignRpmValue(float floatRpmValue DECLARE_ENGINE_PARAMETER_SUFFIX) { void RpmCalculator::assignRpmValue(float floatRpmValue) {
previousRpmValue = rpmValue; previousRpmValue = rpmValue;
// we still persist integer RPM! todo: figure out the next steps // we still persist integer RPM! todo: figure out the next steps
rpmValue = floatRpmValue; rpmValue = floatRpmValue;
if (!CONFIG(consumeObdSensors)) {
rpmSensor.Register();
}
if (rpmValue <= 0) { if (rpmValue <= 0) {
oneDegreeUs = NAN; oneDegreeUs = NAN;
invalidate();
} else { } else {
setValidValue(floatRpmValue, 0); // 0 for current time since RPM sensor never times out
// here it's really important to have more precise float RPM value, see #796 // here it's really important to have more precise float RPM value, see #796
oneDegreeUs = getOneDegreeTimeUs(floatRpmValue); oneDegreeUs = getOneDegreeTimeUs(floatRpmValue);
if (previousRpmValue == 0) { if (previousRpmValue == 0) {
@ -154,8 +153,8 @@ void RpmCalculator::assignRpmValue(float floatRpmValue DECLARE_ENGINE_PARAMETER_
} }
} }
void RpmCalculator::setRpmValue(float value DECLARE_ENGINE_PARAMETER_SUFFIX) { void RpmCalculator::setRpmValue(float value) {
assignRpmValue(value PASS_ENGINE_PARAMETER_SUFFIX); assignRpmValue(value);
spinning_state_e oldState = state; spinning_state_e oldState = state;
// Change state // Change state
if (rpmValue == 0) { if (rpmValue == 0) {
@ -198,31 +197,31 @@ uint32_t RpmCalculator::getRevolutionCounterM(void) const {
return revolutionCounterSinceBoot; return revolutionCounterSinceBoot;
} }
void RpmCalculator::setStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void RpmCalculator::setStopped() {
revolutionCounterSinceStart = 0; revolutionCounterSinceStart = 0;
if (rpmValue != 0) { if (rpmValue != 0) {
assignRpmValue(0 PASS_ENGINE_PARAMETER_SUFFIX); assignRpmValue(0);
scheduleMsg(logger, "engine stopped"); scheduleMsg(logger, "engine stopped");
} }
state = STOPPED; state = STOPPED;
} }
void RpmCalculator::setStopSpinning(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void RpmCalculator::setStopSpinning() {
isSpinning = false; isSpinning = false;
setStopped(PASS_ENGINE_PARAMETER_SIGNATURE); setStopped();
} }
void RpmCalculator::setSpinningUp(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { void RpmCalculator::setSpinningUp(efitick_t nowNt) {
if (!CONFIG(isFasterEngineSpinUpEnabled)) if (!CONFIG(isFasterEngineSpinUpEnabled))
return; return;
// Only a completely stopped and non-spinning engine can enter the spinning-up state. // Only a completely stopped and non-spinning engine can enter the spinning-up state.
if (isStopped(PASS_ENGINE_PARAMETER_SIGNATURE) && !isSpinning) { if (isStopped() && !isSpinning) {
state = SPINNING_UP; state = SPINNING_UP;
engine->triggerCentral.triggerState.spinningEventIndex = 0; engine->triggerCentral.triggerState.spinningEventIndex = 0;
isSpinning = true; isSpinning = true;
} }
// update variables needed by early instant RPM calc. // update variables needed by early instant RPM calc.
if (isSpinningUp(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (isSpinningUp()) {
engine->triggerCentral.triggerState.setLastEventTimeForInstantRpm(nowNt PASS_ENGINE_PARAMETER_SUFFIX); engine->triggerCentral.triggerState.setLastEventTimeForInstantRpm(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
} }
/** /**
@ -245,7 +244,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
RpmCalculator *rpmState = &engine->rpmCalculator; RpmCalculator *rpmState = &engine->rpmCalculator;
if (index == 0) { if (index == 0) {
bool hadRpmRecently = rpmState->checkIfSpinning(nowNt PASS_ENGINE_PARAMETER_SUFFIX); bool hadRpmRecently = rpmState->checkIfSpinning(nowNt);
if (hadRpmRecently) { if (hadRpmRecently) {
efitick_t diffNt = nowNt - rpmState->lastRpmEventTimeNt; efitick_t diffNt = nowNt - rpmState->lastRpmEventTimeNt;
@ -257,11 +256,11 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
* *
*/ */
if (diffNt == 0) { if (diffNt == 0) {
rpmState->setRpmValue(NOISY_RPM PASS_ENGINE_PARAMETER_SUFFIX); rpmState->setRpmValue(NOISY_RPM);
} else { } else {
int mult = (int)getEngineCycle(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE)) / 360; int mult = (int)getEngineCycle(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE)) / 360;
float rpm = 60.0 * NT_PER_SECOND * mult / diffNt; float rpm = 60.0 * NT_PER_SECOND * mult / diffNt;
rpmState->setRpmValue(rpm > UNREALISTIC_RPM ? NOISY_RPM : rpm PASS_ENGINE_PARAMETER_SUFFIX); rpmState->setRpmValue(rpm > UNREALISTIC_RPM ? NOISY_RPM : rpm);
} }
} }
rpmState->onNewEngineCycle(); rpmState->onNewEngineCycle();
@ -279,7 +278,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
} }
#endif /* EFI_SENSOR_CHART */ #endif /* EFI_SENSOR_CHART */
if (rpmState->isSpinningUp(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (rpmState->isSpinningUp()) {
// we are here only once trigger is synchronized for the first time // we are here only once trigger is synchronized for the first time
// while transitioning from 'spinning' to 'running' // while transitioning from 'spinning' to 'running'
// Replace 'normal' RPM with instant RPM for the initial spin-up period // Replace 'normal' RPM with instant RPM for the initial spin-up period
@ -289,7 +288,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
&prevIndex, nowNt PASS_ENGINE_PARAMETER_SUFFIX); &prevIndex, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
// validate instant RPM - we shouldn't skip the cranking state // validate instant RPM - we shouldn't skip the cranking state
instantRpm = minI(instantRpm, CONFIG(cranking.rpm) - 1); instantRpm = minI(instantRpm, CONFIG(cranking.rpm) - 1);
rpmState->assignRpmValue(instantRpm PASS_ENGINE_PARAMETER_SUFFIX); rpmState->assignRpmValue(instantRpm);
#if 0 #if 0
scheduleMsg(logger, "** RPM: idx=%d sig=%d iRPM=%d", index, ckpSignalType, instantRpm); scheduleMsg(logger, "** RPM: idx=%d sig=%d iRPM=%d", index, ckpSignalType, instantRpm);
#endif #endif
@ -361,11 +360,18 @@ float getCrankshaftAngleNt(efitick_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
} }
void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
INJECT_ENGINE_REFERENCE(&ENGINE(rpmCalculator));
logger = sharedLogger; logger = sharedLogger;
if (hasFirmwareError()) { if (hasFirmwareError()) {
return; return;
} }
// Only register if not configured to read RPM over OBD2
if (!CONFIG(consumeObdSensors)) {
ENGINE(rpmCalculator).Register();
}
#if !EFI_UNIT_TEST #if !EFI_UNIT_TEST
addTriggerEventListener(tdcMarkCallback, "chart TDC mark", engine); addTriggerEventListener(tdcMarkCallback, "chart TDC mark", engine);
#endif #endif

View File

@ -41,8 +41,10 @@ typedef enum {
RUNNING, RUNNING,
} spinning_state_e; } spinning_state_e;
class RpmCalculator { class RpmCalculator : public StoredValueSensor {
public: public:
DECLARE_ENGINE_PTR;
#if !EFI_PROD_CODE #if !EFI_PROD_CODE
int mockRpm; int mockRpm;
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
@ -50,23 +52,21 @@ public:
/** /**
* Returns true if the engine is not spinning (RPM==0) * Returns true if the engine is not spinning (RPM==0)
*/ */
bool isStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE) const; bool isStopped() const;
/** /**
* Returns true if the engine is spinning up * Returns true if the engine is spinning up
*/ */
bool isSpinningUp(DECLARE_ENGINE_PARAMETER_SIGNATURE) const; bool isSpinningUp() const;
/** /**
* Returns true if the engine is cranking OR spinning up * Returns true if the engine is cranking OR spinning up
*/ */
bool isCranking(DECLARE_ENGINE_PARAMETER_SIGNATURE) const; bool isCranking() const;
/** /**
* Returns true if the engine is running and not cranking * Returns true if the engine is running and not cranking
*/ */
bool isRunning(DECLARE_ENGINE_PARAMETER_SIGNATURE) const; bool isRunning() const;
bool checkIfSpinning(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) const; bool checkIfSpinning(efitick_t nowNt) const;
StoredValueSensor rpmSensor;
/** /**
* This accessor is used in unit-tests. * This accessor is used in unit-tests.
@ -76,28 +76,28 @@ public:
/** /**
* Should be called on every trigger event when the engine is just starting to spin up. * Should be called on every trigger event when the engine is just starting to spin up.
*/ */
void setSpinningUp(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); void setSpinningUp(efitick_t nowNt );
/** /**
* Called if the synchronization is lost due to a trigger timeout. * Called if the synchronization is lost due to a trigger timeout.
*/ */
void setStopSpinning(DECLARE_ENGINE_PARAMETER_SIGNATURE); void setStopSpinning();
/** /**
* Just a getter for rpmValue * Just a getter for rpmValue
* Also handles mockRpm if not EFI_PROD_CODE * Also handles mockRpm if not EFI_PROD_CODE
*/ */
int getRpm(DECLARE_ENGINE_PARAMETER_SIGNATURE) const; int getRpm() const;
/** /**
* This method is invoked once per engine cycle right after we calculate new RPM value * This method is invoked once per engine cycle right after we calculate new RPM value
*/ */
void onNewEngineCycle(); void onNewEngineCycle();
uint32_t getRevolutionCounterM(void) const; uint32_t getRevolutionCounterM(void) const;
void setRpmValue(float value DECLARE_ENGINE_PARAMETER_SUFFIX); void setRpmValue(float value);
/** /**
* The same as setRpmValue() but without state change. * The same as setRpmValue() but without state change.
* We need this to be public because of calling rpmState->assignRpmValue() from rpmShaftPositionCallback() * We need this to be public because of calling rpmState->assignRpmValue() from rpmShaftPositionCallback()
*/ */
void assignRpmValue(float value DECLARE_ENGINE_PARAMETER_SUFFIX); void assignRpmValue(float value);
uint32_t getRevolutionCounterSinceStart(void) const; uint32_t getRevolutionCounterSinceStart(void) const;
/** /**
* RPM rate of change between current RPM and RPM measured during previous engine cycle * RPM rate of change between current RPM and RPM measured during previous engine cycle
@ -114,6 +114,11 @@ public:
*/ */
volatile floatus_t oneDegreeUs = NAN; volatile floatus_t oneDegreeUs = NAN;
volatile efitick_t lastRpmEventTimeNt = 0; volatile efitick_t lastRpmEventTimeNt = 0;
protected:
// Print sensor info - current RPM state
void showInfo(Logging* logger, const char* sensorName) const override;
private: private:
/** /**
* Sometimes we cannot afford to call isRunning() and the value is good enough * Sometimes we cannot afford to call isRunning() and the value is good enough
@ -123,7 +128,7 @@ private:
/** /**
* Should be called once we've realized engine is not spinning any more. * Should be called once we've realized engine is not spinning any more.
*/ */
void setStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE); void setStopped();
/** /**
* This counter is incremented with each revolution of one of the shafts. Could be * This counter is incremented with each revolution of one of the shafts. Could be
@ -145,7 +150,7 @@ private:
}; };
// Just a getter for rpmValue which also handles mockRpm if not EFI_PROD_CODE // Just a getter for rpmValue which also handles mockRpm if not EFI_PROD_CODE
#define GET_RPM() ( ENGINE(rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) ) #define GET_RPM() ( ENGINE(rpmCalculator.getRpm()) )
#define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM) #define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM)

View File

@ -47,7 +47,7 @@ static bool shouldCorrect(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} }
// Don't correct if not running // Don't correct if not running
if (!ENGINE(rpmCalculator).isRunning(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (!ENGINE(rpmCalculator).isRunning()) {
return false; return false;
} }

View File

@ -112,7 +112,7 @@ static floatms_t getCrankingSparkDwell(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT #if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
float dwellMs; float dwellMs;
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (ENGINE(rpmCalculator).isCranking()) {
dwellMs = getCrankingSparkDwell(PASS_ENGINE_PARAMETER_SIGNATURE); dwellMs = getCrankingSparkDwell(PASS_ENGINE_PARAMETER_SIGNATURE);
} else { } else {
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(rpm), "invalid rpm", NAN); efiAssert(CUSTOM_ERR_ASSERT, !cisnan(rpm), "invalid rpm", NAN);
@ -378,7 +378,7 @@ ignition_mode_e getCurrentIgnitionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
ignition_mode_e ignitionMode = CONFIG(ignitionMode); ignition_mode_e ignitionMode = CONFIG(ignitionMode);
#if EFI_SHAFT_POSITION_INPUT #if EFI_SHAFT_POSITION_INPUT
// In spin-up cranking mode we don't have full phase sync. info yet, so wasted spark mode is better // In spin-up cranking mode we don't have full phase sync. info yet, so wasted spark mode is better
if (ignitionMode == IM_INDIVIDUAL_COILS && ENGINE(rpmCalculator.isSpinningUp(PASS_ENGINE_PARAMETER_SIGNATURE))) if (ignitionMode == IM_INDIVIDUAL_COILS && ENGINE(rpmCalculator.isSpinningUp()))
ignitionMode = IM_WASTED_SPARK; ignitionMode = IM_WASTED_SPARK;
#endif /* EFI_SHAFT_POSITION_INPUT */ #endif /* EFI_SHAFT_POSITION_INPUT */
return ignitionMode; return ignitionMode;

View File

@ -2,6 +2,7 @@
#include "proxy_sensor.h" #include "proxy_sensor.h"
#include "functional_sensor.h" #include "functional_sensor.h"
#include "redundant_sensor.h" #include "redundant_sensor.h"
#include "rpm_calculator.h"
#include "linear_func.h" #include "linear_func.h"
#include "resistance_func.h" #include "resistance_func.h"
#include "thermistor_func.h" #include "thermistor_func.h"
@ -35,6 +36,16 @@ void RedundantSensor::showInfo(Logging* logger, const char* sensorName) const {
scheduleMsg(logger, "Sensor \"%s\" is redundant combining \"%s\" and \"%s\"", sensorName, getSensorName(m_first), getSensorName(m_second)); scheduleMsg(logger, "Sensor \"%s\" is redundant combining \"%s\" and \"%s\"", sensorName, getSensorName(m_first), getSensorName(m_second));
} }
void RpmCalculator::showInfo(Logging* logger, const char* sensorName) const {
scheduleMsg(logger, "RPM sensor: stopped: %d spinning up: %d cranking: %d running: %d rpm: %f",
isStopped(),
isSpinningUp(),
isCranking(),
isRunning(),
get().value_or(0)
);
}
void LinearFunc::showInfo(Logging* logger, float testRawValue) const { void LinearFunc::showInfo(Logging* logger, float testRawValue) const {
scheduleMsg(logger, " Linear function slope: %.2f offset: %.2f min: %.1f max: %.1f", m_a, m_b, m_minOutput, m_maxOutput); scheduleMsg(logger, " Linear function slope: %.2f offset: %.2f min: %.1f max: %.1f", m_a, m_b, m_minOutput, m_maxOutput);
const auto [valid, value] = convert(testRawValue); const auto [valid, value] = convert(testRawValue);

View File

@ -46,17 +46,13 @@ public:
return value; return value;
} }
void showInfo(Logging* logger, const char* sensorName) const override { protected:
// todo: just print name and value?
}
StoredValueSensor(SensorType type, efitick_t timeoutNt) StoredValueSensor(SensorType type, efitick_t timeoutNt)
: Sensor(type) : Sensor(type)
, m_timeoutPeriod(timeoutNt) , m_timeoutPeriod(timeoutNt)
{ {
} }
protected:
// Invalidate the stored value. // Invalidate the stored value.
void invalidate() { void invalidate() {
m_isValid = false; m_isValid = false;

View File

@ -421,7 +421,7 @@ static bool cjStartSpi(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
static bool cj125periodic(CJ125 *instance DECLARE_ENGINE_PARAMETER_SUFFIX) { static bool cj125periodic(CJ125 *instance DECLARE_ENGINE_PARAMETER_SUFFIX) {
{ {
efitick_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
bool isStopped = engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE); bool isStopped = engine->rpmCalculator.isStopped();
cjUpdateAnalogValues(); cjUpdateAnalogValues();

View File

@ -50,7 +50,7 @@ void StepperMotor::ThreadTask() {
waitForSlowAdc(); waitForSlowAdc();
#endif #endif
#if EFI_SHAFT_POSITION_INPUT #if EFI_SHAFT_POSITION_INPUT
bool isRunning = engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE); bool isRunning = engine->rpmCalculator.isRunning();
#else #else
bool isRunning = false; bool isRunning = false;
#endif /* EFI_SHAFT_POSITION_INPUT */ #endif /* EFI_SHAFT_POSITION_INPUT */

View File

@ -17,7 +17,7 @@ TEST(fuel, testTpsAccelEnrichmentMath) {
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996); WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
engine->rpmCalculator.setRpmValue(600 PASS_ENGINE_PARAMETER_SUFFIX); engine->rpmCalculator.setRpmValue(600);
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE); engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
engine->tpsAccelEnrichment.setLength(4); engine->tpsAccelEnrichment.setLength(4);
@ -107,7 +107,7 @@ TEST(fuel, testAccelEnrichmentFractionalTps) {
Logging logger; Logging logger;
initAccelEnrichment(&logger PASS_ENGINE_PARAMETER_SUFFIX); initAccelEnrichment(&logger PASS_ENGINE_PARAMETER_SUFFIX);
engine->rpmCalculator.setRpmValue(600 PASS_ENGINE_PARAMETER_SUFFIX); engine->rpmCalculator.setRpmValue(600);
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE); engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
engine->tpsAccelEnrichment.setLength(2); engine->tpsAccelEnrichment.setLength(2);

View File

@ -15,7 +15,7 @@ TEST(fuel, testWallWettingEnrichmentMath) {
engineConfiguration->wwaeTau = 1.0f; engineConfiguration->wwaeTau = 1.0f;
engineConfiguration->wwaeBeta = 0.40f; engineConfiguration->wwaeBeta = 0.40f;
engine->rpmCalculator.setRpmValue(3000 PASS_ENGINE_PARAMETER_SUFFIX); engine->rpmCalculator.setRpmValue(3000);
WallFuel wallFuel; WallFuel wallFuel;

View File

@ -205,7 +205,7 @@ TEST(misc, testGetCoilDutyCycleIssue977) {
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996); WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
int rpm = 2000; int rpm = 2000;
engine->rpmCalculator.setRpmValue(rpm PASS_ENGINE_PARAMETER_SUFFIX); engine->rpmCalculator.setRpmValue(rpm);
ASSERT_EQ( 4, getSparkDwell(rpm PASS_ENGINE_PARAMETER_SUFFIX)) << "running dwell"; ASSERT_EQ( 4, getSparkDwell(rpm PASS_ENGINE_PARAMETER_SUFFIX)) << "running dwell";
ASSERT_NEAR( 26.66666, getCoilDutyCycle(rpm PASS_ENGINE_PARAMETER_SUFFIX), 0.0001); ASSERT_NEAR( 26.66666, getCoilDutyCycle(rpm PASS_ENGINE_PARAMETER_SUFFIX), 0.0001);
@ -224,13 +224,13 @@ TEST(misc, testFordAspire) {
engineConfiguration->crankingTimingAngle = 31; engineConfiguration->crankingTimingAngle = 31;
engineConfiguration->useConstantDwellDuringCranking = false; engineConfiguration->useConstantDwellDuringCranking = false;
engine->rpmCalculator.setRpmValue(200 PASS_ENGINE_PARAMETER_SUFFIX); engine->rpmCalculator.setRpmValue(200);
assertEqualsM("cranking dwell", 54.166670, getSparkDwell(200 PASS_ENGINE_PARAMETER_SUFFIX)); assertEqualsM("cranking dwell", 54.166670, getSparkDwell(200 PASS_ENGINE_PARAMETER_SUFFIX));
int rpm = 2000; int rpm = 2000;
engine->rpmCalculator.setRpmValue(rpm PASS_ENGINE_PARAMETER_SUFFIX); engine->rpmCalculator.setRpmValue(rpm);
ASSERT_EQ( 4, getSparkDwell(rpm PASS_ENGINE_PARAMETER_SUFFIX)) << "running dwell"; ASSERT_EQ( 4, getSparkDwell(rpm PASS_ENGINE_PARAMETER_SUFFIX)) << "running dwell";
engine->rpmCalculator.setRpmValue(6000 PASS_ENGINE_PARAMETER_SUFFIX); engine->rpmCalculator.setRpmValue(6000);
assertEqualsM("higher rpm dwell", 3.25, getSparkDwell(6000 PASS_ENGINE_PARAMETER_SUFFIX)); assertEqualsM("higher rpm dwell", 3.25, getSparkDwell(6000 PASS_ENGINE_PARAMETER_SUFFIX));
} }
@ -353,7 +353,7 @@ TEST(misc, testRpmCalculator) {
assertEqualsM("injection angle", 31.365, ie0->injectionStart.angleOffsetFromTriggerEvent); assertEqualsM("injection angle", 31.365, ie0->injectionStart.angleOffsetFromTriggerEvent);
eth.firePrimaryTriggerRise(); eth.firePrimaryTriggerRise();
ASSERT_EQ(1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)); ASSERT_EQ(1500, eth.engine.rpmCalculator.getRpm());
assertEqualsM("dwell", 4.5, engine->engineState.dwellAngle); assertEqualsM("dwell", 4.5, engine->engineState.dwellAngle);
assertEqualsM("fuel #2", 4.5450, engine->injectionDuration); assertEqualsM("fuel #2", 4.5450, engine->injectionDuration);
@ -407,7 +407,7 @@ TEST(misc, testRpmCalculator) {
assertEqualsM("dwell", 4.5, eth.engine.engineState.dwellAngle); assertEqualsM("dwell", 4.5, eth.engine.engineState.dwellAngle);
assertEqualsM("fuel #3", 4.5450, eth.engine.injectionDuration); assertEqualsM("fuel #3", 4.5450, eth.engine.injectionDuration);
ASSERT_EQ(1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)); ASSERT_EQ(1500, eth.engine.rpmCalculator.getRpm());
eth.assertInjectorUpEvent("ev 0/2", 0, -4849, 2); eth.assertInjectorUpEvent("ev 0/2", 0, -4849, 2);
@ -1283,7 +1283,7 @@ TEST(big, testMissedSpark299) {
printf("*************************************************** testMissedSpark299 start\r\n"); printf("*************************************************** testMissedSpark299 start\r\n");
ASSERT_EQ(3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)); ASSERT_EQ(3000, eth.engine.rpmCalculator.getRpm());
setWholeTimingTable(3); setWholeTimingTable(3);
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE); eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);