refactoring
This commit is contained in:
parent
0c3f73c2b4
commit
9d0c5540d8
|
@ -126,7 +126,7 @@ void calculateTriggerSynchPoint(TriggerWaveform *shape, TriggerState *state DECL
|
||||||
#endif
|
#endif
|
||||||
trigger_config_s const*triggerConfig = &engineConfiguration->trigger;
|
trigger_config_s const*triggerConfig = &engineConfiguration->trigger;
|
||||||
|
|
||||||
shape->triggerShapeSynchPointIndex = findTriggerZeroEventIndex(state, shape, triggerConfig PASS_ENGINE_PARAMETER_SUFFIX);
|
shape->triggerShapeSynchPointIndex = state->findTriggerZeroEventIndex(shape, triggerConfig PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
int length = shape->getLength();
|
int length = shape->getLength();
|
||||||
engine->engineCycleEventCount = length;
|
engine->engineCycleEventCount = length;
|
||||||
|
@ -719,16 +719,16 @@ static void onFindIndexCallback(TriggerState *state) {
|
||||||
*
|
*
|
||||||
* This function finds the index of synchronization event within TriggerWaveform
|
* This function finds the index of synchronization event within TriggerWaveform
|
||||||
*/
|
*/
|
||||||
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerWaveform * shape,
|
uint32_t TriggerState::findTriggerZeroEventIndex(TriggerWaveform * shape,
|
||||||
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
UNUSED(triggerConfig);
|
UNUSED(triggerConfig);
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 128, "findPos", -1);
|
efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 128, "findPos", -1);
|
||||||
#endif
|
#endif
|
||||||
errorDetection.clear();
|
errorDetection.clear();
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, state != NULL, "NULL state", -1);
|
|
||||||
|
|
||||||
state->resetTriggerState();
|
|
||||||
|
resetTriggerState();
|
||||||
|
|
||||||
if (shape->shapeDefinitionError) {
|
if (shape->shapeDefinitionError) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -738,11 +738,11 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerWaveform * shape,
|
||||||
// todo: should this variable be declared 'static' to reduce stack usage?
|
// todo: should this variable be declared 'static' to reduce stack usage?
|
||||||
TriggerStimulatorHelper helper;
|
TriggerStimulatorHelper helper;
|
||||||
|
|
||||||
uint32_t syncIndex = helper.findTriggerSyncPoint(shape, state PASS_ENGINE_PARAMETER_SUFFIX);
|
uint32_t syncIndex = helper.findTriggerSyncPoint(shape, this PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
if (syncIndex == EFI_ERROR_CODE) {
|
if (syncIndex == EFI_ERROR_CODE) {
|
||||||
return syncIndex;
|
return syncIndex;
|
||||||
}
|
}
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, state->getTotalRevolutionCounter() == 1, "findZero_revCounter", EFI_ERROR_CODE);
|
efiAssert(CUSTOM_ERR_ASSERT, getTotalRevolutionCounter() == 1, "findZero_revCounter", EFI_ERROR_CODE);
|
||||||
|
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
|
@ -757,7 +757,7 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerWaveform * shape,
|
||||||
* todo: add a comment why are we doing '2 * shape->getSize()' here?
|
* todo: add a comment why are we doing '2 * shape->getSize()' here?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
helper.assertSyncPositionAndSetDutyCycle(onFindIndexCallback, syncIndex, state, shape PASS_ENGINE_PARAMETER_SUFFIX);
|
helper.assertSyncPositionAndSetDutyCycle(onFindIndexCallback, syncIndex, this, shape PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
return syncIndex % shape->getSize();
|
return syncIndex % shape->getSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,6 +120,9 @@ public:
|
||||||
* for virtual double trigger see timeAtVirtualZeroNt
|
* for virtual double trigger see timeAtVirtualZeroNt
|
||||||
*/
|
*/
|
||||||
efitick_t startOfCycleNt;
|
efitick_t startOfCycleNt;
|
||||||
|
|
||||||
|
uint32_t findTriggerZeroEventIndex(TriggerWaveform * shape, trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resetCurrentCycleState();
|
void resetCurrentCycleState();
|
||||||
|
|
||||||
|
@ -170,7 +173,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
angle_t getEngineCycle(operation_mode_e operationMode);
|
angle_t getEngineCycle(operation_mode_e operationMode);
|
||||||
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerWaveform * shape, trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX);
|
|
||||||
|
|
||||||
class Engine;
|
class Engine;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ static int getTriggerZeroEventIndex(engine_type_e engineType) {
|
||||||
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
TriggerWaveform * shape = ð.engine.triggerCentral.triggerShape;
|
TriggerWaveform * shape = ð.engine.triggerCentral.triggerShape;
|
||||||
return findTriggerZeroEventIndex(ð.engine.triggerCentral.triggerState, shape, &engineConfiguration->trigger PASS_ENGINE_PARAMETER_SUFFIX);
|
return eth.engine.triggerCentral.triggerState.findTriggerZeroEventIndex(shape, &engineConfiguration->trigger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void testDodgeNeonDecoder(void) {
|
static void testDodgeNeonDecoder(void) {
|
||||||
|
|
Loading…
Reference in New Issue