refactoring: separate VW files

This commit is contained in:
rusEfi 2018-08-25 20:05:17 -04:00
parent 43d2a051f7
commit a5506c1243
6 changed files with 51 additions and 27 deletions

View File

@ -0,0 +1,34 @@
/*
* @file trigger_vw.cpp
*
* @date Aug 25, 2018
* @author Andrey Belomutskiy, (c) 2012-2018
*/
#include "trigger_vw.h"
#include "trigger_universal.h"
void setVwConfiguration(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(CUSTOM_ERR_6660, s != NULL, "TriggerShape is NULL");
operation_mode_e operationMode = FOUR_STROKE_CRANK_SENSOR;
s->initialize(operationMode, false);
s->isSynchronizationNeeded = true;
int totalTeethCount = 60;
int skippedCount = 2;
float engineCycle = getEngineCycle(operationMode);
float toothWidth = 0.5;
addSkippedToothTriggerEvents(T_PRIMARY, s, 60, 2, toothWidth, 0, engineCycle,
NO_LEFT_FILTER, 690 PASS_ENGINE_PARAMETER_SUFFIX);
float angleDown = engineCycle / totalTeethCount * (totalTeethCount - skippedCount - 1 + (1 - toothWidth) );
s->addEvent2(0 + angleDown + 12, T_PRIMARY, TV_RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER PASS_ENGINE_PARAMETER_SUFFIX);
s->addEvent2(0 + engineCycle, T_PRIMARY, TV_FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER PASS_ENGINE_PARAMETER_SUFFIX);
s->setTriggerSynchronizationGap2(1.6, 4);
}

View File

@ -0,0 +1,15 @@
/*
* @file trigger_vw.h
*
* @date Aug 25, 2018
* @author Andrey Belomutskiy, (c) 2012-2018
*/
#ifndef CONTROLLERS_TRIGGER_DECODERS_TRIGGER_VW_H_
#define CONTROLLERS_TRIGGER_DECODERS_TRIGGER_VW_H_
#include "engine.h"
void setVwConfiguration(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX);
#endif /* CONTROLLERS_TRIGGER_DECODERS_TRIGGER_VW_H_ */

View File

@ -13,6 +13,7 @@ TRIGGER_DECODERS_SRC_CPP = \
$(PROJECT_DIR)/controllers/trigger/decoders/trigger_gm.cpp \
$(PROJECT_DIR)/controllers/trigger/decoders/trigger_honda.cpp \
$(PROJECT_DIR)/controllers/trigger/decoders/trigger_rover.cpp \
$(PROJECT_DIR)/controllers/trigger/decoders/trigger_vw.cpp \
$(PROJECT_DIR)/controllers/trigger/decoders/trigger_universal.cpp
TRIGGER_SRC_CPP = \

View File

@ -35,6 +35,7 @@
#include "trigger_toyota.h"
#include "trigger_rover.h"
#include "trigger_honda.h"
#include "trigger_vw.h"
#include "trigger_structure.h"
#include "efiGpio.h"
#include "engine.h"

View File

@ -429,31 +429,6 @@ void multi_wave_s::checkSwitchTimes(int size) {
checkSwitchTimes2(size, switchTimes);
}
void setVwConfiguration(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(CUSTOM_ERR_6660, s != NULL, "TriggerShape is NULL");
operation_mode_e operationMode = FOUR_STROKE_CRANK_SENSOR;
s->initialize(operationMode, false);
s->isSynchronizationNeeded = true;
int totalTeethCount = 60;
int skippedCount = 2;
float engineCycle = getEngineCycle(operationMode);
float toothWidth = 0.5;
addSkippedToothTriggerEvents(T_PRIMARY, s, 60, 2, toothWidth, 0, engineCycle,
NO_LEFT_FILTER, 690 PASS_ENGINE_PARAMETER_SUFFIX);
float angleDown = engineCycle / totalTeethCount * (totalTeethCount - skippedCount - 1 + (1 - toothWidth) );
s->addEvent2(0 + angleDown + 12, T_PRIMARY, TV_RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER PASS_ENGINE_PARAMETER_SUFFIX);
s->addEvent2(0 + engineCycle, T_PRIMARY, TV_FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER PASS_ENGINE_PARAMETER_SUFFIX);
s->setTriggerSynchronizationGap2(1.6, 4);
}
void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped,
operation_mode_e operationMode DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)

View File

@ -228,8 +228,6 @@ private:
void calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX);
};
void setVwConfiguration(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX);
void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped, operation_mode_e operationMode DECLARE_ENGINE_PARAMETER_SUFFIX);
#endif /* TRIGGER_STRUCTURE_H_ */