This commit is contained in:
parent
5ccc3bbef5
commit
7e3a7b5c79
|
@ -1332,7 +1332,7 @@ void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_S
|
|||
assertEngineReference();
|
||||
|
||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
||||
TRIGGER_SHAPE(initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
TRIGGER_SHAPE(initializeTriggerShape(logger, engineConfiguration->useOnlyRisingEdgeForTrigger PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
#endif
|
||||
|
||||
#if EFI_FSIO || defined(__DOXYGEN__)
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
#include "trigger_mazda.h"
|
||||
|
||||
void initializeMazdaMiataNaShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
// todo: remove useOnlyRisingEdgeForTrigger parameter from here see https://github.com/rusefi/rusefi/issues/635
|
||||
void initializeMazdaMiataNaShape(TriggerShape *s, bool useOnlyRisingEdgeForTrigger) {
|
||||
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
|
||||
s->setTriggerSynchronizationGap2(1.4930 * 0.6f, 1.4930 * 1.3f);
|
||||
s->useRiseEdge = false;
|
||||
|
@ -32,21 +33,21 @@ void initializeMazdaMiataNaShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX
|
|||
/**
|
||||
* http://rusefi.com/forum/viewtopic.php?f=3&t=729&p=12983#p12983
|
||||
*/
|
||||
s->addEvent2(52.960405, T_SECONDARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent2(122.635956, T_SECONDARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent(52.960405 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_RISE);
|
||||
s->addEvent(122.635956 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_FALL);
|
||||
|
||||
s->addEvent2(216.897031, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent2(232.640068, T_SECONDARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent2(288.819688, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent2(302.646323, T_SECONDARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent(216.897031 / 720, useOnlyRisingEdgeForTrigger, T_PRIMARY, TV_RISE);
|
||||
s->addEvent(232.640068 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_RISE);
|
||||
s->addEvent(288.819688 / 720, useOnlyRisingEdgeForTrigger, T_PRIMARY, TV_FALL);
|
||||
s->addEvent(302.646323 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_FALL);
|
||||
|
||||
s->addEvent2(412.448056, T_SECONDARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent2(482.816719, T_SECONDARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent(412.448056 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_RISE);
|
||||
s->addEvent(482.816719 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_FALL);
|
||||
|
||||
s->addEvent2(577.035495, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent2(592.878113, T_SECONDARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent2(662.899708, T_SECONDARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent2(720.0f, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->addEvent(577.035495 / 720, useOnlyRisingEdgeForTrigger, T_PRIMARY, TV_RISE);
|
||||
s->addEvent(592.878113 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_RISE);
|
||||
s->addEvent(662.899708 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_FALL);
|
||||
s->addEvent(720.0f / 720, useOnlyRisingEdgeForTrigger, T_PRIMARY, TV_FALL);
|
||||
s->useOnlyPrimaryForSync = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#define MIATA_NA_GAP 1.4930f
|
||||
|
||||
void initializeMazdaMiataNaShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void initializeMazdaMiataNaShape(TriggerShape *s, bool useOnlyRisingEdgeForTrigger);
|
||||
void initializeMazdaMiataNb1Shape(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void initializeMazdaMiataNb2Crank(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void initializeMazdaMiataVVtTestShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
|
|
@ -468,7 +468,7 @@ void printAllTriggers() {
|
|||
engineConfiguration->operationMode = FOUR_STROKE_CAM_SENSOR;
|
||||
|
||||
TriggerShape *s = &engine->triggerCentral.triggerShape;
|
||||
s->initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
s->initializeTriggerShape(NULL, engineConfiguration->useOnlyRisingEdgeForTrigger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
if (s->shapeDefinitionError) {
|
||||
printf("Trigger error %d\r\n", triggerId);
|
||||
|
@ -676,7 +676,7 @@ void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfig
|
|||
assertEngineReference();
|
||||
|
||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
||||
TRIGGER_SHAPE(initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
TRIGGER_SHAPE(initializeTriggerShape(logger, engineConfiguration->useOnlyRisingEdgeForTrigger PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
engine->triggerCentral.resetAccumSignalData();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -470,7 +470,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
/**
|
||||
* External logger is needed because at this point our logger is not yet initialized
|
||||
*/
|
||||
void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
void TriggerShape::initializeTriggerShape(Logging *logger, bool useOnlyRisingEdgeForTrigger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
const trigger_config_s *triggerConfig = &engineConfiguration->trigger;
|
||||
#if !EFI_UNIT_TEST
|
||||
// we have a confusing threading model so some synchronization would not hurt
|
||||
|
@ -492,7 +492,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET
|
|||
break;
|
||||
|
||||
case TT_MAZDA_MIATA_NA:
|
||||
initializeMazdaMiataNaShape(this PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
initializeMazdaMiataNaShape(this, useOnlyRisingEdgeForTrigger);
|
||||
break;
|
||||
|
||||
case TT_MAZDA_MIATA_NB1:
|
||||
|
@ -664,6 +664,8 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET
|
|||
shapeDefinitionError = true;
|
||||
warning(CUSTOM_ERR_NO_SHAPE, "initializeTriggerShape() not implemented: %d", triggerConfig->type);
|
||||
}
|
||||
calculateExpectedEventCounts(useOnlyRisingEdgeForTrigger);
|
||||
|
||||
if (!shapeDefinitionError) {
|
||||
wave.checkSwitchTimes(getSize());
|
||||
/**
|
||||
|
|
|
@ -293,6 +293,17 @@ operation_mode_e TriggerShape::getOperationMode() {
|
|||
extern bool printTriggerDebug;
|
||||
#endif
|
||||
|
||||
void TriggerShape::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger) {
|
||||
// todo: move the following logic from below here
|
||||
// if (!useOnlyRisingEdgeForTrigger || stateParam == TV_RISE) {
|
||||
// expectedEventCount[waveIndex]++;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated - see https://github.com/rusefi/rusefi/issues/635
|
||||
*/
|
||||
void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
/**
|
||||
* While '720' value works perfectly it has not much sense for crank sensor-only scenario.
|
||||
|
@ -300,6 +311,9 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri
|
|||
addEvent(angle / getEngineCycle(operationMode), engineConfiguration->useOnlyRisingEdgeForTrigger, waveIndex, stateParam);
|
||||
}
|
||||
|
||||
// todo: the whole 'useOnlyRisingEdgeForTrigger' parameter and logic should not be here
|
||||
// todo: see calculateExpectedEventCounts
|
||||
// related calculation should be done once trigger is initialized outside of trigger shape scope
|
||||
void TriggerShape::addEvent(angle_t angle, bool useOnlyRisingEdgeForTrigger, trigger_wheel_e const waveIndex, trigger_value_e const stateParam) {
|
||||
|
||||
efiAssertVoid(CUSTOM_OMODE_UNDEF, operationMode != OM_NONE, "operationMode not set");
|
||||
|
|
|
@ -54,7 +54,7 @@ class TriggerState;
|
|||
class TriggerShape {
|
||||
public:
|
||||
TriggerShape();
|
||||
void initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void initializeTriggerShape(Logging *logger, bool useOnlyRisingEdgeForTrigger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void findTriggerPosition(
|
||||
event_trigger_position_s *position, angle_t angleOffset DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
|
@ -135,6 +135,8 @@ public:
|
|||
*/
|
||||
bool gapBothDirections;
|
||||
|
||||
void calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger);
|
||||
|
||||
/**
|
||||
* This is used for signal validation
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue