Trigger: warning code on normal engine start up #669

making more code unit-testable
This commit is contained in:
Andrey 2021-06-25 11:30:06 -04:00
parent 0c97b4bc83
commit 66b091a5a5
4 changed files with 10 additions and 9 deletions

View File

@ -286,13 +286,13 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL
}
#if EFI_PROD_CODE || EFI_SIMULATOR
int triggerReentraint = 0;
int maxTriggerReentraint = 0;
uint32_t triggerDuration;
uint32_t triggerMaxDuration = 0;
#if EFI_PROD_CODE || EFI_SIMULATOR
/**
* this method is invoked only by real hardware call-backs
*/
@ -317,14 +317,16 @@ void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
palWritePad(criticalErrorLedPort, criticalErrorLedPin, 0);
#endif // VR_HW_CHECK_MODE
handleShaftSignal(signal, timestamp);
handleShaftSignal2(signal, timestamp);
}
#endif /* EFI_PROD_CODE */
/**
* this method is invoked by both real hardware and self-stimulator
*/
void handleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
void handleShaftSignal2(trigger_event_e signal, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
ScopePerf perf(PE::HandleShaftSignal);
// Don't accept trigger input in case of some problems
@ -380,7 +382,6 @@ void handleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
triggerDuration = getTimeNowLowerNt() - triggerHandlerEntryTime;
triggerMaxDuration = maxI(triggerMaxDuration, triggerDuration);
}
#endif /* EFI_PROD_CODE */
void TriggerCentral::resetCounters() {
memset(hwEventCounters, 0, sizeof(hwEventCounters));

View File

@ -86,7 +86,7 @@ public:
};
void triggerInfo(void);
void handleShaftSignal(trigger_event_e signal, efitick_t timestamp);
void handleShaftSignal2(trigger_event_e signal, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp);
void hwHandleVvtCamSignal(trigger_value_e front, efitick_t timestamp, int index DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -47,7 +47,7 @@ EXTERN_ENGINE;
static OutputPin emulatorOutputs[PWM_PHASE_MAX_WAVE_PER_PWM];
void TriggerEmulatorHelper::handleEmulatorCallback(PwmConfig *state, int stateIndex) {
void TriggerEmulatorHelper::handleEmulatorCallback(PwmConfig *state, int stateIndex DECLARE_ENGINE_PARAMETER_SUFFIX) {
efitick_t stamp = getTimeNowNt();
// todo: code duplication with TriggerStimulatorHelper::feedSimulatedEvent?
@ -62,7 +62,7 @@ void TriggerEmulatorHelper::handleEmulatorCallback(PwmConfig *state, int stateIn
trigger_event_e event = (currentValue ? riseEvents : fallEvents)[i];
handleShaftSignal(event, stamp);
handleShaftSignal2(event, stamp PASS_ENGINE_PARAMETER_SUFFIX);
}
}
}

View File

@ -26,7 +26,7 @@ void disableTriggerStimulator();
class TriggerEmulatorHelper {
public:
TriggerEmulatorHelper();
void handleEmulatorCallback(PwmConfig *state, int stateIndex);
void handleEmulatorCallback(PwmConfig *state, int stateIndex DECLARE_ENGINE_PARAMETER_SUFFIX);
};
void initTriggerEmulatorLogic(DECLARE_ENGINE_PARAMETER_SIGNATURE);