auto-sync
This commit is contained in:
parent
b1fc7a28a3
commit
d9118e8976
|
@ -121,6 +121,8 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
prevSignal = curSignal;
|
||||
curSignal = signal;
|
||||
|
||||
timeOfLastEvent[currentCycle.current_index] = nowNt;
|
||||
|
||||
currentCycle.eventCount[triggerWheel]++;
|
||||
|
||||
efitime_t currentDurationLong = getCurrentGapDuration(nowNt);
|
||||
|
@ -288,8 +290,8 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount,
|
|||
operation_mode_e operationMode) {
|
||||
efiAssertVoid(totalTeethCount > 0, "totalTeethCount is zero");
|
||||
|
||||
s->totalToothCount = totalTeethCount;
|
||||
s->skippedToothCount = skippedCount;
|
||||
// s->totalToothCount = totalTeethCount;
|
||||
// s->skippedToothCount = skippedCount;
|
||||
|
||||
s->setTriggerSynchronizationGap(skippedCount + 1);
|
||||
s->isSynchronizationNeeded = (skippedCount != 0);
|
||||
|
|
|
@ -76,6 +76,10 @@ public:
|
|||
*/
|
||||
uint32_t prevTotalTime[PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||
int expectedTotalTime[PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||
|
||||
uint32_t timeOfLastEvent[PWM_PHASE_MAX_COUNT];
|
||||
float instantRpmValue[PWM_PHASE_MAX_COUNT];
|
||||
|
||||
/**
|
||||
* how many times since ECU reboot we had unexpected number of teeth in trigger cycle
|
||||
*/
|
||||
|
|
|
@ -45,7 +45,7 @@ TriggerShape::TriggerShape() :
|
|||
// todo: reuse 'clear' method?
|
||||
invertOnAdd = false;
|
||||
tdcPosition = 0;
|
||||
skippedToothCount = totalToothCount = 0;
|
||||
// skippedToothCount = totalToothCount = 0;
|
||||
syncRatioFrom = syncRatioTo = 0;
|
||||
secondSyncRatioFrom = 0.000001;
|
||||
secondSyncRatioTo = 100000;
|
||||
|
@ -230,7 +230,7 @@ float TriggerShape::getAngle(int index) const {
|
|||
}
|
||||
}
|
||||
|
||||
void TriggerShape::addEvent(float angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam, float filterLeft, float filterRight) {
|
||||
void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam, float filterLeft, float filterRight) {
|
||||
if (angle > filterLeft && angle < filterRight)
|
||||
addEvent(angle, waveIndex, stateParam);
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ operation_mode_e TriggerShape::getOperationMode() {
|
|||
extern bool printTriggerDebug;
|
||||
#endif
|
||||
|
||||
void TriggerShape::addEvent(float angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam) {
|
||||
void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam) {
|
||||
efiAssertVoid(operationMode != OM_NONE, "operationMode not set");
|
||||
|
||||
efiAssertVoid(waveIndex!= T_SECONDARY || needSecondTriggerInput, "secondary needed or not?");
|
||||
|
|
|
@ -27,6 +27,9 @@ private:
|
|||
|
||||
class Engine;
|
||||
|
||||
/**
|
||||
* @brief Trigger shape has all the fields needed to describe and decode trigger signal.
|
||||
*/
|
||||
class TriggerShape {
|
||||
public:
|
||||
TriggerShape();
|
||||
|
@ -35,14 +38,22 @@ public:
|
|||
bool_t isSynchronizationNeeded;
|
||||
bool_t needSecondTriggerInput;
|
||||
|
||||
int totalToothCount;
|
||||
int skippedToothCount;
|
||||
// int totalToothCount;
|
||||
// int skippedToothCount;
|
||||
|
||||
/**
|
||||
* duty cycle for each individual trigger channel
|
||||
*/
|
||||
float dutyCycle[PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||
|
||||
/**
|
||||
* These angles are in event coordinates - with synchronization point located at angle zero.
|
||||
* These values are pre-calculated for performance reasons.
|
||||
*/
|
||||
angle_t eventAngles[PWM_PHASE_MAX_COUNT];
|
||||
/**
|
||||
* this cache allows us to find a close-enough (with one degree precision) trigger wheel index by
|
||||
* given angle with fast constant speed
|
||||
* given angle with fast constant speed. That's a performance optimization for event scheduling.
|
||||
*/
|
||||
int triggerIndexByAngle[720];
|
||||
|
||||
|
@ -67,6 +78,9 @@ public:
|
|||
*/
|
||||
bool_t useRiseEdge;
|
||||
|
||||
/**
|
||||
* In case of a multi-channel trigger, do we want to sync based on primary channel only?
|
||||
*/
|
||||
bool_t useOnlyPrimaryForSync;
|
||||
/**
|
||||
* Should we measure gaps with events of both kinds?
|
||||
|
@ -91,15 +105,6 @@ public:
|
|||
// tood: maybe even automate this flag calculation?
|
||||
int initialState[PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||
|
||||
/**
|
||||
* These angles are in event coordinates - with synchronization point located at angle zero.
|
||||
* These values are pre-calculated for performance reasons.
|
||||
*/
|
||||
float eventAngles[PWM_PHASE_MAX_COUNT];
|
||||
|
||||
uint32_t timeOfLastEvent[PWM_PHASE_MAX_COUNT];
|
||||
float instantRpmValue[PWM_PHASE_MAX_COUNT];
|
||||
|
||||
int8_t isFrontEvent[PWM_PHASE_MAX_COUNT];
|
||||
/**
|
||||
* this table translates trigger definition index into 'front-only' index. This translation is not so trivial
|
||||
|
@ -107,6 +112,9 @@ public:
|
|||
*/
|
||||
int frontOnlyIndexes[PWM_PHASE_MAX_COUNT];
|
||||
|
||||
/**
|
||||
* This is a pretty questionable option which is considered by 'addEvent' method
|
||||
*/
|
||||
bool_t invertOnAdd;
|
||||
/**
|
||||
* Total count of shaft events per CAM or CRANK shaft revolution.
|
||||
|
@ -115,8 +123,8 @@ public:
|
|||
*/
|
||||
int size;
|
||||
|
||||
void addEvent(float angle, trigger_wheel_e const waveIndex, trigger_value_e const state);
|
||||
void addEvent(float angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam, float filterLeft, float filterRight);
|
||||
void addEvent(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const state);
|
||||
void addEvent(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam, float filterLeft, float filterRight);
|
||||
operation_mode_e getOperationMode();
|
||||
|
||||
// todo: these two methods here, something could be improved
|
||||
|
@ -143,6 +151,7 @@ private:
|
|||
*/
|
||||
int triggerShapeSynchPointIndex;
|
||||
/**
|
||||
* Working buffer for 'wave' instance
|
||||
* Values are in the 0..1 range
|
||||
*/
|
||||
float switchTimesBuffer[PWM_PHASE_MAX_COUNT];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// This file was generated by Version2Header
|
||||
// Mon Sep 07 22:47:08 EDT 2015
|
||||
// Sat Sep 12 16:00:07 EDT 2015
|
||||
#ifndef VCS_VERSION
|
||||
#define VCS_VERSION "8764"
|
||||
#define VCS_VERSION "8791"
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue