From ffd917e653a4e9ef40b5510b918867364f165e30 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Thu, 22 Sep 2016 09:03:20 -0400 Subject: [PATCH] auto-sync --- firmware/controllers/algo/signal_executor.cpp | 27 ++++++++++++++----- firmware/controllers/system/efiGpio.cpp | 1 + firmware/controllers/system/efiGpio.h | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/firmware/controllers/algo/signal_executor.cpp b/firmware/controllers/algo/signal_executor.cpp index 9513ef6d27..0d38bb798a 100644 --- a/firmware/controllers/algo/signal_executor.cpp +++ b/firmware/controllers/algo/signal_executor.cpp @@ -115,7 +115,7 @@ extern LoggingWithStorage sharedLogger; // todo: make these macro? kind of a penny optimization if compiler is not smart to inline void seTurnPinHigh(InjectorOutputPin *output) { -// if (output->currentLogicValue == 1) { + if (output->currentLogicValue == 1) { // if (output->cancelNextTurningInjectorOff) { // // how comes AutoTest.testFordAspire ends up here? // } else { @@ -123,10 +123,14 @@ void seTurnPinHigh(InjectorOutputPin *output) { // * #299 // * this is another kind of overlap which happens in case of a small duty cycle after a large duty cycle // */ +#if EFI_SIMULATOR || defined(__DOXYGEN__) + printf("cancelNextTurningInjectorOff %s %d\r\n", output->name, (int)getTimeNowUs()); +#endif /* EFI_SIMULATOR */ + // output->cancelNextTurningInjectorOff = true; // return; // } -// } + } #if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) const char * w = output->currentLogicValue == true ? "err" : ""; scheduleMsg(&sharedLogger, "^ %spin=%s eventIndex %d %d", w, output->name, @@ -138,6 +142,9 @@ void seTurnPinHigh(InjectorOutputPin *output) { // firmwareError("Already high"); #endif +#if EFI_SIMULATOR || defined(__DOXYGEN__) + printf("seTurnPinHigh %s %d\r\n", output->name, (int)getTimeNowUs()); +#endif /* EFI_SIMULATOR */ turnPinHigh(output); } @@ -153,9 +160,16 @@ void seTurnPinLow(InjectorOutputPin *output) { * */ output->cancelNextTurningInjectorOff = false; +#if EFI_SIMULATOR || defined(__DOXYGEN__) + printf("was cancelled %s %d\r\n", output->name, (int)getTimeNowUs()); +#endif /* EFI_SIMULATOR */ return; } -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if EFI_SIMULATOR || defined(__DOXYGEN__) + printf("seTurnPinLow %s %d\r\n", output->name, (int)getTimeNowUs()); +#endif /* EFI_SIMULATOR */ + + #if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) const char * w = output->currentLogicValue == false ? "err" : ""; scheduleMsg(&sharedLogger, "- %spin=%s eventIndex %d %d", w, output->name, @@ -176,9 +190,10 @@ void seScheduleByTime(const char *prefix, scheduling_s *scheduling, efitimeus_t scheduleMsg(&sharedLogger, "schX %s", param->name); #endif /* FUEL_MATH_EXTREME_LOGGING */ -#if EFI_UNIT_TEST || defined(__DOXYGEN__) - printf("schB %s %d\r\n", param->name, time); -#endif /* EFI_UNIT_TEST */ +#if EFI_SIMULATOR || EFI_UNIT_TEST || defined(__DOXYGEN__) + printf("schB %s %d\r\n", param->name, (int)time); +#endif /* EFI_SIMULATOR || EFI_UNIT_TEST */ + scheduleByTime(prefix, scheduling, time, callback, param); } diff --git a/firmware/controllers/system/efiGpio.cpp b/firmware/controllers/system/efiGpio.cpp index 79754b979f..8e063cab65 100644 --- a/firmware/controllers/system/efiGpio.cpp +++ b/firmware/controllers/system/efiGpio.cpp @@ -38,6 +38,7 @@ engine_pins_s::engine_pins_s() { void InjectorOutputPin::reset() { overlappingScheduleOffTime = 0; cancelNextTurningInjectorOff = false; + overlappingCounter = 0; // todo: this could be refactored by calling some super-reset method currentLogicValue = INITIAL_PIN_STATE; } diff --git a/firmware/controllers/system/efiGpio.h b/firmware/controllers/system/efiGpio.h index 6de6e02da8..c372a9daa3 100644 --- a/firmware/controllers/system/efiGpio.h +++ b/firmware/controllers/system/efiGpio.h @@ -53,6 +53,7 @@ public: void reset(); efitimeus_t overlappingScheduleOffTime; bool cancelNextTurningInjectorOff; + int overlappingCounter; }; class engine_pins_s {