diff --git a/firmware/CHANGELOG.md b/firmware/CHANGELOG.md
index b46a25552b..2df7b6678c 100644
--- a/firmware/CHANGELOG.md
+++ b/firmware/CHANGELOG.md
@@ -45,6 +45,7 @@ or
- Displayed units in TunerStudio change when switching between volume vs. mass injector flow modes #42
- Make Toyota "3 Tooth Cam" decoder more robust #382
- Flex sensor-derived fuel temperature indication works properly
+ - Fix a scenario where noisy trigger can cause overdwell [rusefi/rusefi#6349](https://github.com/rusefi/rusefi/issues/6349)
## December 2023 Release
diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp
index 7ad70da059..5f205b496e 100644
--- a/firmware/controllers/trigger/trigger_decoder.cpp
+++ b/firmware/controllers/trigger/trigger_decoder.cpp
@@ -24,24 +24,11 @@
* If not, see .
*/
-#include
-#include
+#include "pch.h"
#include "global_shared.h"
-#include "loggingcentral.h"
-#include "error_handling.h"
-#include "perf_trace.h"
-
#include "engine_configuration.h"
-#include "trigger_central.h"
-#include "trigger_decoder.h"
-/**
- * decoder depends on current RPM for error condition logic
- */
-#include "sensor.h"
-#include "engine_state.h"
-#include "engine_math.h"
/**
* decoder uses TriggerStimulatorHelper in findTriggerZeroEventIndex
*/
@@ -260,6 +247,15 @@ bool PrimaryTriggerDecoder::hasSynchronizedPhase() const {
void PrimaryTriggerDecoder::onTriggerError() {
// On trigger error, we've lost full sync
resetHasFullSync();
+
+ // Ignore the warning that engine is never null - it might be in unit tests
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Waddress"
+ if (engine) {
+ // Instant RPM data is now also probably trash, discard it
+ engine->triggerCentral.instantRpm.resetInstantRpm();
+ }
+ #pragma GCC diagnostic pop
}
void PrimaryTriggerDecoder::onNotEnoughTeeth(int /*actual*/, int /*expected*/) {
diff --git a/unit_tests/global_execution_queue.cpp b/unit_tests/global_execution_queue.cpp
index cb281cdb94..03264fd079 100644
--- a/unit_tests/global_execution_queue.cpp
+++ b/unit_tests/global_execution_queue.cpp
@@ -25,7 +25,7 @@ void TestExecutor::scheduleForLater(const char *msg, scheduling_s *scheduling, i
return;
}
- scheduleByTimestamp("test", scheduling, getTimeNowUs() + delayUs, action);
+ scheduleByTimestamp(msg, scheduling, getTimeNowUs() + delayUs, action);
}
int TestExecutor::executeAll(efitick_t now) {
@@ -54,7 +54,7 @@ void TestExecutor::scheduleByTimestamp(const char *msg, scheduling_s *scheduling
}
if (m_mockExecutor) {
- m_mockExecutor->scheduleByTimestamp("test", scheduling, timeUs, action);
+ m_mockExecutor->scheduleByTimestamp(msg, scheduling, timeUs, action);
return;
}
@@ -67,7 +67,7 @@ void TestExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduli
return;
}
- scheduleByTimestamp("test", scheduling, NT2US(timeNt), action);
+ scheduleByTimestamp(msg, scheduling, NT2US(timeNt), action);
}
void TestExecutor::cancel(scheduling_s* s) {