From c32c8d715dc2289c409a963cf5f0de31114e1dd4 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sat, 8 Aug 2020 20:57:42 -0400 Subject: [PATCH] A vague bug #1684 --- firmware/controllers/engine_cycle/main_trigger_callback.cpp | 3 +++ java_console/autotest/src/com/rusefi/AutoTest.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index ad2c620f89..65033f10f6 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -188,6 +188,9 @@ void turnInjectionPinLow(InjectionEvent *event) { } void InjectionEvent::onTriggerTooth(size_t trgEventIndex, int rpm, efitick_t nowNt) { + // note that here we take 'engineConfiguration' from DECLARE_ENGINE_PTR. + // set engine_type seems to be resetting those references (todo: where exactly? why exactly?) so an event during + // engine_type would not end well efiAssertVoid(CUSTOM_ERR_ASSERT, engineConfiguration != nullptr, "assert#1"); efiAssertVoid(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 128, "assert#2"); diff --git a/java_console/autotest/src/com/rusefi/AutoTest.java b/java_console/autotest/src/com/rusefi/AutoTest.java index a96117caff..6a0ec3f234 100644 --- a/java_console/autotest/src/com/rusefi/AutoTest.java +++ b/java_console/autotest/src/com/rusefi/AutoTest.java @@ -75,6 +75,10 @@ public class AutoTest extends BaseTest { changeRpm(900); // first let's get to expected RPM assertRpmDoesNotJump(20000, 15, 30, FAIL, commandQueue); + // important to reduce RPM since high RPM and set engine type do not go well due to DECLARE_ENGINE_PTR + // memset 0? + // todo: safer 'set engine_type' implementation which + changeRpm(120); } private void testV12() {