auto-sync

This commit is contained in:
rusEfi 2015-02-02 23:04:02 -06:00
parent f59fb7a9a0
commit b9eb97d485
19 changed files with 36 additions and 39 deletions

View File

@ -29,5 +29,5 @@ void setGy6139qmbDefaultEngineConfiguration(engine_configuration_s *engineConfig
engineConfiguration->trigger.customTotalToothCount = 1;
engineConfiguration->trigger.customSkippedToothCount = 0;
engineConfiguration->trigger.customIsSynchronizationNeeded = false;
engineConfiguration->needSecondTriggerInput = false;
engineConfiguration->trigger.customNeedSecondTriggerInput = false;
}

View File

@ -189,7 +189,6 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat
// set_global_trigger_offset_angle 46
engineConfiguration->globalTriggerAngleOffset = 46;
engineConfiguration->needSecondTriggerInput = false;
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
engineConfiguration->injectionMode = IM_SEQUENTIAL;

View File

@ -249,12 +249,10 @@ void setFordEscortGt(engine_configuration_s *engineConfiguration) {
// in case of SOHC distributor we only have one signal
// boardConfiguration->triggerInputPins[0] = GPIOA_5; // 2E White CKP
// boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
// engineConfiguration->needSecondTriggerInput = false;
// in case of SOHC distributor we only have one signal
boardConfiguration->triggerInputPins[0] = GPIOC_6;
boardConfiguration->triggerInputPins[1] = GPIOA_5; // 2E White CKP
engineConfiguration->needSecondTriggerInput = true;
engineConfiguration->map.sensor.type = MT_DENSO183;

View File

@ -25,7 +25,7 @@ void setSachs(engine_configuration_s *engineConfiguration) {
engineConfiguration->trigger.customTotalToothCount = 1;
engineConfiguration->trigger.customSkippedToothCount = 0;
engineConfiguration->trigger.customIsSynchronizationNeeded = false;
engineConfiguration->needSecondTriggerInput = false;
engineConfiguration->trigger.customNeedSecondTriggerInput = false;
engineConfiguration->hasIatSensor = false;

View File

@ -290,7 +290,6 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
engineConfiguration->logFormat = LF_NATIVE;
engineConfiguration->directSelfStimulation = false;
engineConfiguration->needSecondTriggerInput = true;
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
engineConfiguration->HD44780width = 20;

View File

@ -1,4 +1,4 @@
// this section was generated by config_definition.jar on Mon Feb 02 22:40:26 EST 2015
// this section was generated by config_definition.jar on Mon Feb 02 22:51:59 EST 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -169,7 +169,7 @@ typedef struct {
bool_t customIsSynchronizationNeeded : 1;
/**
offset 4 bit 1 */
bool_t customUseSecondChannel : 1;
bool_t customNeedSecondTriggerInput : 1;
/**
* offset 8
*/
@ -988,7 +988,7 @@ typedef struct {
bool_t secondTriggerChannelEnabled : 1;
/**
offset 9496 bit 4 */
bool_t needSecondTriggerInput : 1;
bool_t needSecondTriggerInputDeprecated : 1;
/**
offset 9496 bit 5 */
bool_t isMapAveragingEnabled : 1;
@ -1130,4 +1130,4 @@ typedef struct {
} engine_configuration_s;
// end
// this section was generated by config_definition.jar on Mon Feb 02 22:40:26 EST 2015
// this section was generated by config_definition.jar on Mon Feb 02 22:51:59 EST 2015

View File

@ -16,8 +16,7 @@ static inline float addPair(TriggerShape *s, float a, float w) {
}
void configureMiniCooperTriggerShape(TriggerShape *s) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
// s->initialState[0] = 1;

View File

@ -242,7 +242,7 @@ void triggerInfo(Engine *engine) {
scheduleMsg(logger, "trigger#1 event counters up=%d/down=%d", triggerCentral.getHwEventCounter(0),
triggerCentral.getHwEventCounter(1));
if (engineConfiguration->needSecondTriggerInput) {
if (engine->triggerShape.needSecondTriggerInput) {
scheduleMsg(logger, "trigger#2 event counters up=%d/down=%d", triggerCentral.getHwEventCounter(2),
triggerCentral.getHwEventCounter(3));
}
@ -250,7 +250,7 @@ void triggerInfo(Engine *engine) {
engine->triggerShape.expectedEventCount[1], ts->expectedEventCount[2]);
scheduleMsg(logger, "trigger type=%d/need2ndChannel=%s", engineConfiguration->trigger.type,
boolToString(engineConfiguration->needSecondTriggerInput));
boolToString(engine->triggerShape.needSecondTriggerInput));
scheduleMsg(logger, "expected duty #0=%f/#1=%f", ts->dutyCycle[0], ts->dutyCycle[1]);
scheduleMsg(logger, "isError %s/total errors=%d ord_err=%d/total revolutions=%d/self=%s",
@ -281,7 +281,7 @@ void triggerInfo(Engine *engine) {
boardConfiguration->triggerSimulatorFrequency);
if (engineConfiguration->needSecondTriggerInput) {
if (engine->triggerShape.needSecondTriggerInput) {
scheduleMsg(logger, "secondary trigger input: %s", hwPortname(boardConfiguration->triggerInputPins[1]));
scheduleMsg(logger, "secondary trigger simulator: %s %s phase=%d",
hwPortname(boardConfiguration->triggerSimulatorPins[1]),

View File

@ -8,7 +8,7 @@
#include "trigger_chrysler.h"
void configureNeon2003TriggerShape(TriggerShape *s) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
// voodoo magic - we always need 720 at the end
int base = 10;
@ -43,7 +43,7 @@ void configureNeon2003TriggerShape(TriggerShape *s) {
}
void configureNeon1995TriggerShape(TriggerShape *s) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
setTriggerSynchronizationGap(s, 0.72);

View File

@ -230,7 +230,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, uint64_t now
static void initializeSkippedToothTriggerShape(TriggerShape *s, int totalTeethCount, int skippedCount,
operation_mode_e operationMode) {
efiAssertVoid(s != NULL, "TriggerShape is NULL");
s->reset(operationMode);
s->reset(operationMode, false);
float toothWidth = 0.5;
@ -256,7 +256,7 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount,
}
static void configureOnePlusOne(TriggerShape *s) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
s->addEvent(180, T_PRIMARY, TV_HIGH);
s->addEvent(360, T_PRIMARY, TV_LOW);

View File

@ -8,7 +8,7 @@
#include "trigger_gm.h"
void configureGmTriggerShape(TriggerShape *s) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, false);
// all angles are x2 here - so, 5 degree width is 10
float w = 10;

View File

@ -21,7 +21,7 @@
#include "trigger_mazda.h"
void initializeMazdaMiataNaShape(TriggerShape *s) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
setTriggerSynchronizationGap(s, MIATA_NA_GAP);
s->useRiseEdge = false;
@ -51,7 +51,7 @@ void initializeMazdaMiataNbShape(TriggerShape *s) {
setTriggerSynchronizationGap(s, 0.11f);
s->useRiseEdge = false;
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
/**
* cam sensor is primary, crank sensor is secondary
@ -89,7 +89,7 @@ void configureMazdaProtegeSOHC(TriggerShape *s) {
// todo: move to into configuration definition s->needSecondTriggerInput = FALSE;
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, false);
// s->initialState[0] = 1;
// float w = 720 / 4 * 0.215;
@ -115,7 +115,7 @@ void configureMazdaProtegeSOHC(TriggerShape *s) {
void configureMazdaProtegeLx(TriggerShape *s) {
// todo: move to into configuration definition s->needSecondTriggerInput = FALSE;
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
/**
* based on https://svn.code.sf.net/p/rusefi/code/trunk/misc/logs/1993_escort_gt/MAIN_rfi_report_2015-02-01%2017_39.csv

View File

@ -9,7 +9,7 @@
void configureFordAspireTriggerShape(TriggerShape * s) {
s->isSynchronizationNeeded = false;
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
float x = 121.90;
@ -29,7 +29,7 @@ void configureFordAspireTriggerShape(TriggerShape * s) {
}
void initializeMitsubishi4g18(TriggerShape *s) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
s->useRiseEdge = false;
setTriggerSynchronizationGap(s, 1.6666);

View File

@ -34,7 +34,7 @@ trigger_shape_helper::trigger_shape_helper() {
TriggerShape::TriggerShape() :
wave(switchTimesBuffer, NULL) {
reset(OM_NONE);
reset(OM_NONE, false);
wave.waves = h.waves;
useRiseEdge = false;
gapBothDirections = false;
@ -75,7 +75,7 @@ void TriggerShape::setTriggerShapeSynchPointIndex(engine_configuration_s *engine
}
}
void TriggerShape::reset(operation_mode_e operationMode) {
void TriggerShape::reset(operation_mode_e operationMode, bool needSecondTriggerInput) {
this->operationMode = operationMode;
size = 0;
triggerShapeSynchPointIndex = 0;
@ -320,7 +320,7 @@ static float addAccordPair3(TriggerShape *s, float sb) {
* http://forum.pgmfi.org/viewtopic.php?f=2&t=15570start=210#p139007
*/
void configureHondaAccordCDDip(TriggerShape *s) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
s->initialState[T_SECONDARY] = TV_HIGH;
float sb = 0;
@ -383,7 +383,7 @@ void configureHondaAccordCDDip(TriggerShape *s) {
}
void configureHondaAccordCD(TriggerShape *s, bool with3rdSignal) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
float sb = 5.0f;

View File

@ -32,6 +32,7 @@ class TriggerShape {
public:
TriggerShape();
bool_t isSynchronizationNeeded;
bool_t needSecondTriggerInput;
int totalToothCount;
int skippedToothCount;
@ -67,7 +68,7 @@ public:
uint32_t expectedEventCount[PWM_PHASE_MAX_WAVE_PER_PWM];
void addEvent(float angle, trigger_wheel_e const waveIndex, trigger_value_e const state);
void reset(operation_mode_e operationMode);
void reset(operation_mode_e operationMode, bool needSecondTriggerInput);
int getSize() const;
multi_wave_s wave;

View File

@ -21,6 +21,7 @@
static WaveReaderHw primaryCrankInput;
static WaveReaderHw secondaryCrankInput;
EXTERN_ENGINE;
extern engine_configuration_s *engineConfiguration;
extern engine_configuration2_s *engineConfiguration2;
extern board_configuration_s *boardConfiguration;
@ -33,7 +34,7 @@ static void shaft_icu_width_callback(ICUDriver *icup) {
// todo: support for 3rd trigger input channel
// todo: start using real event time from HW event, not just software timer?
int isPrimary = icup == primaryCrankInput.driver;
if (!isPrimary && !engineConfiguration->needSecondTriggerInput) {
if (!isPrimary && !engine->triggerShape.needSecondTriggerInput) {
return;
}
// icucnt_t last_width = icuGetWidth(icup); so far we are fine with system time
@ -45,7 +46,7 @@ static void shaft_icu_width_callback(ICUDriver *icup) {
static void shaft_icu_period_callback(ICUDriver *icup) {
int isPrimary = icup == primaryCrankInput.driver;
if (!isPrimary && !engineConfiguration->needSecondTriggerInput) {
if (!isPrimary && !engine->triggerShape.needSecondTriggerInput) {
return;
}

View File

@ -216,7 +216,7 @@ custom trigger_type_e 4 bits, U32, @OFFSET@, [0:4], "custom toothed wheel",
trigger_type_e type;
bit customIsSynchronizationNeeded;
bit customUseSecondChannel;
bit customNeedSecondTriggerInput;
int customTotalToothCount;;"number", 1, 0.0, 0, 1000.0, 2
int customSkippedToothCount;;"number", 1, 0.0, 0, 1000.0, 2
@ -433,7 +433,7 @@ bit hasMapSensor;@see isMapAveragingEnabled
bit isIgnitionEnabled
bit isCylinderCleanupEnabled
bit secondTriggerChannelEnabled
bit needSecondTriggerInput
bit needSecondTriggerInputDeprecated
bit isMapAveragingEnabled
bit isMilEnabled
bit isFuelPumpEnabled

View File

@ -37,7 +37,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated by ConfigDefinition.jar on Mon Feb 02 22:40:27 EST 2015
; this section was generated by ConfigDefinition.jar on Mon Feb 02 22:52:00 EST 2015
pageSize = 11832
page = 1
@ -128,7 +128,7 @@ page = 1
analogChartFrequency = scalar, S32, 1024, "index", 1, 0, 0, 300, 0 ; size 4
trigger_type = bits, U32, 1028, [0:4], "custom toothed wheel", "ford aspire", "dodge neon", "Miata NA", "Miata NB", "GM_7X", "Cooper", "Mazda SOHC 4", "60/2", "36/1", "Accord CD", "MITSU", "ACCORD 2", "ACCORD DIP", "Neon 2003", "MAZDA D 4+1", "1+1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
trigger_customIsSynchronizationNeeded= bits, U32, 1032, [0:0], "false", "true"
trigger_customUseSecondChannel= bits, U32, 1032, [1:1], "false", "true"
trigger_customNeedSecondTriggerInput= bits, U32, 1032, [1:1], "false", "true"
trigger_customTotalToothCount = scalar, S32, 1036, "number", 1, 0.0, 0, 1000.0, 2
trigger_customSkippedToothCount = scalar, S32, 1040, "number", 1, 0.0, 0, 1000.0, 2
trigger_customSyncRatioFrom = scalar, F32, 1044, "number", 1, 0.0, 0, 1000.0, 2
@ -407,7 +407,7 @@ page = 1
isIgnitionEnabled = bits, U32, 9496, [1:1], "false", "true"
isCylinderCleanupEnabled= bits, U32, 9496, [2:2], "false", "true"
secondTriggerChannelEnabled= bits, U32, 9496, [3:3], "false", "true"
needSecondTriggerInput = bits, U32, 9496, [4:4], "false", "true"
needSecondTriggerInputDeprecated= bits, U32, 9496, [4:4], "false", "true"
isMapAveragingEnabled = bits, U32, 9496, [5:5], "false", "true"
isMilEnabled = bits, U32, 9496, [6:6], "false", "true"
isFuelPumpEnabled = bits, U32, 9496, [7:7], "false", "true"

View File

@ -104,7 +104,7 @@ void testFuelMap(void) {
extern engine_configuration_s *engineConfiguration;
static void confgiureFordAspireTriggerShape(TriggerShape * s) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->reset(FOUR_STROKE_CAM_SENSOR, true);
s->addEvent(53.747, T_SECONDARY, TV_HIGH);
s->addEvent(121.90, T_SECONDARY, TV_LOW);