auto-sync

This commit is contained in:
rusEfi 2015-08-30 14:01:28 -04:00
parent 7fbff403bd
commit 53bead7e10
8 changed files with 24 additions and 17 deletions

View File

@ -25,7 +25,7 @@
class FuelSchedule {
public:
FuelSchedule();
InjectionEventList events;
InjectionEventList injectionEvents;
/**
* this method schedules all fuel events for an engine cycle

View File

@ -122,7 +122,7 @@ void FuelSchedule::registerInjectionEvent(int injectorIndex, float angle,
warning(OBD_PCM_Processor_Fault, "no_pin_inj #%s", output->name);
}
InjectionEvent *ev = events.add();
InjectionEvent *ev = injectionEvents.add();
if (ev == NULL) {
// error already reported
return;
@ -155,7 +155,7 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
clear(); // this method is relatively heavy
// sourceList->reset();
events.reset();
injectionEvents.reset();
efiAssertVoid(engine!=NULL, "engine is NULL");

View File

@ -168,7 +168,7 @@ static ALWAYS_INLINE void handleFuel(uint32_t eventIndex, int rpm DECLARE_ENGINE
isCrankingR(rpm) ?
&ENGINE(engineConfiguration2)->crankingInjectionEvents : &engine->engineConfiguration2->injectionEvents;
InjectionEventList *source = &fs->events;
InjectionEventList *source = &fs->injectionEvents;
if (!fs->hasEvents[eventIndex])
return;

View File

@ -265,7 +265,7 @@ void printAllTriggers() {
int triggerDefinitionCoordinate = (s->getTriggerShapeSynchPointIndex() + i) % s->getLength();
fprintf(fp, "event %d %d %f\r\n", i, s->events[triggerDefinitionCoordinate], s->eventAngles[i]);
fprintf(fp, "event %d %d %f\r\n", i, s->triggerSignals[triggerDefinitionCoordinate], s->eventAngles[i]);
}
}

View File

@ -51,10 +51,9 @@ TriggerShape::TriggerShape() :
memset(frontOnlyIndexes, 0, sizeof(frontOnlyIndexes));
memset(isFrontEvent, 0, sizeof(isFrontEvent));
memset(triggerIndexByAngle, 0, sizeof(triggerIndexByAngle));
#if EFI_UNIT_TEST
memset(&events, 0, sizeof(events));
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
memset(&triggerSignals, 0, sizeof(triggerSignals));
#endif
}
int TriggerShape::getSize() const {
@ -250,9 +249,9 @@ void TriggerShape::addEvent(float angle, trigger_wheel_e const waveIndex, trigge
state = stateParam;
}
#if EFI_UNIT_TEST
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
int signal = waveIndex * 1000 + stateParam;
events[size] = signal;
triggerSignals[size] = signal;
#endif
float engineCycle = getEngineCycle(operationMode);
@ -263,7 +262,7 @@ void TriggerShape::addEvent(float angle, trigger_wheel_e const waveIndex, trigge
*/
angle /= engineCycle;
#if EFI_PROD_CODE
#if EFI_PROD_CODE || defined(__DOXYGEN__)
// todo: PASS_ENGINE?
if (!engineConfiguration->useOnlyFrontForTrigger || stateParam == TV_HIGH) {
expectedEventCount[waveIndex]++;
@ -372,7 +371,7 @@ void setVwConfiguration(TriggerShape *s) {
void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped,
operation_mode_e operationMode) {
#if EFI_ENGINE_CONTROL
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
s->useRiseEdge = true;

View File

@ -71,8 +71,11 @@ public:
*/
uint32_t expectedEventCount[PWM_PHASE_MAX_WAVE_PER_PWM];
#if EFI_UNIT_TEST
int events[PWM_PHASE_MAX_COUNT];
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
/**
* These signals are used for trigger export only
*/
int triggerSignals[PWM_PHASE_MAX_COUNT];
#endif
multi_wave_s wave;

View File

@ -154,7 +154,7 @@ public class TriggerImage {
for (Signal s : toShow) {
int waveIndex = s.signal / 1000;
int signal = s.signal % 1000;
WaveState.trigger_value_e signal = (s.signal % 1000 == 0) ?WaveState.trigger_value_e.TV_LOW : WaveState.trigger_value_e.TV_HIGH;
if (waveIndex > 1) {
// TT_HONDA_ACCORD_CD

View File

@ -16,8 +16,13 @@ public class WaveState {
public List<EngineReport.UpDown> list = new ArrayList<>();
public void handle(int signal, double angle) {
if (signal == 1) {
public enum trigger_value_e {
TV_LOW,
TV_HIGH
}
public void handle(WaveState.trigger_value_e signal, double angle) {
if (signal == trigger_value_e.TV_LOW) {
// down signal
if (Double.isNaN(prevUp)) {
// we have down before up, we would need to use it later