refactoring around GET_RPM
This commit is contained in:
parent
7a20bda66f
commit
53b5c08c0a
|
@ -185,7 +185,7 @@ static void printSensors(Logging *log, bool fileFormat) {
|
|||
|
||||
int rpm = 0;
|
||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
||||
rpm = getRpmE(engine);
|
||||
rpm = GET_RPM();
|
||||
reportSensorI(log, fileFormat, "rpm", "RPM", rpm); // log column 2
|
||||
#endif
|
||||
// why do we still send data into console in text mode?
|
||||
|
@ -535,7 +535,7 @@ static void showFuelInfo2(float rpm, float engineLoad) {
|
|||
|
||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
||||
static void showFuelInfo(void) {
|
||||
showFuelInfo2((float) getRpmE(engine), getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
showFuelInfo2((float) GET_RPM(), getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -660,7 +660,7 @@ extern HIP9011 instance;
|
|||
|
||||
void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
||||
int rpm = getRpmE(engine);
|
||||
int rpm = GET_RPM();
|
||||
#else /* EFI_SHAFT_POSITION_INPUT */
|
||||
int rpm = 0;
|
||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||
|
|
|
@ -100,7 +100,7 @@ floatms_t WallFuel::adjust(int injectorIndex, floatms_t M_des DECLARE_ENGINE_PAR
|
|||
}
|
||||
|
||||
// Ignore really slow RPM
|
||||
int rpm = getRpmE(engine);
|
||||
int rpm = GET_RPM();
|
||||
if(rpm < 100)
|
||||
{
|
||||
return M_des;
|
||||
|
|
|
@ -125,7 +125,7 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
* See also periodicFastCallback
|
||||
*/
|
||||
void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
int rpm = rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
int rpm = GET_RPM();
|
||||
isEngineChartEnabled = CONFIG(isEngineChartEnabled) && rpm < CONFIG(engineSnifferRpmThreshold);
|
||||
sensorChartMode = rpm < CONFIG(sensorSnifferRpmThreshold) ? CONFIGB(sensorChartMode) : SC_OFF;
|
||||
|
||||
|
@ -334,7 +334,7 @@ void Engine::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
engineState.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
engine->m.beforeFuelCalc = GET_TIMESTAMP();
|
||||
int rpm = rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
int rpm = GET_RPM();
|
||||
ENGINE(injectionDuration) = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->m.fuelCalcTime = GET_TIMESTAMP() - engine->m.beforeFuelCalc;
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ void StartupFuelPumping::setPumpsCounter(int newValue) {
|
|||
}
|
||||
|
||||
void StartupFuelPumping::update(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
if (engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) == 0) {
|
||||
if (GET_RPM() == 0) {
|
||||
bool isTpsAbove50 = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) >= 50;
|
||||
|
||||
if (this->isTpsAbove50 != isTpsAbove50) {
|
||||
|
|
|
@ -307,7 +307,7 @@ floatms_t getBaseTableFuel(int rpm, float engineLoad) {
|
|||
|
||||
float getBaroCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
if (hasBaroSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||
return baroCorrMap.getValue(getRpmE(engine), getBaroPressure(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
return baroCorrMap.getValue(GET_RPM(), getBaroPressure(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ static percent_t automaticIdleController() {
|
|||
|
||||
|
||||
// check if within the dead zone
|
||||
int rpm = getRpmE(engine);
|
||||
int rpm = GET_RPM();
|
||||
if (absI(rpm - targetRpm) <= CONFIG(idlePidRpmDeadZone)) {
|
||||
idleState = RPM_DEAD_ZONE;
|
||||
// current RPM is close enough, no need to change anything
|
||||
|
|
|
@ -212,7 +212,7 @@ static void showLine(lcd_line_e line, int screenY) {
|
|||
case LL_RPM:
|
||||
{
|
||||
int seconds = minI(9999, getTimeNowSeconds());
|
||||
lcdPrintf("RPM %d %d ", getRpmE(engine), seconds);
|
||||
lcdPrintf("RPM %d %d ", GET_RPM(), seconds);
|
||||
}
|
||||
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
|
||||
{
|
||||
|
@ -372,7 +372,7 @@ void updateHD44780lcd(void) {
|
|||
// }
|
||||
// lcd_HD44780_set_position(0, 10);
|
||||
//
|
||||
// char * ptr = itoa10(buffer, getRpmE(engine));
|
||||
// char * ptr = itoa10(buffer, GET_RPM());
|
||||
// ptr[0] = 0;
|
||||
// int len = ptr - buffer;
|
||||
// for (int i = 0; i < 6 - len; i++) {
|
||||
|
|
|
@ -147,7 +147,7 @@ static void handleGetDataRequest(CANRxFrame *rx) {
|
|||
break;
|
||||
case PID_RPM:
|
||||
scheduleMsg(&logger, "Got RPM request");
|
||||
obdSendValue(1, pid, 2, getRpmE(engine) * 4.0f); // rotation/min. (A*256+B)/4
|
||||
obdSendValue(1, pid, 2, GET_RPM() * 4.0f); // rotation/min. (A*256+B)/4
|
||||
break;
|
||||
case PID_SPEED:
|
||||
scheduleMsg(&logger, "Got speed request");
|
||||
|
|
|
@ -615,7 +615,7 @@ static void showTriggerHistogram(void) {
|
|||
|
||||
static void showMainInfo(Engine *engine) {
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
int rpm = engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
int rpm = GET_RPM();
|
||||
float el = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
scheduleMsg(logger, "rpm %d engine_load %.2f", rpm, el);
|
||||
scheduleMsg(logger, "fuel %.2fms timing %.2f", getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX), engine->engineState.timingAdvance);
|
||||
|
|
|
@ -296,7 +296,7 @@ static char rpmBuffer[_MAX_FILLER];
|
|||
* digital sniffer.
|
||||
*/
|
||||
static void onTdcCallback(void) {
|
||||
itoa10(rpmBuffer, getRpmE(engine));
|
||||
itoa10(rpmBuffer, GET_RPM());
|
||||
addEngineSnifferEvent(TOP_DEAD_CENTER_MESSAGE, (char* ) rpmBuffer);
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ static void tdcMarkCallback(trigger_event_e ckpSignalType,
|
|||
bool isTriggerSynchronizationPoint = index0 == 0;
|
||||
if (isTriggerSynchronizationPoint && ENGINE(isEngineChartEnabled)) {
|
||||
int revIndex2 = engine->rpmCalculator.getRevolutionCounter() % 2;
|
||||
int rpm = ENGINE(rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
int rpm = GET_RPM();
|
||||
// todo: use tooth event-based scheduling, not just time-based scheduling
|
||||
if (isValidRpm(rpm)) {
|
||||
scheduleByAngle(rpm, &tdcScheduler[revIndex2], tdcPosition(),
|
||||
|
@ -337,7 +337,7 @@ float getCrankshaftAngleNt(efitime_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
* compiler is not smart enough to figure out that "A / ( B / C)" could be optimized into
|
||||
* "A * C / B" in order to replace a slower division with a faster multiplication.
|
||||
*/
|
||||
int rpm = engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
int rpm = GET_RPM();
|
||||
return rpm == 0 ? NAN : timeSinceZeroAngleNt / getOneDegreeTimeNt(rpm);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
/**
|
||||
* Just a getter for rpmValue
|
||||
* Also hangles mockRpm if not EFI_PROD_CODE
|
||||
* Also handles mockRpm if not EFI_PROD_CODE
|
||||
*/
|
||||
int getRpm(DECLARE_ENGINE_PARAMETER_SIGNATURE) const;
|
||||
/**
|
||||
|
@ -154,11 +154,10 @@ private:
|
|||
bool isSpinning = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Current RPM
|
||||
*/
|
||||
#define getRpmE(engine) (engine)->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)
|
||||
// Just a getter for rpmValue which also handles mockRpm if not EFI_PROD_CODE
|
||||
#define GET_RPM() ( ENGINE(rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) )
|
||||
|
||||
// simple variable access, theoretically could be faster than getter method but that's a long stretch
|
||||
#define GET_RPM_VALUE ( ENGINE(rpmCalculator.rpmValue) )
|
||||
|
||||
#define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM)
|
||||
|
|
|
@ -243,7 +243,7 @@ static void reportWave(Logging *logging, int index) {
|
|||
appendPrintf(logging, "%s", DELIMETER);
|
||||
|
||||
uint32_t offsetUs = getWaveOffset(index);
|
||||
int rpm = getRpmE(engine);
|
||||
int rpm = GET_RPM();
|
||||
if (rpm != 0) {
|
||||
float oneDegreeUs = getOneDegreeTimeUs(rpm);
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ static void canDashboardBMW(void) {
|
|||
sendCanMessage();
|
||||
|
||||
commonTxInit(CAN_BMW_E46_RPM);
|
||||
setShortValue(&txmsg, (int) (getRpmE(engine) * 6.4), 2);
|
||||
setShortValue(&txmsg, (int) (GET_RPM() * 6.4), 2);
|
||||
sendCanMessage();
|
||||
|
||||
commonTxInit(CAN_BMW_E46_DME2);
|
||||
|
@ -152,7 +152,7 @@ static void canMazdaRX8(void) {
|
|||
|
||||
float kph = getVehicleSpeed();
|
||||
|
||||
setShortValue(&txmsg, SWAP_UINT16(getRpmE(engine) * 4), 0);
|
||||
setShortValue(&txmsg, SWAP_UINT16(GET_RPM() * 4), 0);
|
||||
setShortValue(&txmsg, 0xFFFF, 2);
|
||||
setShortValue(&txmsg, SWAP_UINT16((int )(100 * kph + 10000)), 4);
|
||||
setShortValue(&txmsg, 0, 6);
|
||||
|
@ -177,7 +177,7 @@ static void canMazdaRX8(void) {
|
|||
txmsg.data8[4] = 0x01; //Oil Pressure (not really a gauge)
|
||||
txmsg.data8[5] = 0x00; //check engine light
|
||||
txmsg.data8[6] = 0x00; //Coolant, oil and battery
|
||||
if ((getRpmE(engine)>0) && (engine->sensors.vBatt<13)) {
|
||||
if ((GET_RPM()>0) && (engine->sensors.vBatt<13)) {
|
||||
setTxBit(6, 6); // battery light
|
||||
}
|
||||
if (engine->sensors.clt > 105) {
|
||||
|
@ -192,14 +192,14 @@ static void canDashboardFiat(void) {
|
|||
//Fiat Dashboard
|
||||
commonTxInit(CAN_FIAT_MOTOR_INFO);
|
||||
setShortValue(&txmsg, (int) (engine->sensors.clt - 40), 3); //Coolant Temp
|
||||
setShortValue(&txmsg, getRpmE(engine) / 32, 6); //RPM
|
||||
setShortValue(&txmsg, GET_RPM() / 32, 6); //RPM
|
||||
sendCanMessage();
|
||||
}
|
||||
|
||||
static void canDashboardVAG(void) {
|
||||
//VAG Dashboard
|
||||
commonTxInit(CAN_VAG_RPM);
|
||||
setShortValue(&txmsg, getRpmE(engine) * 4, 2); //RPM
|
||||
setShortValue(&txmsg, GET_RPM() * 4, 2); //RPM
|
||||
sendCanMessage();
|
||||
|
||||
commonTxInit(CAN_VAG_CLT);
|
||||
|
|
|
@ -183,7 +183,7 @@ void EngineTestHelper::applyTriggerShape() {
|
|||
}
|
||||
|
||||
void assertRpm(const char *msg, int expectedRpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
EXPECT_EQ(expectedRpm, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << msg;
|
||||
EXPECT_EQ(expectedRpm, GET_RPM()) << msg;
|
||||
}
|
||||
|
||||
void setupSimpleTestEngineWithMaf(EngineTestHelper *eth, injection_mode_e injectionMode,
|
||||
|
|
|
@ -28,7 +28,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// check if the engine has the right state
|
||||
ASSERT_EQ(STOPPED, engine->rpmCalculator.getState());
|
||||
// check RPM
|
||||
ASSERT_EQ( 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM=0";
|
||||
ASSERT_EQ( 0, GET_RPM()) << "RPM=0";
|
||||
// the queue should be empty, no trigger events yet
|
||||
ASSERT_EQ(0, engine->executor.size()) << "plain#1";
|
||||
|
||||
|
@ -41,7 +41,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// check if the mode is changed
|
||||
ASSERT_EQ(SPINNING_UP, engine->rpmCalculator.getState());
|
||||
// due to isFasterEngineSpinUp=true, we should have already detected RPM!
|
||||
ASSERT_EQ( 300, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "spinning-RPM#1";
|
||||
ASSERT_EQ( 300, GET_RPM()) << "spinning-RPM#1";
|
||||
// two simultaneous injections
|
||||
ASSERT_EQ(4, engine->executor.size()) << "plain#2";
|
||||
// test if they are simultaneous
|
||||
|
@ -63,7 +63,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// check if the mode is changed when fully synched
|
||||
ASSERT_EQ(CRANKING, engine->rpmCalculator.getState());
|
||||
// check RPM
|
||||
ASSERT_EQ( 200, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#2";
|
||||
ASSERT_EQ( 200, GET_RPM()) << "RPM#2";
|
||||
// test if they are simultaneous in cranking mode too
|
||||
ASSERT_EQ(IM_SIMULTANEOUS, engine->getCurrentInjectionMode(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
// test if ignition mode is restored to ind.coils
|
||||
|
@ -84,7 +84,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// check if the mode is now changed to 'running' at higher RPM
|
||||
ASSERT_EQ(RUNNING, engine->rpmCalculator.getState());
|
||||
// check RPM
|
||||
ASSERT_EQ( 1000, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#3";
|
||||
ASSERT_EQ( 1000, GET_RPM()) << "RPM#3";
|
||||
// check if the injection mode is back to sequential now
|
||||
ASSERT_EQ(IM_SEQUENTIAL, engine->getCurrentInjectionMode(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
// 4 sequential injections for the full cycle
|
||||
|
|
|
@ -17,7 +17,7 @@ TEST(big, testSpeedDensity) {
|
|||
eth.applyTriggerShape();
|
||||
|
||||
eth.fireTriggerEvents(36);
|
||||
ASSERT_EQ( 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM";
|
||||
ASSERT_EQ( 1500, GET_RPM()) << "RPM";
|
||||
|
||||
// 427 cubic inches, that's a LOT of engine
|
||||
engineConfiguration->specs.displacement = 6.99728;
|
||||
|
|
|
@ -13,15 +13,15 @@ TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
|||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||
ASSERT_EQ( 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM=0";
|
||||
ASSERT_EQ( 0, GET_RPM()) << "RPM=0";
|
||||
|
||||
eth.fireTriggerEventsWithDuration(/* durationMs */ 200);
|
||||
// still no RPM since need to cycles measure cycle duration
|
||||
ASSERT_EQ( 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "start-RPM#1";
|
||||
ASSERT_EQ( 0, GET_RPM()) << "start-RPM#1";
|
||||
|
||||
|
||||
eth.fireRise(/* delayMs */ 200);
|
||||
ASSERT_EQ( 300, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#2";
|
||||
ASSERT_EQ( 300, GET_RPM()) << "RPM#2";
|
||||
// two simultaneous injections
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
|
||||
|
||||
|
@ -38,7 +38,7 @@ TEST(engine, testStartOfCrankingPrimingPulse) {
|
|||
engineConfiguration->startOfCrankingPrimingPulse = 4;
|
||||
|
||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||
ASSERT_EQ( 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM=0";
|
||||
ASSERT_EQ( 0, GET_RPM()) << "RPM=0";
|
||||
|
||||
// this -70 value comes from CLT error handling code
|
||||
ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT#1";
|
||||
|
|
|
@ -306,7 +306,7 @@ TEST(misc, testRpmCalculator) {
|
|||
engine->sensors.clt = 70; // 'testCltValue' does not give us exact number so we have to hack here. todo: migrate test
|
||||
engine->sensors.iat = 30; // 'testIatValue' does not give us exact number so we have to hack here. todo: migrate test
|
||||
|
||||
ASSERT_EQ(0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ(0, GET_RPM());
|
||||
|
||||
// triggerIndexByAngle update is now fixed! prepareOutputSignals() wasn't reliably called
|
||||
ASSERT_EQ(5, TRIGGER_SHAPE(triggerIndexByAngle[240]));
|
||||
|
@ -314,7 +314,7 @@ TEST(misc, testRpmCalculator) {
|
|||
|
||||
eth.fireTriggerEvents(/* count */ 48);
|
||||
|
||||
ASSERT_EQ( 1500, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM";
|
||||
ASSERT_EQ( 1500, GET_RPM()) << "RPM";
|
||||
ASSERT_EQ( 15, engine->triggerCentral.triggerState.getCurrentIndex()) << "index #1";
|
||||
|
||||
|
||||
|
@ -676,10 +676,10 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
testMafValue = 0;
|
||||
ASSERT_EQ( 0, getMaf(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maf";
|
||||
|
||||
ASSERT_EQ( 3000, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "setTestBug299: RPM";
|
||||
ASSERT_EQ( 3000, GET_RPM()) << "setTestBug299: RPM";
|
||||
|
||||
assertEqualsM("fuel#1", 1.5, engine->injectionDuration);
|
||||
assertEqualsM("duty for maf=0", 7.5, getInjectorDutyCycle(engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
assertEqualsM("duty for maf=0", 7.5, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
testMafValue = 3;
|
||||
ASSERT_EQ( 3, getMaf(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maf";
|
||||
|
@ -708,7 +708,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("fuel#2", 12.5, engine->injectionDuration);
|
||||
assertEqualsM("duty for maf=3", 62.5, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
assertEqualsM("duty for maf=3", 62.5, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#1";
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
|
@ -869,7 +869,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("fuel#3", 17.5, engine->injectionDuration);
|
||||
// duty cycle above 75% is a special use-case because 'special' fuel event overlappes the next normal event in batch mode
|
||||
assertEqualsM("duty for maf=3", 87.5, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
assertEqualsM("duty for maf=3", 87.5, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
|
||||
assertInjectionEvent("#03", &t->elements[0], 0, 0, 315, false);
|
||||
|
@ -987,7 +987,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("Lfuel#2", 17.5, engine->injectionDuration);
|
||||
assertEqualsM("Lduty for maf=3", 87.5, getInjectorDutyCycle(engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
assertEqualsM("Lduty for maf=3", 87.5, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#1";
|
||||
|
@ -1051,7 +1051,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
ASSERT_EQ( 2, engine->injectionDuration) << "Lfuel#4";
|
||||
ASSERT_EQ( 10, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX)) << "Lduty for maf=3";
|
||||
ASSERT_EQ( 10, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX)) << "Lduty for maf=3";
|
||||
|
||||
|
||||
eth.firePrimaryTriggerRise();
|
||||
|
@ -1117,7 +1117,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireRise(20);
|
||||
eth.fireFall(20);
|
||||
|
||||
ASSERT_EQ( 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "testSparkReverseOrderBug319: RPM";
|
||||
ASSERT_EQ( 3000, GET_RPM()) << "testSparkReverseOrderBug319: RPM";
|
||||
|
||||
|
||||
ASSERT_EQ( 7, engine->executor.size()) << "testSparkReverseOrderBug319: queue size";
|
||||
|
@ -1148,7 +1148,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
|
||||
ASSERT_EQ( 545, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#2";
|
||||
ASSERT_EQ( 545, GET_RPM()) << "RPM#2";
|
||||
|
||||
ASSERT_EQ( 0, enginePins.coils[3].outOfOrder) << "out-of-order #3";
|
||||
|
||||
|
@ -1162,7 +1162,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
|
||||
ASSERT_EQ( 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#3";
|
||||
ASSERT_EQ( 3000, GET_RPM()) << "RPM#3";
|
||||
|
||||
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #5 on c4";
|
||||
|
||||
|
@ -1176,7 +1176,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
|
||||
ASSERT_EQ( 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#4";
|
||||
ASSERT_EQ( 3000, GET_RPM()) << "RPM#4";
|
||||
|
||||
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #7";
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ static void testNoiselessDecoderProcedure(EngineTestHelper ð, int errorTolera
|
|||
// check if we're imitating the 60-2 signal correctly
|
||||
ASSERT_EQ( 0, eth.engine.triggerCentral.triggerState.getCurrentIndex()) << "index #1";
|
||||
// check rpm (60secs / (1000us * 60teeth)) = 1000rpm
|
||||
ASSERT_EQ( 1000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "testNoiselessDecoder RPM";
|
||||
ASSERT_EQ( 1000, GET_RPM()) << "testNoiselessDecoder RPM";
|
||||
|
||||
// add noise1 - 1 spike in the middle of the 2nd rising pulse
|
||||
fireNoisyCycle60_2(ð, 2, 1000, 2, 10, 500, 1);
|
||||
|
@ -182,7 +182,7 @@ TEST(big, testNoiselessDecoder) {
|
|||
eth.applyTriggerShape();
|
||||
|
||||
ASSERT_EQ(0, engine->triggerCentral.triggerState.totalTriggerErrorCounter);
|
||||
ASSERT_EQ( 0, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "testNoiselessDecoder RPM";
|
||||
ASSERT_EQ( 0, GET_RPM()) << "testNoiselessDecoder RPM";
|
||||
|
||||
//printTriggerDebug = true;
|
||||
|
||||
|
|
Loading…
Reference in New Issue