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() {