auto-sync
This commit is contained in:
parent
04ec8171da
commit
95b780d6cf
|
@ -3,6 +3,8 @@
|
|||
*
|
||||
* DODGE_NEON_1995 = 2
|
||||
*
|
||||
* DODGE_NEON_2003 = 23
|
||||
*
|
||||
* This config overrides some values of the default configuration which is set by setDefaultConfiguration() method
|
||||
*
|
||||
* @date Dec 16, 2013
|
||||
|
|
|
@ -10,6 +10,33 @@
|
|||
void configureNeon2003TriggerShape(trigger_shape_s *s) {
|
||||
s->reset(FOUR_STROKE_CAM_SENSOR);
|
||||
|
||||
// voodoo magic - we always need 720 at the end
|
||||
int base = 10;
|
||||
|
||||
setTriggerSynchronizationGap(s, 2.5);
|
||||
|
||||
s->addEvent(base + 26, T_PRIMARY, TV_HIGH);
|
||||
s->addEvent(base + 62, T_PRIMARY, TV_LOW);
|
||||
|
||||
s->addEvent(base + 98, T_PRIMARY, TV_HIGH);
|
||||
s->addEvent(base + 134, T_PRIMARY, TV_LOW);
|
||||
|
||||
s->addEvent(base + 180, T_PRIMARY, TV_HIGH);
|
||||
s->addEvent(base + 314, T_PRIMARY, TV_LOW);
|
||||
|
||||
s->addEvent(base + 350, T_PRIMARY, TV_HIGH);
|
||||
s->addEvent(base + 386, T_PRIMARY, TV_LOW);
|
||||
|
||||
s->addEvent(base + 422, T_PRIMARY, TV_HIGH);
|
||||
s->addEvent(base + 458, T_PRIMARY, TV_LOW);
|
||||
|
||||
s->addEvent(base + 494, T_PRIMARY, TV_HIGH);
|
||||
s->addEvent(base + 530, T_PRIMARY, TV_LOW);
|
||||
|
||||
s->addEvent(base + 674, T_PRIMARY, TV_HIGH);
|
||||
s->addEvent(base + 710, T_PRIMARY, TV_LOW);
|
||||
|
||||
s->assignSize();
|
||||
}
|
||||
|
||||
void configureNeon1995TriggerShape(trigger_shape_s *s) {
|
||||
|
@ -19,7 +46,6 @@ void configureNeon1995TriggerShape(trigger_shape_s *s) {
|
|||
|
||||
s->useRiseEdge = false;
|
||||
|
||||
|
||||
// voodoo magic - we always need 720 at the end
|
||||
int base = 720 - 560;
|
||||
|
||||
|
@ -68,7 +94,6 @@ void configureNeon1995TriggerShape(trigger_shape_s *s) {
|
|||
s->addEvent(base + 492, T_SECONDARY, TV_HIGH);
|
||||
s->addEvent(base + 497, T_SECONDARY, TV_LOW);
|
||||
|
||||
|
||||
s->addEvent(base + 560, T_PRIMARY, TV_HIGH); // width =
|
||||
|
||||
s->shaftPositionEventCount = 4 + 8 + 8 + 8 + 8;
|
||||
|
|
|
@ -35,6 +35,12 @@
|
|||
|
||||
static cyclic_buffer errorDetection;
|
||||
|
||||
#if ! EFI_PROD_CODE
|
||||
|
||||
bool printGapRatio = false;
|
||||
|
||||
#endif /* ! EFI_PROD_CODE */
|
||||
|
||||
/**
|
||||
* @return TRUE is something is wrong with trigger decoding
|
||||
*/
|
||||
|
@ -48,6 +54,15 @@ static inline bool isSynchronizationGap(TriggerState const *shaftPositionState,
|
|||
return false;
|
||||
}
|
||||
|
||||
#if ! EFI_PROD_CODE
|
||||
if(printGapRatio) {
|
||||
|
||||
float gap = 1.0 * currentDuration / shaftPositionState->toothed_previous_duration;
|
||||
print("current gap %f\r\n", gap);
|
||||
}
|
||||
|
||||
#endif /* ! EFI_PROD_CODE */
|
||||
|
||||
return currentDuration > shaftPositionState->toothed_previous_duration * triggerShape->syncRatioFrom
|
||||
&& currentDuration < shaftPositionState->toothed_previous_duration * triggerShape->syncRatioTo;
|
||||
}
|
||||
|
@ -80,7 +95,7 @@ static trigger_value_e eventType[6] = { TV_LOW, TV_HIGH, TV_LOW, TV_HIGH, TV_LOW
|
|||
*/
|
||||
void TriggerState::decodeTriggerEvent(trigger_shape_s const*triggerShape, trigger_config_s const*triggerConfig,
|
||||
trigger_event_e const signal, uint64_t nowUs) {
|
||||
(void)triggerConfig; // we might want this for logging?
|
||||
(void) triggerConfig; // we might want this for logging?
|
||||
efiAssertVoid(signal <= SHAFT_3RD_UP, "unexpected signal");
|
||||
|
||||
trigger_wheel_e triggerWheel = eventIndex[signal];
|
||||
|
@ -361,7 +376,6 @@ uint32_t findTriggerZeroEventIndex(trigger_shape_s * shape, trigger_config_s con
|
|||
//static Logging logger;
|
||||
#endif
|
||||
|
||||
|
||||
void initTriggerDecoder(void) {
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
// initLogging(&logger, "trigger decoder");
|
||||
|
|
|
@ -54,5 +54,5 @@ void initializeMitsubishi4g18(trigger_shape_s *s) {
|
|||
s->addEvent(720.0 - secondaryWidth, T_SECONDARY, TV_HIGH);
|
||||
s->addEvent(720.0, T_SECONDARY, TV_LOW);
|
||||
|
||||
s->shaftPositionEventCount = s->getSize();
|
||||
s->assignSize();
|
||||
}
|
||||
|
|
|
@ -35,6 +35,10 @@ trigger_shape_s::trigger_shape_s() :
|
|||
wave.waves = h.waves;
|
||||
}
|
||||
|
||||
void trigger_shape_s::assignSize() {
|
||||
shaftPositionEventCount = getSize();
|
||||
}
|
||||
|
||||
int trigger_shape_s::getSize() const {
|
||||
return size;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
void addEvent(float angle, trigger_wheel_e const waveIndex, trigger_value_e const state);
|
||||
void reset(operation_mode_e operationMode);
|
||||
int getSize() const;
|
||||
void assignSize();
|
||||
multi_wave_s wave;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue