rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
EngineCylinders Namespace Reference

Functions

void updateCylinders (void)
 

Function Documentation

◆ updateCylinders()

void EngineCylinders::updateCylinders ( void  )
private

Definition at line 40 of file engine_cylinder.cpp.

40 {
41 // Update valid cylinders with their position in the firing order
42 uint16_t cylinderUpdateMask = 0;
43 for (size_t i = 0; i < engineConfiguration->cylindersCount; i++) {
44 auto cylinderNumber = getCylinderNumberAtIndex(i);
45
46 engine->cylinders[cylinderNumber].updateCylinderNumber(i, cylinderNumber);
47
48 auto mask = 1 << cylinderNumber;
49 // Assert that this cylinder was not configured yet
50 efiAssertVoid(ObdCode::OBD_PCM_Processor_Fault, (cylinderUpdateMask & mask) == 0, "cylinder update err");
51 cylinderUpdateMask |= mask;
52 }
53
54 // Assert that all cylinders were configured
55 uint16_t expectedMask = (1 << (engineConfiguration->cylindersCount)) - 1;
56 efiAssertVoid(ObdCode::OBD_PCM_Processor_Fault, cylinderUpdateMask == expectedMask, "cylinder update err");
57
58 // Invalidate the remaining cylinders
59 for (size_t i = engineConfiguration->cylindersCount; i < efi::size(engine->cylinders); i++) {
61 }
62}
OneCylinder cylinders[MAX_CYLINDER_COUNT]
Definition engine.h:291
void updateCylinderNumber(uint8_t index, uint8_t cylinderNumber)
static EngineAccessor engine
Definition engine.h:413
static constexpr engine_configuration_s * engineConfiguration
size_t getCylinderNumberAtIndex(size_t cylinderIndex)
@ OBD_PCM_Processor_Fault

Referenced by prepareOutputSignals().

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