mirror of https://github.com/FOME-Tech/fome-fw.git
auto-sync
This commit is contained in:
parent
3d17d5d7ad
commit
bbd11d3fc0
|
@ -376,6 +376,8 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
engineConfiguration->hasBaroSensor = false;
|
engineConfiguration->hasBaroSensor = false;
|
||||||
engineConfiguration->isDigitalChartEnabled = true;
|
engineConfiguration->isDigitalChartEnabled = true;
|
||||||
|
|
||||||
|
engineConfiguration->useOnlyFrontForTrigger = false;
|
||||||
|
|
||||||
boardConfiguration->idle.solenoidFrequency = 200;
|
boardConfiguration->idle.solenoidFrequency = 200;
|
||||||
// set_idle_position 50
|
// set_idle_position 50
|
||||||
boardConfiguration->idlePosition = 50;
|
boardConfiguration->idlePosition = 50;
|
||||||
|
|
|
@ -109,26 +109,19 @@ void TriggerCentral::resetCounters() {
|
||||||
|
|
||||||
static char shaft_signal_msg_index[15];
|
static char shaft_signal_msg_index[15];
|
||||||
|
|
||||||
static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType, int index) {
|
static bool_t isUpEvent[6] = { false, true, false, true, false, true };
|
||||||
|
static const char *eventId[6] = { CRANK1, CRANK1, CRANK2, CRANK2, CRANK3, CRANK3 };
|
||||||
|
|
||||||
|
static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType, int index DECLARE_ENGINE_PARAMETER_S) {
|
||||||
itoa10(&shaft_signal_msg_index[2], index);
|
itoa10(&shaft_signal_msg_index[2], index);
|
||||||
if (ckpSignalType == SHAFT_PRIMARY_UP) {
|
bool_t isUp = isUpEvent[(int) ckpSignalType];
|
||||||
shaft_signal_msg_index[0] = 'u';
|
shaft_signal_msg_index[0] = isUp ? 'u' : 'd';
|
||||||
addWaveChartEvent(CRANK1, (char* ) shaft_signal_msg_index);
|
|
||||||
} else if (ckpSignalType == SHAFT_PRIMARY_DOWN) {
|
addWaveChartEvent(eventId[(int )ckpSignalType], (char* ) shaft_signal_msg_index);
|
||||||
shaft_signal_msg_index[0] = 'd';
|
if (engineConfiguration->useOnlyFrontForTrigger) {
|
||||||
addWaveChartEvent(CRANK1, (char* ) shaft_signal_msg_index);
|
// let's add the opposite event right away
|
||||||
} else if (ckpSignalType == SHAFT_SECONDARY_UP) {
|
shaft_signal_msg_index[0] = isUp ? 'd' : 'u';
|
||||||
shaft_signal_msg_index[0] = 'u';
|
addWaveChartEvent(eventId[(int )ckpSignalType], (char* ) shaft_signal_msg_index);
|
||||||
addWaveChartEvent(CRANK2, (char* ) shaft_signal_msg_index);
|
|
||||||
} else if (ckpSignalType == SHAFT_SECONDARY_DOWN) {
|
|
||||||
shaft_signal_msg_index[0] = 'd';
|
|
||||||
addWaveChartEvent(CRANK2, (char* ) shaft_signal_msg_index);
|
|
||||||
} else if (ckpSignalType == SHAFT_3RD_UP) {
|
|
||||||
shaft_signal_msg_index[0] = 'u';
|
|
||||||
addWaveChartEvent(CRANK3, (char* ) shaft_signal_msg_index);
|
|
||||||
} else if (ckpSignalType == SHAFT_3RD_DOWN) {
|
|
||||||
shaft_signal_msg_index[0] = 'd';
|
|
||||||
addWaveChartEvent(CRANK3, (char* ) shaft_signal_msg_index);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +174,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
|
||||||
|
|
||||||
triggerIndexForListeners = triggerState.getCurrentIndex() + (isEven ? 0 : TRIGGER_SHAPE(size));
|
triggerIndexForListeners = triggerState.getCurrentIndex() + (isEven ? 0 : TRIGGER_SHAPE(size));
|
||||||
}
|
}
|
||||||
reportEventToWaveChart(signal, triggerIndexForListeners);
|
reportEventToWaveChart(signal, triggerIndexForListeners PASS_ENGINE_PARAMETER);
|
||||||
|
|
||||||
if (triggerState.current_index >= TRIGGER_SHAPE(size)) {
|
if (triggerState.current_index >= TRIGGER_SHAPE(size)) {
|
||||||
warning(OBD_PCM_Processor_Fault, "unexpected eventIndex=%d", triggerState.current_index);
|
warning(OBD_PCM_Processor_Fault, "unexpected eventIndex=%d", triggerState.current_index);
|
||||||
|
@ -236,9 +229,10 @@ void triggerInfo(Engine *engine) {
|
||||||
|
|
||||||
TriggerShape *ts = &engine->triggerShape;
|
TriggerShape *ts = &engine->triggerShape;
|
||||||
|
|
||||||
scheduleMsg(logger, "Template %s (%d) trigger %s (%d) useRiseEdge=%s only=", getConfigurationName(engineConfiguration->engineType),
|
scheduleMsg(logger, "Template %s (%d) trigger %s (%d) useRiseEdge=%s onlyFront=%s",
|
||||||
engineConfiguration->engineType, getTrigger_type_e(engineConfiguration->trigger.type),
|
getConfigurationName(engineConfiguration->engineType), engineConfiguration->engineType,
|
||||||
engineConfiguration->trigger.type, boolToString(TRIGGER_SHAPE(useRiseEdge)));
|
getTrigger_type_e(engineConfiguration->trigger.type), engineConfiguration->trigger.type,
|
||||||
|
boolToString(TRIGGER_SHAPE(useRiseEdge)), boolToString(engineConfiguration->useOnlyFrontForTrigger));
|
||||||
|
|
||||||
scheduleMsg(logger, "trigger#1 event counters up=%d/down=%d", triggerCentral.getHwEventCounter(0),
|
scheduleMsg(logger, "trigger#1 event counters up=%d/down=%d", triggerCentral.getHwEventCounter(0),
|
||||||
triggerCentral.getHwEventCounter(1));
|
triggerCentral.getHwEventCounter(1));
|
||||||
|
@ -266,14 +260,10 @@ void triggerInfo(Engine *engine) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
scheduleMsg(logger, "sn=%s ignitionMathTime=%d schTime=%d injectonSchTime=%d zeroTestTime=%d advanceTime=%d triggerMaxDuration=%d",
|
scheduleMsg(logger,
|
||||||
boolToString(ts->isSynchronizationNeeded),
|
"sn=%s ignitionMathTime=%d schTime=%d injectonSchTime=%d zeroTestTime=%d advanceTime=%d triggerMaxDuration=%d",
|
||||||
engine->m.ignitionMathTime,
|
boolToString(ts->isSynchronizationNeeded), engine->m.ignitionMathTime, engine->m.ignitionSchTime,
|
||||||
engine->m.ignitionSchTime,
|
engine->m.injectonSchTime, engine->m.zeroTestTime, engine->m.advanceTime, triggerMaxDuration);
|
||||||
engine->m.injectonSchTime,
|
|
||||||
engine->m.zeroTestTime,
|
|
||||||
engine->m.advanceTime,
|
|
||||||
triggerMaxDuration);
|
|
||||||
|
|
||||||
triggerMaxDuration = 0;
|
triggerMaxDuration = 0;
|
||||||
|
|
||||||
|
@ -286,7 +276,6 @@ void triggerInfo(Engine *engine) {
|
||||||
getPin_output_mode_e(boardConfiguration->triggerSimulatorPinModes[0]),
|
getPin_output_mode_e(boardConfiguration->triggerSimulatorPinModes[0]),
|
||||||
boardConfiguration->triggerSimulatorFrequency);
|
boardConfiguration->triggerSimulatorFrequency);
|
||||||
|
|
||||||
|
|
||||||
if (engine->triggerShape.needSecondTriggerInput) {
|
if (engine->triggerShape.needSecondTriggerInput) {
|
||||||
scheduleMsg(logger, "secondary trigger input: %s", hwPortname(boardConfiguration->triggerInputPins[1]));
|
scheduleMsg(logger, "secondary trigger input: %s", hwPortname(boardConfiguration->triggerInputPins[1]));
|
||||||
#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__)
|
#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__)
|
||||||
|
|
|
@ -121,8 +121,6 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, uint64_t now
|
||||||
eventCount[triggerWheel]++;
|
eventCount[triggerWheel]++;
|
||||||
eventCountExt[signal]++;
|
eventCountExt[signal]++;
|
||||||
|
|
||||||
bool_t isLessImportant = (TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_UP)
|
|
||||||
|| (!TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_DOWN);
|
|
||||||
|
|
||||||
uint64_t currentDurationLong = getCurrentGapDuration(nowNt);
|
uint64_t currentDurationLong = getCurrentGapDuration(nowNt);
|
||||||
|
|
||||||
|
@ -133,7 +131,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, uint64_t now
|
||||||
currentDuration =
|
currentDuration =
|
||||||
currentDurationLong > 10 * US2NT(US_PER_SECOND_LL) ? 10 * US2NT(US_PER_SECOND_LL) : currentDurationLong;
|
currentDurationLong > 10 * US2NT(US_PER_SECOND_LL) ? 10 * US2NT(US_PER_SECOND_LL) : currentDurationLong;
|
||||||
|
|
||||||
if (isLessImportant) {
|
if (isLessImportant(signal)) {
|
||||||
/**
|
/**
|
||||||
* For less important events we simply increment the index.
|
* For less important events we simply increment the index.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -101,4 +101,8 @@ void initTriggerDecoderLogger(Logging *sharedLogger);
|
||||||
|
|
||||||
bool_t isTriggerDecoderError(void);
|
bool_t isTriggerDecoderError(void);
|
||||||
|
|
||||||
|
#define isLessImportant(signal) ((TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_UP) \
|
||||||
|
|| (!TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_DOWN))
|
||||||
|
|
||||||
|
|
||||||
#endif /* TRIGGER_DECODER_H_ */
|
#endif /* TRIGGER_DECODER_H_ */
|
||||||
|
|
|
@ -55,11 +55,8 @@ int TriggerShape::getTriggerShapeSynchPointIndex() {
|
||||||
|
|
||||||
void TriggerShape::calculateTriggerSynchPoint(DECLARE_ENGINE_PARAMETER_F) {
|
void TriggerShape::calculateTriggerSynchPoint(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
trigger_config_s const*triggerConfig = &engineConfiguration->trigger;
|
trigger_config_s const*triggerConfig = &engineConfiguration->trigger;
|
||||||
setTriggerShapeSynchPointIndex(engineConfiguration, findTriggerZeroEventIndex(this, triggerConfig PASS_ENGINE_PARAMETER), engine);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TriggerShape::setTriggerShapeSynchPointIndex(engine_configuration_s *engineConfiguration, int triggerShapeSynchPointIndex, Engine *engine) {
|
triggerShapeSynchPointIndex = findTriggerZeroEventIndex(this, triggerConfig PASS_ENGINE_PARAMETER);
|
||||||
this->triggerShapeSynchPointIndex = triggerShapeSynchPointIndex;
|
|
||||||
|
|
||||||
engine->engineCycleEventCount = getLength();
|
engine->engineCycleEventCount = getLength();
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,6 @@ public:
|
||||||
|
|
||||||
void calculateTriggerSynchPoint(DECLARE_ENGINE_PARAMETER_F);
|
void calculateTriggerSynchPoint(DECLARE_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
void setTriggerShapeSynchPointIndex(engine_configuration_s *engineConfiguration, int triggerShapeSynchPointIndex, Engine *engine);
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
trigger_shape_helper h;
|
trigger_shape_helper h;
|
||||||
|
|
|
@ -41,6 +41,8 @@ static void shaft_icu_width_callback(ICUDriver *icup) {
|
||||||
// todo: add support for 3rd channel
|
// todo: add support for 3rd channel
|
||||||
trigger_event_e signal = isPrimary ? SHAFT_PRIMARY_UP : SHAFT_SECONDARY_UP;
|
trigger_event_e signal = isPrimary ? SHAFT_PRIMARY_UP : SHAFT_SECONDARY_UP;
|
||||||
|
|
||||||
|
if (isLessImportant(signal) && CONFIG(useOnlyFrontForTrigger))
|
||||||
|
return;
|
||||||
hwHandleShaftSignal(signal);
|
hwHandleShaftSignal(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +55,8 @@ static void shaft_icu_period_callback(ICUDriver *icup) {
|
||||||
// todo: add support for 3rd channel
|
// todo: add support for 3rd channel
|
||||||
// icucnt_t last_period = icuGetPeriod(icup); so far we are fine with system time
|
// icucnt_t last_period = icuGetPeriod(icup); so far we are fine with system time
|
||||||
trigger_event_e signal = isPrimary ? SHAFT_PRIMARY_DOWN : SHAFT_SECONDARY_DOWN;
|
trigger_event_e signal = isPrimary ? SHAFT_PRIMARY_DOWN : SHAFT_SECONDARY_DOWN;
|
||||||
|
if (isLessImportant(signal) && CONFIG(useOnlyFrontForTrigger))
|
||||||
|
return;
|
||||||
hwHandleShaftSignal(signal);
|
hwHandleShaftSignal(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue