reducing code duplication and applying event condition more consistently

This commit is contained in:
rusefi 2018-08-31 21:11:22 -04:00
parent c4af060432
commit 41688ba251
5 changed files with 6 additions and 17 deletions

View File

@ -733,5 +733,5 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0) if (initBootloader() != 0)
return 123; return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */ #endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20180819; return 20180831;
} }

View File

@ -210,17 +210,10 @@ void NamedOutputPin::setHigh() {
// turn the output level ACTIVE // turn the output level ACTIVE
setValue(true); setValue(true);
// sleep for the needed duration
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) #if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
// explicit check here is a performance optimization to speed up no-chart mode
if (ENGINE(isEngineChartEnabled)) {
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
addEngineSniffferEvent(name, WC_UP); addEngineSniffferEvent(name, WC_UP);
}
#endif /* EFI_ENGINE_SNIFFER */ #endif /* EFI_ENGINE_SNIFFER */
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
} }
void NamedOutputPin::setLow() { void NamedOutputPin::setLow() {
@ -234,9 +227,7 @@ void NamedOutputPin::setLow() {
#endif /* EFI_DEFAILED_LOGGING */ #endif /* EFI_DEFAILED_LOGGING */
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) #if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
if (ENGINE(isEngineChartEnabled)) {
addEngineSniffferEvent(name, WC_DOWN); addEngineSniffferEvent(name, WC_DOWN);
}
#endif /* EFI_ENGINE_SNIFFER */ #endif /* EFI_ENGINE_SNIFFER */
} }

View File

@ -324,7 +324,7 @@ static void tdcMarkCallback(trigger_event_e ckpSignalType,
if (isTriggerSynchronizationPoint && ENGINE(isEngineChartEnabled)) { if (isTriggerSynchronizationPoint && ENGINE(isEngineChartEnabled)) {
int revIndex2 = engine->rpmCalculator.getRevolutionCounter() % 2; int revIndex2 = engine->rpmCalculator.getRevolutionCounter() % 2;
int rpm = ENGINE(rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)); int rpm = ENGINE(rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
// todo: use event-based scheduling, not just time-based scheduling // todo: use tooth event-based scheduling, not just time-based scheduling
if (isValidRpm(rpm)) { if (isValidRpm(rpm)) {
scheduleByAngle(rpm, &tdcScheduler[revIndex2], tdcPosition(), scheduleByAngle(rpm, &tdcScheduler[revIndex2], tdcPosition(),
(schfunc_t) onTdcCallback, NULL, &engine->rpmCalculator); (schfunc_t) onTdcCallback, NULL, &engine->rpmCalculator);

View File

@ -177,7 +177,7 @@ int getRevolutionCounter(void);
#define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM) #define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM)
#if EFI_ENGINE_SNIFFER #if EFI_ENGINE_SNIFFER
#define addEngineSniffferEvent(name, msg) waveChart.addEvent3((name), (msg)) #define addEngineSniffferEvent(name, msg) if (ENGINE(isEngineChartEnabled)) { waveChart.addEvent3((name), (msg)); }
#else #else
#define addEngineSniffferEvent(n, msg) {} #define addEngineSniffferEvent(n, msg) {}
#endif /* EFI_ENGINE_SNIFFER */ #endif /* EFI_ENGINE_SNIFFER */

View File

@ -88,9 +88,7 @@ static efitick_t previousVvtCamTime = 0;
static efitick_t previousVvtCamDuration = 0; static efitick_t previousVvtCamDuration = 0;
void hwHandleVvtCamSignal(trigger_value_e front) { void hwHandleVvtCamSignal(trigger_value_e front) {
if (ENGINE(isEngineChartEnabled)) {
addEngineSniffferEvent(VVT_NAME, front == TV_RISE ? WC_UP : WC_DOWN); addEngineSniffferEvent(VVT_NAME, front == TV_RISE ? WC_UP : WC_DOWN);
}
if (boardConfiguration->vvtCamSensorUseRise ^ (front != TV_FALL)) { if (boardConfiguration->vvtCamSensorUseRise ^ (front != TV_FALL)) {
return; return;