auto-sync

This commit is contained in:
rusEfi 2015-08-30 14:01:28 -04:00
parent fa4be010b5
commit 72c1d20fe5
8 changed files with 24 additions and 17 deletions

View File

@ -25,7 +25,7 @@
class FuelSchedule { class FuelSchedule {
public: public:
FuelSchedule(); FuelSchedule();
InjectionEventList events; InjectionEventList injectionEvents;
/** /**
* this method schedules all fuel events for an engine cycle * 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); warning(OBD_PCM_Processor_Fault, "no_pin_inj #%s", output->name);
} }
InjectionEvent *ev = events.add(); InjectionEvent *ev = injectionEvents.add();
if (ev == NULL) { if (ev == NULL) {
// error already reported // error already reported
return; return;
@ -155,7 +155,7 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
clear(); // this method is relatively heavy clear(); // this method is relatively heavy
// sourceList->reset(); // sourceList->reset();
events.reset(); injectionEvents.reset();
efiAssertVoid(engine!=NULL, "engine is NULL"); 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) ? isCrankingR(rpm) ?
&ENGINE(engineConfiguration2)->crankingInjectionEvents : &engine->engineConfiguration2->injectionEvents; &ENGINE(engineConfiguration2)->crankingInjectionEvents : &engine->engineConfiguration2->injectionEvents;
InjectionEventList *source = &fs->events; InjectionEventList *source = &fs->injectionEvents;
if (!fs->hasEvents[eventIndex]) if (!fs->hasEvents[eventIndex])
return; return;

View File

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

View File

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

View File

@ -154,7 +154,7 @@ public class TriggerImage {
for (Signal s : toShow) { for (Signal s : toShow) {
int waveIndex = s.signal / 1000; 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) { if (waveIndex > 1) {
// TT_HONDA_ACCORD_CD // TT_HONDA_ACCORD_CD

View File

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