From c4b28f4787a9b85155e8cba47f5da80ff117ae8e Mon Sep 17 00:00:00 2001 From: rusefillc Date: Tue, 10 Sep 2024 22:54:35 -0400 Subject: [PATCH] https://github.com/rusefi/rusefi/issues/6903 only:hellen121vag --- firmware/controllers/sensors/impl/AemXSeriesLambda.cpp | 2 +- firmware/integration/rusefi_config.txt | 2 +- firmware/tunerstudio/tunerstudio.template.ini | 1 + unit_tests/tests/test_can_wideband.cpp | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/firmware/controllers/sensors/impl/AemXSeriesLambda.cpp b/firmware/controllers/sensors/impl/AemXSeriesLambda.cpp index 503d95a169..d3cf0c5698 100644 --- a/firmware/controllers/sensors/impl/AemXSeriesLambda.cpp +++ b/firmware/controllers/sensors/impl/AemXSeriesLambda.cpp @@ -32,7 +32,7 @@ bool AemXSeriesWideband::acceptFrame(const CANRxFrame& frame) const { uint32_t aemXSeriesId = aem_base + m_sensorIndex; // 0th sensor is 0x190 and 0x191, 1st sensor is 0x192 and 0x193 - uint32_t rusefiBaseId = rusefi_base + 2 * m_sensorIndex; + uint32_t rusefiBaseId = rusefi_base + 2 * (engineConfiguration->flipWboChannels ? (1 - m_sensorIndex) : m_sensorIndex); return id == aemXSeriesId || diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index c8883b2ee7..dc60414326 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -805,7 +805,7 @@ bit is_enabled_spi_2 bit verboseTLE8888 bit enableVerboseCanTx;CAN broadcast using custom rusEFI protocol\nenable can_broadcast/disable can_broadcast bit externalRusEfiGdiModule - bit unused644b11 + bit flipWboChannels bit measureMapOnlyInOneCylinder;Useful for individual intakes bit stepperForceParkingEveryRestart bit isFasterEngineSpinUpEnabled;If enabled, try to fire the engine before a full engine cycle has been completed using RPM estimated from the last 90 degrees of engine rotation. As soon as the trigger syncs plus 90 degrees rotation, fuel and ignition events will occur. If disabled, worst case may require up to 4 full crank rotations before any events are scheduled. diff --git a/firmware/tunerstudio/tunerstudio.template.ini b/firmware/tunerstudio/tunerstudio.template.ini index 882d54d45b..520c817ddc 100644 --- a/firmware/tunerstudio/tunerstudio.template.ini +++ b/firmware/tunerstudio/tunerstudio.template.ini @@ -3597,6 +3597,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_ field = "Support for AEM or RusEFI CAN UEGO" field = "Enable CAN Wideband", enableAemXSeries, { canReadEnabled } field = "Wideband CAN bus", widebandOnSecondBus@@if_ts_show_wbo_canbus_index + field = flipWboChannels, flipWboChannels field = "Force O2 sensor heating", forceO2Heating dialog = uegoSerial, "Innovate LC-2 serial" diff --git a/unit_tests/tests/test_can_wideband.cpp b/unit_tests/tests/test_can_wideband.cpp index 370dfe7b42..c8b917b818 100644 --- a/unit_tests/tests/test_can_wideband.cpp +++ b/unit_tests/tests/test_can_wideband.cpp @@ -4,6 +4,7 @@ TEST(CanWideband, AcceptFrameId0) { AemXSeriesWideband dut(0, SensorType::Lambda1); + EngineTestHelper eth(engine_type_e::TEST_ENGINE); CANRxFrame frame; @@ -25,6 +26,7 @@ TEST(CanWideband, AcceptFrameId0) { TEST(CanWideband, AcceptFrameId1) { AemXSeriesWideband dut(1, SensorType::Lambda2); + EngineTestHelper eth(engine_type_e::TEST_ENGINE); CANRxFrame frame; @@ -45,6 +47,7 @@ TEST(CanWideband, AcceptFrameId1) { } TEST(CanWideband, DecodeValidAemFormat) { + EngineTestHelper eth(engine_type_e::TEST_ENGINE); AemXSeriesWideband dut(0, SensorType::Lambda1); dut.Register();