diff --git a/firmware/controllers/lua/lua_hooks.cpp b/firmware/controllers/lua/lua_hooks.cpp index 34d1b0bb15..54ef8dffa7 100644 --- a/firmware/controllers/lua/lua_hooks.cpp +++ b/firmware/controllers/lua/lua_hooks.cpp @@ -814,12 +814,14 @@ void configureRusefiLuaHooks(lua_State* l) { return 1; }); +#if EFI_PROD_CODE || EFI_SIMULATOR lua_register(l, "getOutput", [](lua_State* l) { auto propertyName = luaL_checklstring(l, 1, nullptr); auto result = getOutputValueByName(propertyName); lua_pushnumber(l, result); return 1; }); +#endif // EFI_PROD_CODE || EFI_SIMULATOR #if EFI_SHAFT_POSITION_INPUT lua_register(l, "getEngineState", [](lua_State* l) { diff --git a/java_tools/configuration_definition/src/test/java/com/rusefi/test/GetOutputValueConsumerTest.java b/java_tools/configuration_definition/src/test/java/com/rusefi/test/GetOutputValueConsumerTest.java index 807d693f2a..b6664b6d20 100644 --- a/java_tools/configuration_definition/src/test/java/com/rusefi/test/GetOutputValueConsumerTest.java +++ b/java_tools/configuration_definition/src/test/java/com/rusefi/test/GetOutputValueConsumerTest.java @@ -21,7 +21,8 @@ public class GetOutputValueConsumerTest { outputValueConsumer.conditional = "EFI_BOOST_CONTROL"; state.readBufferedReader(test, (outputValueConsumer)); assertEquals( - "// generated by GetOutputValueConsumer.java\n" + + "#if !EFI_UNIT_TEST\n" + + "// generated by GetOutputValueConsumer.java\n" + "#include \"pch.h\"\n" + "#include \"value_lookup.h\"\n" + "float getOutputValueByName(const char *name) {\n" + @@ -44,7 +45,8 @@ public class GetOutputValueConsumerTest { "#endif\n" + "\t}\n" + "\treturn EFI_ERROR_CODE;\n" + - "}\n", outputValueConsumer.getContent()); + "}\n" + + "#endif\n", outputValueConsumer.getContent()); } @@ -64,7 +66,8 @@ public class GetOutputValueConsumerTest { state.readBufferedReader(test, (outputValueConsumer)); assertEquals( - "// generated by GetOutputValueConsumer.java\n" + + "#if !EFI_UNIT_TEST\n" + + "// generated by GetOutputValueConsumer.java\n" + "#include \"pch.h\"\n" + "#include \"value_lookup.h\"\n" + "float getOutputValueByName(const char *name) {\n" + @@ -84,6 +87,7 @@ public class GetOutputValueConsumerTest { "\t\t\treturn engine->module()->ignitionOn;\n" + "\t}\n" + "\treturn EFI_ERROR_CODE;\n" + - "}\n", outputValueConsumer.getContent()); + "}\n" + + "#endif\n", outputValueConsumer.getContent()); } } diff --git a/java_tools/configuration_definition_base/src/main/java/com/rusefi/output/GetOutputValueConsumer.java b/java_tools/configuration_definition_base/src/main/java/com/rusefi/output/GetOutputValueConsumer.java index 7e8d145471..e4dae3e1a0 100644 --- a/java_tools/configuration_definition_base/src/main/java/com/rusefi/output/GetOutputValueConsumer.java +++ b/java_tools/configuration_definition_base/src/main/java/com/rusefi/output/GetOutputValueConsumer.java @@ -84,10 +84,12 @@ public class GetOutputValueConsumer implements ConfigurationConsumer { String fullSwitch = wrapSwitchStatement(switchBody); - return GetConfigValueConsumer.getHeader(getClass()) + + return "#if !EFI_UNIT_TEST\n" + + GetConfigValueConsumer.getHeader(getClass()) + "float getOutputValueByName(const char *name) {\n" + fullSwitch + - getterBody + GetConfigValueConsumer.GET_METHOD_FOOTER; + getterBody + GetConfigValueConsumer.GET_METHOD_FOOTER + + "#endif\n"; } @NotNull