rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
harley_acr.cpp File Reference

Functions

static bool getAcrState ()
 

Function Documentation

◆ getAcrState()

static bool getAcrState ( )
static

Definition at line 15 of file harley_acr.cpp.

15 {
16 bool engineMovedRecently = getTriggerCentral()->engineMovedRecently();
17 engine->engineState.acrEngineMovedRecently = engineMovedRecently;
19 if (!currentPhase) {
20 return engineMovedRecently;
21 }
22
23 // Turn off the valve if the engine isn't moving - no sense wasting power on a stopped engine
24 if (!engineMovedRecently) {
25 return false;
26 }
27
29 if (revCount > engineConfiguration->acrRevolutions) {
30 // Enough revs have elapsed that we're done with ACR
31 return false;
32 } else if (revCount == engineConfiguration->acrRevolutions) {
33 float wrappedPhase = currentPhase.Value > 360 ? currentPhase.Value - 360 : currentPhase.Value;
34
35 // We're on the rev where ACR should be disabled part way through
36 if (wrappedPhase > engineConfiguration->acrDisablePhase) {
37 return false;
38 } else {
39 // Not enough phase elapsed, ACR still active
40 return true;
41 }
42 } else {
43 // ACR active - not enough revs completed
44 return true;
45 }
46}
EngineState engineState
Definition engine.h:344
PrimaryTriggerDecoder triggerState
bool engineMovedRecently(efitick_t nowNt) const
expected< float > getCurrentEnginePhase(efitick_t nowNt) const
int getSynchronizationCounter() const
efitick_t getTimeNowNt()
Definition efitime.cpp:19
TriggerCentral * getTriggerCentral()
Definition engine.cpp:590
static EngineAccessor engine
Definition engine.h:413
static constexpr engine_configuration_s * engineConfiguration

Referenced by HarleyAcr::onSlowCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

Go to the source code of this file.