VVT C++ magic

This commit is contained in:
Andrey 2021-07-21 22:14:21 -04:00
parent dba7a333f8
commit b6a5f777e6
2 changed files with 6 additions and 8 deletions

View File

@ -365,10 +365,6 @@ void Engine::reset() {
*/
engineCycle = getEngineCycle(FOUR_STROKE_CRANK_SENSOR);
memset(&ignitionPin, 0, sizeof(ignitionPin));
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
// todo: is it possible to make it constructor argument?
vvtTriggerConfiguration[camIndex].index = camIndex;
}
}

View File

@ -70,9 +70,11 @@ protected:
class VvtTriggerConfiguration final : public TriggerConfiguration {
public:
VvtTriggerConfiguration() : TriggerConfiguration("VVT ") {}
// todo: is it possible to make 'index' constructor argument?
int index = 0;
int index;
VvtTriggerConfiguration(const char * prefix, int index) : TriggerConfiguration(prefix) {
this->index = index;
}
protected:
bool isUseOnlyRisingEdgeForTrigger() const override;
@ -109,7 +111,7 @@ public:
efitick_t mostRecentTimeBetweenIgnitionEvents;
PrimaryTriggerConfiguration primaryTriggerConfiguration;
VvtTriggerConfiguration vvtTriggerConfiguration[CAMS_PER_BANK];
VvtTriggerConfiguration vvtTriggerConfiguration[CAMS_PER_BANK] = {{"VVT1 ", 0}, {"VVT2 ", 1}};
efitick_t startStopStateLastPushTime = 0;
#if EFI_SHAFT_POSITION_INPUT