Minor changes to Simple closed loop AFR algorithm

See Issue #142
This commit is contained in:
Josh Stewart 2018-06-04 17:01:53 +10:00
parent 388ad9ac41
commit 88429b977b
1 changed files with 9 additions and 7 deletions

View File

@ -331,19 +331,21 @@ static inline byte correctionAFRClosedLoop()
//Running lean
if(currentStatus.egoCorrection < (100 + configPage6.egoLimit) ) //Fueling adjustment must be at most the egoLimit amount (up or down)
{
if(currentStatus.egoCorrection >= 100) { AFRValue = (currentStatus.egoCorrection + 1); } //Increase the fueling by 1%
else { AFRValue += 1; } //This means that the last reading had been rich, so start counting back towards 100%
AFRValue = (currentStatus.egoCorrection + 1); //Increase the fueling by 1%
}
else { AFRValue = currentStatus.egoCorrection; } //Means we're at the maximum adjustment amount, so simply return then again
else { AFRValue = currentStatus.egoCorrection; } //Means we're at the maximum adjustment amount, so simply return that again
}
else
else if(currentStatus.O2 < currentStatus.afrTarget)
{
//Running Rich
if(currentStatus.egoCorrection > (100 - configPage6.egoLimit) ) //Fueling adjustment must be at most the egoLimit amount (up or down)
{
if(currentStatus.egoCorrection <= 100) { AFRValue = (currentStatus.egoCorrection - 1); } //Increase the fueling by 1%
else { AFRValue -= 1; } //This means that the last reading had been lean, so start count back towards 100%
AFRValue = (currentStatus.egoCorrection - 1); //Decrease the fueling by 1%
}
else { AFRValue = currentStatus.egoCorrection; } //Means we're at the maximum adjustment amount, so simply return then again
else { AFRValue = currentStatus.egoCorrection; } //Means we're at the maximum adjustment amount, so simply return that again
}
else { AFRValue = currentStatus.egoCorrection; } //Means we're already right on target
}
else if(configPage6.egoAlgorithm == EGO_ALGORITHM_PID)
{