rusEFI
The most advanced open source ECU
Functions | Variables
knock_controller.cpp File Reference

Functions

int getCylinderKnockBank (uint8_t cylinderNumber)
 
 __attribute__ ((weak)) void onStartKnockSampling(uint8_t cylinderNumber
 
 UNUSED (samplingTimeSeconds)
 
 UNUSED (channelIdx)
 
static void startKnockSampling (Engine *p_engine)
 

Variables

float samplingTimeSeconds
 
float uint8_t channelIdx
 
static uint8_t cylinderNumberCopy
 

Function Documentation

◆ __attribute__()

__attribute__ ( (weak)  )
Here is the call graph for this function:

◆ getCylinderKnockBank()

int getCylinderKnockBank ( uint8_t  cylinderNumber)

Definition at line 13 of file knock_controller.cpp.

13  {
14  // C/C++ can't index in to bit fields, we have to provide lookup ourselves
15  switch (cylinderNumber) {
16 #if EFI_PROD_CODE
17  case 0:
19  case 1:
21  case 2:
23  case 3:
25  case 4:
27  case 5:
29  case 6:
31  case 7:
33  case 8:
35  case 9:
37  case 10:
39  case 11:
41 #endif
42  default:
43  return 0;
44  }
45 }
engine_configuration_s * engineConfiguration

Referenced by HIP9011::cylinderToChannelIdx(), and startKnockSampling().

Here is the caller graph for this function:

◆ startKnockSampling()

static void startKnockSampling ( Engine p_engine)
static

Definition at line 142 of file knock_controller.cpp.

142  {
143  // todo: why do we pass engine as parameter? is that for unit tests?
144  if (!p_engine->rpmCalculator.isRunning()) {
145  return;
146  }
147 
148  // Convert sampling angle to time
149  float samplingSeconds = engine->rpmCalculator.oneDegreeUs * engineConfiguration->knockSamplingDuration / US_PER_SECOND_F;
150 
151  // Look up which channel this cylinder uses
153 
154  // Call the driver to begin sampling
155  onStartKnockSampling(cylinderNumberCopy, samplingSeconds, channel);
156 }
RpmCalculator rpmCalculator
Definition: engine.h:272
floatus_t oneDegreeUs
bool isRunning() const
Engine * engine
int getCylinderKnockBank(uint8_t cylinderNumber)
static uint8_t cylinderNumberCopy
void onStartKnockSampling(uint8_t cylinderNumber, float samplingSeconds, uint8_t channelIdx)
Here is the call graph for this function:

◆ UNUSED() [1/2]

UNUSED ( channelIdx  )

◆ UNUSED() [2/2]

UNUSED ( samplingTimeSeconds  )

Variable Documentation

◆ channelIdx

float uint8_t channelIdx
Initial value:
{
UNUSED(cylinderNumber)
UNUSED(samplingTimeSeconds)

Definition at line 131 of file knock_controller.cpp.

Referenced by getConversionGroup(), and onStartKnockSampling().

◆ cylinderNumberCopy

uint8_t cylinderNumberCopy
static

Definition at line 138 of file knock_controller.cpp.

Referenced by Engine::onSparkFireKnockSense(), and startKnockSampling().

◆ samplingTimeSeconds

float samplingTimeSeconds

Definition at line 131 of file knock_controller.cpp.

Go to the source code of this file.