60/2 perf grab #1850

This commit is contained in:
rusefillc 2020-10-04 01:04:15 -04:00
parent 9c260784cb
commit c9d3d1f01a
5 changed files with 13 additions and 15 deletions

View File

@ -124,7 +124,6 @@ public:
bool applyLaunchExtraFuel = false;
bool setLaunchBoostDuty = false;
bool applyLaunchControlRetard = false;
bool rpmHardCut = false;
#endif /* EFI_LAUNCH_CONTROL */
/**
@ -274,6 +273,7 @@ public:
efitimeus_t acSwitchLastChangeTime = 0;
bool isRunningPwmTest = false;
bool isRpmHardLimit = false;
int getRpmHardLimit(DECLARE_ENGINE_PARAMETER_SIGNATURE);

View File

@ -141,14 +141,14 @@ void setDefaultLaunchParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void applyLaunchControlLimiting(bool *limitedSpark, bool *limitedFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
int rpm = GET_RPM();
// todo: pre-calculate 'retardThresholdRpm' less often that on each 'applyLaunchControlLimiting' invocation
int retardThresholdRpm = CONFIG(launchRpm) +
(CONFIG(enableLaunchRetard) ? CONFIG(launchAdvanceRpmRange) : 0) +
CONFIG(hardCutRpmRange);
if (retardThresholdRpm < GET_RPM()) {
*limitedSpark = engine->isLaunchCondition && engineConfiguration->launchSparkCutEnable;
*limitedFuel = engine->isLaunchCondition && engineConfiguration->launchFuelCutEnable;
engine->rpmHardCut = true;
*limitedSpark = engineConfiguration->launchSparkCutEnable;
*limitedFuel = engineConfiguration->launchFuelCutEnable;
}
}

View File

@ -375,7 +375,7 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent
(void) ckpSignalType;
if (engineConfiguration->vvtMode == MIATA_NB2 && engine->triggerCentral.vvtSyncTimeNt == 0) {
if (CONFIG(vvtMode) == MIATA_NB2 && ENGINE(triggerCentral.vvtSyncTimeNt) == 0) {
// this is a bit spaghetti code for sure
// do not spark & do not fuel until we have VVT sync. NB2 is a special case
// due to symmetrical crank wheel and we need to make sure no spark happens out of sync
@ -421,8 +421,8 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent
// TODO: add 'pin shutdown' invocation somewhere - coils might be still open here!
return;
}
bool limitedSpark = rpm > engine->getRpmHardLimit(PASS_ENGINE_PARAMETER_SIGNATURE);
bool limitedFuel = rpm > engine->getRpmHardLimit(PASS_ENGINE_PARAMETER_SIGNATURE);
bool limitedSpark = ENGINE(isRpmHardLimit);
bool limitedFuel = ENGINE(isRpmHardLimit);
if (CONFIG(boostCutPressure) != 0) {
if (getMap(PASS_ENGINE_PARAMETER_SIGNATURE) > CONFIG(boostCutPressure)) {
@ -431,10 +431,9 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent
}
}
#if EFI_LAUNCH_CONTROL
if ((!limitedSpark)&&(!limitedFuel))
{
if (engine->isLaunchCondition && !limitedSpark && !limitedFuel) {
/* in case we are not already on a limited conditions, check launch as well */
applyLaunchControlLimiting(&limitedSpark,&limitedFuel PASS_ENGINE_PARAMETER_SUFFIX);
applyLaunchControlLimiting(&limitedSpark, &limitedFuel PASS_ENGINE_PARAMETER_SUFFIX);
}
#endif
if (trgEventIndex == 0) {

View File

@ -267,6 +267,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
}
rpmState->onNewEngineCycle();
rpmState->lastRpmEventTimeNt = nowNt;
engine->isRpmHardLimit = GET_RPM() > engine->getRpmHardLimit(PASS_ENGINE_PARAMETER_SIGNATURE);
}

View File

@ -284,7 +284,7 @@ void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
// for effective noise filtering, we need both signal edges,
// so we pass them to handleShaftSignal() and defer this test
if (!CONFIG(useNoiselessTriggerDecoder)) {
const TriggerConfiguration * triggerConfiguration = &engine->primaryTriggerConfiguration;
const TriggerConfiguration * triggerConfiguration = &ENGINE(primaryTriggerConfiguration);
if (!isUsefulSignal(signal, triggerConfiguration)) {
/**
* no need to process VR falls further
@ -310,7 +310,7 @@ void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
triggerReentraint++;
efiAssertVoid(CUSTOM_ERR_6636, getCurrentRemainingStack() > 128, "lowstck#8");
engine->triggerCentral.handleShaftSignal(signal, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
ENGINE(triggerCentral).handleShaftSignal(signal, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
triggerReentraint--;
triggerDuration = getTimeNowLowerNt() - triggerHandlerEntryTime;
@ -414,8 +414,6 @@ bool TriggerNoiseFilter::noiseFilter(efitick_t nowNt,
* This method is NOT invoked for VR falls.
*/
void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(CUSTOM_CONF_NULL, engine!=NULL, "configuration");
if (triggerShape.shapeDefinitionError) {
// trigger is broken, we cannot do anything here
warning(CUSTOM_ERR_UNEXPECTED_SHAFT_EVENT, "Shaft event while trigger is mis-configured");
@ -429,7 +427,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
if (!noiseFilter.noiseFilter(timestamp, &triggerState, signal PASS_ENGINE_PARAMETER_SUFFIX)) {
return;
}
const TriggerConfiguration * triggerConfiguration = &engine->primaryTriggerConfiguration;
const TriggerConfiguration * triggerConfiguration = &ENGINE(primaryTriggerConfiguration);
// moved here from hwHandleShaftSignal()
if (!isUsefulSignal(signal, triggerConfiguration)) {
return;