parent
6d72805a56
commit
268a5c7964
|
@ -570,8 +570,8 @@ float Engine::getTimeIgnitionSeconds(void) const {
|
|||
return numSeconds;
|
||||
}
|
||||
|
||||
injection_mode_e Engine::getCurrentInjectionMode() {
|
||||
return rpmCalculator.isCranking() ? engineConfiguration->crankingInjectionMode : engineConfiguration->injectionMode;
|
||||
injection_mode_e getCurrentInjectionMode() {
|
||||
return getEngineRotationState()->isCranking() ? engineConfiguration->crankingInjectionMode : engineConfiguration->injectionMode;
|
||||
}
|
||||
|
||||
// see also in TunerStudio project '[doesTriggerImplyOperationMode] tag
|
||||
|
|
|
@ -246,7 +246,6 @@ public:
|
|||
#endif
|
||||
|
||||
void setConfig();
|
||||
injection_mode_e getCurrentInjectionMode();
|
||||
|
||||
LocalVersionHolder versionForConfigurationListeners;
|
||||
LocalVersionHolder auxParametersVersion;
|
||||
|
|
|
@ -242,7 +242,7 @@ int getNumberOfInjections(injection_mode_e mode) {
|
|||
}
|
||||
|
||||
float getInjectionModeDurationMultiplier() {
|
||||
injection_mode_e mode = engine->getCurrentInjectionMode();
|
||||
injection_mode_e mode = getCurrentInjectionMode();
|
||||
|
||||
switch (mode) {
|
||||
case IM_SIMULTANEOUS: {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "rpm_calculator_api.h"
|
||||
#include "event_registry.h"
|
||||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
|
@ -114,7 +115,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i) {
|
|||
return false;
|
||||
}
|
||||
|
||||
injection_mode_e mode = engine->getCurrentInjectionMode();
|
||||
injection_mode_e mode = getCurrentInjectionMode();
|
||||
|
||||
// We need two outputs if:
|
||||
// - we are running batch fuel, and have "use two wire batch" enabled
|
||||
|
|
|
@ -4,9 +4,14 @@
|
|||
|
||||
#include "rusefi_types.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
class EngineRotationState {
|
||||
public:
|
||||
virtual floatus_t getOneDegreeUs() = 0;
|
||||
virtual bool isCranking() const = 0;
|
||||
};
|
||||
|
||||
EngineRotationState * getEngineRotationState();
|
||||
|
||||
injection_mode_e getCurrentInjectionMode();
|
||||
|
|
|
@ -27,7 +27,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
eth.fireRise(1000 /*ms*/);
|
||||
|
||||
// check if it's true
|
||||
ASSERT_EQ(IM_SEQUENTIAL, engine->getCurrentInjectionMode());
|
||||
ASSERT_EQ(IM_SEQUENTIAL, getCurrentInjectionMode());
|
||||
ASSERT_EQ(IM_WASTED_SPARK, getCurrentIgnitionMode());
|
||||
// check if the engine has the right state
|
||||
ASSERT_EQ(SPINNING_UP, engine->rpmCalculator.getState());
|
||||
|
@ -48,7 +48,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// two simultaneous injections
|
||||
ASSERT_EQ(4, engine->executor.size()) << "plain#2";
|
||||
// test if they are simultaneous
|
||||
ASSERT_EQ(IM_SIMULTANEOUS, engine->getCurrentInjectionMode());
|
||||
ASSERT_EQ(IM_SIMULTANEOUS, getCurrentInjectionMode());
|
||||
// test if ignition mode is temporary changed to wasted spark, if set to individual coils
|
||||
ASSERT_EQ(IM_WASTED_SPARK, getCurrentIgnitionMode());
|
||||
// check real events
|
||||
|
@ -68,7 +68,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// check RPM
|
||||
ASSERT_EQ( 200, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#2";
|
||||
// test if they are simultaneous in cranking mode too
|
||||
ASSERT_EQ(IM_SIMULTANEOUS, engine->getCurrentInjectionMode());
|
||||
ASSERT_EQ(IM_SIMULTANEOUS, getCurrentInjectionMode());
|
||||
// Should still be in wasted spark since we don't have cam sync yet
|
||||
ASSERT_EQ(IM_WASTED_SPARK, getCurrentIgnitionMode());
|
||||
// two simultaneous injections
|
||||
|
@ -92,7 +92,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// check RPM
|
||||
ASSERT_EQ( 1000, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#3";
|
||||
// check if the injection mode is back to sequential now
|
||||
ASSERT_EQ(IM_SEQUENTIAL, engine->getCurrentInjectionMode());
|
||||
ASSERT_EQ(IM_SEQUENTIAL, getCurrentInjectionMode());
|
||||
// 4 sequential injections for the full cycle
|
||||
ASSERT_EQ( 8, engine->executor.size()) << "plain#3";
|
||||
|
||||
|
|
Loading…
Reference in New Issue