diff --git a/firmware/config/system/mcuconf.h b/firmware/config/system/mcuconf.h index 711b98173c..37b1ab2686 100644 --- a/firmware/config/system/mcuconf.h +++ b/firmware/config/system/mcuconf.h @@ -137,7 +137,7 @@ #define STM32_GPT_TIM2_IRQ_PRIORITY 7 #define STM32_GPT_TIM3_IRQ_PRIORITY 7 #define STM32_GPT_TIM4_IRQ_PRIORITY 7 -#define STM32_GPT_TIM5_IRQ_PRIORITY 3 +#define STM32_GPT_TIM5_IRQ_PRIORITY 4 #define STM32_GPT_TIM6_IRQ_PRIORITY 7 #define STM32_GPT_TIM7_IRQ_PRIORITY 7 #define STM32_GPT_TIM8_IRQ_PRIORITY 7 @@ -169,13 +169,13 @@ /* * ICU driver system settings. */ -#define STM32_ICU_TIM1_IRQ_PRIORITY 7 -#define STM32_ICU_TIM2_IRQ_PRIORITY 7 -#define STM32_ICU_TIM3_IRQ_PRIORITY 7 -#define STM32_ICU_TIM4_IRQ_PRIORITY 7 -#define STM32_ICU_TIM5_IRQ_PRIORITY 7 -#define STM32_ICU_TIM8_IRQ_PRIORITY 7 -#define STM32_ICU_TIM9_IRQ_PRIORITY 7 +#define STM32_ICU_TIM1_IRQ_PRIORITY 3 +#define STM32_ICU_TIM2_IRQ_PRIORITY 3 +#define STM32_ICU_TIM3_IRQ_PRIORITY 3 +#define STM32_ICU_TIM4_IRQ_PRIORITY 3 +#define STM32_ICU_TIM5_IRQ_PRIORITY 3 +#define STM32_ICU_TIM8_IRQ_PRIORITY 3 +#define STM32_ICU_TIM9_IRQ_PRIORITY 3 /* * MAC driver system settings. diff --git a/firmware/controllers/map_averaging.cpp b/firmware/controllers/map_averaging.cpp index 5b40d16246..49769adfce 100644 --- a/firmware/controllers/map_averaging.cpp +++ b/firmware/controllers/map_averaging.cpp @@ -180,7 +180,7 @@ void initMapAveraging(void) { endTimer[0].name = "map end0"; endTimer[1].name = "map end1"; - addTriggerEventListener(&shaftPositionCallback, "rpm reporter", NULL); +// addTriggerEventListener(&shaftPositionCallback, "rpm reporter", NULL); addConsoleAction("faststat", showMapStats); } diff --git a/firmware/controllers/trigger/rpm_calculator.cpp b/firmware/controllers/trigger/rpm_calculator.cpp index a2c864db0b..f4a3d0df17 100644 --- a/firmware/controllers/trigger/rpm_calculator.cpp +++ b/firmware/controllers/trigger/rpm_calculator.cpp @@ -34,6 +34,8 @@ extern WaveChart waveChart; #include "analog_chart.h" #endif /* EFI_PROD_CODE */ +#include "efilib2.h" + #define TOP_DEAD_CENTER_MESSAGE "r" EXTERN_ENGINE; @@ -120,6 +122,8 @@ bool isCranking(void) { } #endif +extern uint32_t triggerHanlderEntryTime; + /** * @brief Shaft position callback used by RPM calculation logic. * diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 7dc615e7ed..4035cb3bed 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -59,20 +59,21 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, E triggerCentral.addEventListener(listener, name, engine); } +uint32_t triggerHanlderEntryTime; + #if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) EXTERN_ENGINE ; int triggerReentraint = 0; int maxTriggerReentraint = 0; -uint32_t triggerBegin; uint32_t triggerDuration; uint32_t triggerMaxDuration = 0; extern bool isInsideTriggerHandler; void hwHandleShaftSignal(trigger_event_e signal) { - triggerBegin = GET_TIMESTAMP(); + triggerHanlderEntryTime = GET_TIMESTAMP(); isInsideTriggerHandler = true; if (triggerReentraint > maxTriggerReentraint) maxTriggerReentraint = triggerReentraint; @@ -80,7 +81,7 @@ void hwHandleShaftSignal(trigger_event_e signal) { efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#8"); triggerCentral.handleShaftSignal(signal, engine, engine->engineConfiguration); triggerReentraint--; - triggerDuration = GET_TIMESTAMP() - triggerBegin; + triggerDuration = GET_TIMESTAMP() - triggerHanlderEntryTime; isInsideTriggerHandler = false; if (triggerDuration > triggerMaxDuration) triggerMaxDuration = triggerDuration; diff --git a/firmware/emulation/wave_analyzer.cpp b/firmware/emulation/wave_analyzer.cpp index c4f28c0c64..daa4e2f924 100644 --- a/firmware/emulation/wave_analyzer.cpp +++ b/firmware/emulation/wave_analyzer.cpp @@ -247,7 +247,7 @@ void initWaveAnalyzer(void) { initWave(WA_CHANNEL_1, 0); initWave(WA_CHANNEL_2, 1); - addTriggerEventListener(waTriggerEventListener, "wave analyzer", NULL); +// addTriggerEventListener(waTriggerEventListener, "wave analyzer", NULL); addConsoleActionII("set_logic_input_mode", setWaveModeSilent);