put wall wetting inside

This commit is contained in:
Matthew Kennedy 2020-07-20 00:04:05 -07:00
parent b2edd3a4f4
commit 46b7567195
4 changed files with 12 additions and 9 deletions

View File

@ -140,7 +140,6 @@ public:
IgnitionEventList ignitionEvents;
#endif /* EFI_ENGINE_CONTROL */
WallFuel wallFuel[INJECTION_PIN_COUNT];
bool needToStopEngine(efitick_t nowNt) const;
bool etbAutoTune = false;
/**

View File

@ -12,6 +12,7 @@
#include "scheduler.h"
#include "fl_stack.h"
#include "trigger_structure.h"
#include "accel_enrichment.h"
#define MAX_INJECTION_OUTPUT_COUNT INJECTION_PIN_COUNT
#define MAX_WIRES_COUNT 2
@ -42,6 +43,8 @@ public:
* TODO: make watchdog decrement relevant counter
*/
bool isScheduled = false;
WallFuel wallFuel;
};

View File

@ -180,8 +180,7 @@ void handleFuelInjectionEvent(int injEventIndex, InjectionEvent *event,
* x2 or /2?
*/
size_t injectorIndex = event->outputs[0]->injectorIndex;
const floatms_t injectionDuration = ENGINE(wallFuel[injectorIndex]).adjust(ENGINE(injectionDuration) PASS_ENGINE_PARAMETER_SUFFIX);
const floatms_t injectionDuration = event->wallFuel.adjust(ENGINE(injectionDuration) PASS_ENGINE_PARAMETER_SUFFIX);
#if EFI_PRINTF_FUEL_DETAILS
if (printFuelDebug) {
printf("fuel index=%d injectionDuration=%.2fms adjusted=%.2fms\n",

View File

@ -17,9 +17,11 @@ TEST(fuel, testWallWettingEnrichmentMath) {
engine->rpmCalculator.setRpmValue(3000 PASS_ENGINE_PARAMETER_SUFFIX);
WallFuel wallFuel;
// each invocation of 'adjust' changes WallWetting internal state
ASSERT_NEAR(16.6666, ENGINE(wallFuel[0]).adjust(10.0 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
ASSERT_NEAR(16.198, ENGINE(wallFuel[0]).adjust(10.0 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
ASSERT_NEAR(16.6666, wallFuel.adjust(10.0 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
ASSERT_NEAR(16.198, wallFuel.adjust(10.0 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
}
TEST(fuel, testWallWettingEnrichmentScheduling) {
@ -38,11 +40,11 @@ TEST(fuel, testWallWettingEnrichmentScheduling) {
int expectedInvocationCounter = 1;
for (int i = 0; i < 4; i++) {
ASSERT_EQ(expectedInvocationCounter, ENGINE(wallFuel[i]).invocationCounter);
ASSERT_EQ(expectedInvocationCounter, ENGINE(injectionEvents.elements[i]).wallFuel.invocationCounter);
}
// Cylinder 5 doesn't exist - shouldn't have been called!
ASSERT_EQ(0, ENGINE(wallFuel[5]).invocationCounter);
ASSERT_EQ(0, ENGINE(injectionEvents.elements[5]).wallFuel.invocationCounter);
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -50,9 +52,9 @@ TEST(fuel, testWallWettingEnrichmentScheduling) {
// still same 1 per cylinder - wall wetting is NOT invoked from 'periodicFastCallback'
for (int i = 0; i < 4; i++) {
ASSERT_EQ(expectedInvocationCounter, ENGINE(wallFuel[i]).invocationCounter);
ASSERT_EQ(expectedInvocationCounter, ENGINE(injectionEvents.elements[i]).wallFuel.invocationCounter);
}
// Cylinder 5 doesn't exist - shouldn't have been called!
ASSERT_EQ(0, ENGINE(wallFuel[5]).invocationCounter);
ASSERT_EQ(0, ENGINE(injectionEvents.elements[5]).wallFuel.invocationCounter);
}