auto-sync

This commit is contained in:
rusEfi 2014-10-29 15:04:17 -05:00
parent fe42805988
commit ff55c3f11a
3 changed files with 7 additions and 5 deletions

View File

@ -200,7 +200,7 @@ void initializeTriggerShape(Logging *logger, engine_configuration_s const *engin
trigger_shape_s *triggerShape = &engineConfiguration2->triggerShape; trigger_shape_s *triggerShape = &engineConfiguration2->triggerShape;
setTriggerSynchronizationGap(triggerShape, 2); setTriggerSynchronizationGap(triggerShape, 2);
triggerShape->useRiseEdge = TRUE; triggerShape->useRiseEdge = true;
switch (triggerConfig->triggerType) { switch (triggerConfig->triggerType) {
@ -359,12 +359,14 @@ uint32_t findTriggerZeroEventIndex(trigger_shape_s * shape, trigger_config_s con
/** /**
* Now that we have just located the synch point, we can simulate the whole cycle * Now that we have just located the synch point, we can simulate the whole cycle
* in order to calculate expected duty cycle * in order to calculate expected duty cycle
*
* todo: add a comment why are we doing '2 * shape->getSize()' here?
*/ */
state.cycleCallback = onFindIndex; state.cycleCallback = onFindIndex;
for (uint32_t i = index + 1; i <= index + 2 * shape->getSize(); i++) { for (uint32_t i = index + 1; i <= index + 2 * shape->getSize(); i++) {
helper.nextStep(&state, shape, i, triggerConfig); helper.nextStep(&state, shape, i, triggerConfig);
} }
efiAssert(state.getTotalRevolutionCounter() > 1, "totalRevolutionCounter2", EFI_ERROR_CODE); efiAssert(state.getTotalRevolutionCounter() == 3, "totalRevolutionCounter2", EFI_ERROR_CODE);
for (int i = 0; i < PWM_PHASE_MAX_WAVE_PER_PWM; i++) { for (int i = 0; i < PWM_PHASE_MAX_WAVE_PER_PWM; i++) {
shape->dutyCycle[i] = 1.0 * state.expectedTotalTime[i] / HELPER_PERIOD; shape->dutyCycle[i] = 1.0 * state.expectedTotalTime[i] / HELPER_PERIOD;

View File

@ -8,7 +8,7 @@
#ifndef TRIGGER_STRUCTURE_H_ #ifndef TRIGGER_STRUCTURE_H_
#define TRIGGER_STRUCTURE_H_ #define TRIGGER_STRUCTURE_H_
#include <stdint.h> #include "global.h"
#include "rusefi_enums.h" #include "rusefi_enums.h"
#include "EfiWave.h" #include "EfiWave.h"
@ -39,7 +39,7 @@ public:
float syncRatioFrom; float syncRatioFrom;
float syncRatioTo; float syncRatioTo;
int useRiseEdge; bool_t useRiseEdge;
/** /**
* This is used for signal validation * This is used for signal validation

View File

@ -532,7 +532,7 @@ void testTriggerDecoder(void) {
testTriggerDecoder2("citroen", CITROEN_TU3JP, 0, 0.4833, 0.0); testTriggerDecoder2("citroen", CITROEN_TU3JP, 0, 0.4833, 0.0);
printGapRatio = true; printGapRatio = true;
testTriggerDecoder2("neon NGC", DODGE_NEON_2003, 6, 0.2139, 0.0); // todo testTriggerDecoder2("neon NGC", DODGE_NEON_2003, 6, 0.2139, 0.0);
testMazda323(); testMazda323();