refactoring launch
This commit is contained in:
parent
05fa6071dd
commit
928c673695
|
@ -649,7 +649,7 @@ static void updateFlags() {
|
||||||
tsOutputChannels.isCylinderCleanupActivated = engine->isCylinderCleanupMode;
|
tsOutputChannels.isCylinderCleanupActivated = engine->isCylinderCleanupMode;
|
||||||
|
|
||||||
#if EFI_LAUNCH_CONTROL
|
#if EFI_LAUNCH_CONTROL
|
||||||
tsOutputChannels.launchTriggered = engine->isLaunchCondition;
|
tsOutputChannels.launchTriggered = engine->launchController.isLaunchCondition;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tsOutputChannels.clutchUpState = engine->clutchUpState;
|
tsOutputChannels.clutchUpState = engine->clutchUpState;
|
||||||
|
|
|
@ -61,7 +61,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_LAUNCH_CONTROL
|
#if EFI_LAUNCH_CONTROL
|
||||||
if (engine->isLaunchCondition && CONFIG(enableLaunchRetard)) {
|
if (engine->launchController.isLaunchCondition && CONFIG(enableLaunchRetard)) {
|
||||||
if (CONFIG(launchSmoothRetard)) {
|
if (CONFIG(launchSmoothRetard)) {
|
||||||
float launchAngle = CONFIG(launchTimingRetard);
|
float launchAngle = CONFIG(launchTimingRetard);
|
||||||
int launchAdvanceRpmRange = CONFIG(launchTimingRpmRange);
|
int launchAdvanceRpmRange = CONFIG(launchTimingRpmRange);
|
||||||
|
|
|
@ -147,12 +147,6 @@ public:
|
||||||
bool needTdcCallback = true;
|
bool needTdcCallback = true;
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
|
|
||||||
#if EFI_LAUNCH_CONTROL
|
|
||||||
bool launchActivatePinState = false;
|
|
||||||
bool isLaunchCondition = false;
|
|
||||||
#endif /* EFI_LAUNCH_CONTROL */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* By the way 32-bit value should hold at least 400 hours of events at 6K RPM x 12 events per revolution
|
* By the way 32-bit value should hold at least 400 hours of events at 6K RPM x 12 events per revolution
|
||||||
*/
|
*/
|
||||||
|
@ -162,11 +156,6 @@ public:
|
||||||
// GND input pins instead of leaving them floating
|
// GND input pins instead of leaving them floating
|
||||||
bool hwTriggerInputEnabled = true;
|
bool hwTriggerInputEnabled = true;
|
||||||
|
|
||||||
|
|
||||||
#if !EFI_PROD_CODE
|
|
||||||
float mockMapValue = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int getGlobalConfigurationVersion(void) const;
|
int getGlobalConfigurationVersion(void) const;
|
||||||
/**
|
/**
|
||||||
* true if a recent configuration change has changed any of the trigger settings which
|
* true if a recent configuration change has changed any of the trigger settings which
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
* We can have active condition from switch or from clutch.
|
* We can have active condition from switch or from clutch.
|
||||||
* In case we are dependent on VSS we just return true.
|
* In case we are dependent on VSS we just return true.
|
||||||
*/
|
*/
|
||||||
bool LaunchControlBase::isInsideSwitchCondition() const {
|
bool LaunchControlBase::isInsideSwitchCondition() {
|
||||||
switch (CONFIG(launchActivationMode)) {
|
switch (CONFIG(launchActivationMode)) {
|
||||||
case SWITCH_INPUT_LAUNCH:
|
case SWITCH_INPUT_LAUNCH:
|
||||||
if (isBrainPinValid(CONFIG(launchActivatePin))) {
|
if (isBrainPinValid(CONFIG(launchActivatePin))) {
|
||||||
//todo: we should take into consideration if this sw is pulled high or low!
|
//todo: we should take into consideration if this sw is pulled high or low!
|
||||||
engine->launchActivatePinState = efiReadPin(CONFIG(launchActivatePin));
|
launchActivatePinState = efiReadPin(CONFIG(launchActivatePin));
|
||||||
}
|
}
|
||||||
return engine->launchActivatePinState;
|
return launchActivatePinState;
|
||||||
|
|
||||||
case CLUTCH_INPUT_LAUNCH:
|
case CLUTCH_INPUT_LAUNCH:
|
||||||
if (isBrainPinValid(CONFIG(clutchDownPin))) {
|
if (isBrainPinValid(CONFIG(clutchDownPin))) {
|
||||||
|
@ -75,7 +75,7 @@ bool LaunchControlBase::isInsideRPMCondition(int rpm) const {
|
||||||
return (launchRpm < rpm);
|
return (launchRpm < rpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LaunchControlBase::isLaunchConditionMet(int rpm) const {
|
bool LaunchControlBase::isLaunchConditionMet(int rpm) {
|
||||||
|
|
||||||
bool activateSwitchCondition = isInsideSwitchCondition();
|
bool activateSwitchCondition = isInsideSwitchCondition();
|
||||||
bool rpmCondition = isInsideRPMCondition(rpm);
|
bool rpmCondition = isInsideRPMCondition(rpm);
|
||||||
|
@ -109,17 +109,17 @@ void LaunchControlBase::update() {
|
||||||
if (!combinedConditions) {
|
if (!combinedConditions) {
|
||||||
// conditions not met, reset timer
|
// conditions not met, reset timer
|
||||||
m_launchTimer.reset();
|
m_launchTimer.reset();
|
||||||
engine->isLaunchCondition = false;
|
isLaunchCondition = false;
|
||||||
} else {
|
} else {
|
||||||
// If conditions are met...
|
// If conditions are met...
|
||||||
engine->isLaunchCondition = m_launchTimer.hasElapsedSec(CONFIG(launchActivateDelay));
|
isLaunchCondition = m_launchTimer.hasElapsedSec(CONFIG(launchActivateDelay));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
if (CONFIG(debugMode) == DBG_LAUNCH) {
|
if (CONFIG(debugMode) == DBG_LAUNCH) {
|
||||||
tsOutputChannels.debugIntField5 = engine->clutchDownState;
|
tsOutputChannels.debugIntField5 = engine->clutchDownState;
|
||||||
tsOutputChannels.debugFloatField1 = engine->launchActivatePinState;
|
tsOutputChannels.debugFloatField1 = launchActivatePinState;
|
||||||
tsOutputChannels.debugFloatField2 = engine->isLaunchCondition;
|
tsOutputChannels.debugFloatField2 = isLaunchCondition;
|
||||||
tsOutputChannels.debugFloatField3 = combinedConditions;
|
tsOutputChannels.debugFloatField3 = combinedConditions;
|
||||||
}
|
}
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
@ -144,7 +144,7 @@ void setDefaultLaunchParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LaunchControlBase::isLaunchRpmRetardCondition() const {
|
bool LaunchControlBase::isLaunchRpmRetardCondition() const {
|
||||||
return engine->isLaunchCondition && (retardThresholdRpm < GET_RPM());
|
return isLaunchCondition && (retardThresholdRpm < GET_RPM());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LaunchControlBase::isLaunchSparkRpmRetardCondition() const {
|
bool LaunchControlBase::isLaunchSparkRpmRetardCondition() const {
|
||||||
|
|
|
@ -20,14 +20,16 @@ public:
|
||||||
|
|
||||||
bool isInsideSpeedCondition() const;
|
bool isInsideSpeedCondition() const;
|
||||||
bool isInsideTpsCondition() const;
|
bool isInsideTpsCondition() const;
|
||||||
bool isInsideSwitchCondition() const;
|
bool isInsideSwitchCondition();
|
||||||
bool isInsideRPMCondition(int rpm) const;
|
bool isInsideRPMCondition(int rpm) const;
|
||||||
bool isLaunchConditionMet(int rpm) const;
|
bool isLaunchConditionMet(int rpm);
|
||||||
|
|
||||||
bool isLaunchSparkRpmRetardCondition() const;
|
bool isLaunchSparkRpmRetardCondition() const;
|
||||||
bool isLaunchFuelRpmRetardCondition() const;
|
bool isLaunchFuelRpmRetardCondition() const;
|
||||||
|
|
||||||
int retardThresholdRpm;
|
int retardThresholdRpm;
|
||||||
|
bool launchActivatePinState = false;
|
||||||
|
bool isLaunchCondition = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isLaunchRpmRetardCondition() const;
|
bool isLaunchRpmRetardCondition() const;
|
||||||
|
|
|
@ -414,7 +414,7 @@ void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE
|
||||||
bool limitedFuel = !ENGINE(limpManager).allowInjection();
|
bool limitedFuel = !ENGINE(limpManager).allowInjection();
|
||||||
|
|
||||||
#if EFI_LAUNCH_CONTROL
|
#if EFI_LAUNCH_CONTROL
|
||||||
if (engine->isLaunchCondition && !limitedSpark && !limitedFuel) {
|
if (engine->launchController.isLaunchCondition && !limitedSpark && !limitedFuel) {
|
||||||
/* in case we are not already on a limited conditions, check launch as well */
|
/* in case we are not already on a limited conditions, check launch as well */
|
||||||
|
|
||||||
limitedSpark &= engine->launchController.isLaunchSparkRpmRetardCondition();
|
limitedSpark &= engine->launchController.isLaunchSparkRpmRetardCondition();
|
||||||
|
|
Loading…
Reference in New Issue