refactoring launch
This commit is contained in:
parent
0d5df34f36
commit
05fa6071dd
|
@ -23,9 +23,14 @@ public:
|
|||
bool isInsideSwitchCondition() const;
|
||||
bool isInsideRPMCondition(int rpm) const;
|
||||
bool isLaunchConditionMet(int rpm) const;
|
||||
|
||||
bool isLaunchSparkRpmRetardCondition() const;
|
||||
bool isLaunchFuelRpmRetardCondition() const;
|
||||
|
||||
int retardThresholdRpm;
|
||||
void applyLaunchControlLimiting(bool *limitedSpark, bool *limitedFuel DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
private:
|
||||
bool isLaunchRpmRetardCondition() const;
|
||||
|
||||
Timer m_launchTimer;
|
||||
};
|
||||
|
|
|
@ -416,7 +416,9 @@ void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE
|
|||
#if EFI_LAUNCH_CONTROL
|
||||
if (engine->isLaunchCondition && !limitedSpark && !limitedFuel) {
|
||||
/* in case we are not already on a limited conditions, check launch as well */
|
||||
engine->launchController.applyLaunchControlLimiting(&limitedSpark, &limitedFuel PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
limitedSpark &= engine->launchController.isLaunchSparkRpmRetardCondition();
|
||||
limitedFuel &= engine->launchController.isLaunchFuelRpmRetardCondition();
|
||||
}
|
||||
#endif
|
||||
if (trgEventIndex == 0) {
|
||||
|
|
|
@ -93,7 +93,3 @@ TEST(misc, testIgnitionMapGenerator) {
|
|||
assertEqualsM2("4400", 41.9, getInitialAdvance(4400, 40, 36), 0.1);
|
||||
assertEqualsM2("20@800", 14.2, getInitialAdvance(800, 20, 36), 0.2);
|
||||
}
|
||||
|
||||
float getMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
return engine->mockMapValue;
|
||||
}
|
||||
|
|
|
@ -127,7 +127,6 @@ TEST(LaunchControl, CombinedCondition) {
|
|||
}
|
||||
|
||||
TEST(LaunchControl, CompleteRun) {
|
||||
bool spark, fuel;
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
||||
initLaunchControl(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
@ -152,11 +151,8 @@ TEST(LaunchControl, CompleteRun) {
|
|||
|
||||
|
||||
//check if we have some sort of cut? we should not have at this point
|
||||
spark = false;
|
||||
fuel = false;
|
||||
engine->launchController.applyLaunchControlLimiting(&spark, &fuel PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
EXPECT_FALSE(spark);
|
||||
EXPECT_FALSE(fuel);
|
||||
EXPECT_FALSE(engine->launchController.isLaunchSparkRpmRetardCondition());
|
||||
EXPECT_FALSE(engine->launchController.isLaunchFuelRpmRetardCondition());
|
||||
|
||||
|
||||
engine->rpmCalculator.mockRpm = 3510;
|
||||
|
@ -167,29 +163,22 @@ TEST(LaunchControl, CompleteRun) {
|
|||
//we have a 3 seconds delay to actually enable it!
|
||||
eth.moveTimeForwardAndInvokeEventsSec(1);
|
||||
engine->launchController.update();
|
||||
|
||||
spark = false;
|
||||
fuel = false;
|
||||
engine->launchController.applyLaunchControlLimiting(&spark, &fuel PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
EXPECT_FALSE(spark);
|
||||
EXPECT_FALSE(fuel);
|
||||
EXPECT_FALSE(engine->launchController.isLaunchSparkRpmRetardCondition());
|
||||
EXPECT_FALSE(engine->launchController.isLaunchFuelRpmRetardCondition());
|
||||
|
||||
eth.moveTimeForwardAndInvokeEventsSec(3);
|
||||
engine->launchController.update();
|
||||
spark = false;
|
||||
fuel = false;
|
||||
engine->launchController.applyLaunchControlLimiting(&spark, &fuel PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
EXPECT_TRUE(spark);
|
||||
EXPECT_FALSE(fuel);
|
||||
|
||||
EXPECT_TRUE(engine->launchController.isLaunchSparkRpmRetardCondition());
|
||||
EXPECT_FALSE(engine->launchController.isLaunchFuelRpmRetardCondition());
|
||||
|
||||
Sensor::setMockValue(SensorType::VehicleSpeed, 40.0);
|
||||
engine->launchController.update();
|
||||
spark = false;
|
||||
fuel = false;
|
||||
engine->launchController.applyLaunchControlLimiting(&spark, &fuel PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
EXPECT_FALSE(spark);
|
||||
EXPECT_FALSE(fuel);
|
||||
|
||||
|
||||
EXPECT_FALSE(engine->launchController.isLaunchSparkRpmRetardCondition());
|
||||
EXPECT_FALSE(engine->launchController.isLaunchFuelRpmRetardCondition());
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue