diff --git a/firmware/config/boards/microrusefi/board_configuration.cpp b/firmware/config/boards/microrusefi/board_configuration.cpp index 123df8b9ef..515a239f87 100644 --- a/firmware/config/boards/microrusefi/board_configuration.cpp +++ b/firmware/config/boards/microrusefi/board_configuration.cpp @@ -204,6 +204,9 @@ void setBoardConfigurationOverrides(void) { setupTle8888(); setupEtb(); + engineConfiguration->canTxPin = GPIOB_6; + engineConfiguration->canRxPin = GPIOB_12; + // MRE has a special main relay control low side pin // rusEfi firmware is totally not involved with main relay control on microRusEfi board // todo: maybe even set EFI_MAIN_RELAY_CONTROL to FALSE for MRE configuration diff --git a/firmware/controllers/sensors/can_sensor.h b/firmware/controllers/sensors/can_sensor.h index 64cdcc08f9..261a99edea 100644 --- a/firmware/controllers/sensors/can_sensor.h +++ b/firmware/controllers/sensors/can_sensor.h @@ -82,11 +82,15 @@ private: template class ObdCanSensor: public CanSensorBase { public: - ObdCanSensor(uint32_t eid, SensorType type, efitick_t timeout) : + ObdCanSensor(uint32_t eid, int PID, SensorType type, efitick_t timeout) : CanSensorBase(eid, type, timeout) { + this->PID = PID; } void decodeFrame(const CANRxFrame& frame, efitick_t nowNt) override { + if (frame.data8[2] != PID) { + return; + } // Compute the location of our data within the frame const uint8_t* dataLocation = &frame.data8[0]; @@ -108,5 +112,7 @@ public: } return m_next; } + + int PID; }; diff --git a/firmware/init/sensor/init_can_sensors.cpp b/firmware/init/sensor/init_can_sensors.cpp index e66ed78f66..c621d2edcc 100644 --- a/firmware/init/sensor/init_can_sensors.cpp +++ b/firmware/init/sensor/init_can_sensors.cpp @@ -23,24 +23,21 @@ CanSensor canPedalSensor( ); ObdCanSensor obdRpmSensor( - PID_RPM, + OBD_TEST_RESPONSE, PID_RPM, SensorType::Rpm, TIMEOUT ); ObdCanSensor obdCltSensor( - PID_COOLANT_TEMP, + OBD_TEST_RESPONSE, PID_COOLANT_TEMP, SensorType::Clt, TIMEOUT ); void initCanSensors() { -#if EFI_CANBUS_SLAVE - registerCanSensor(canPedalSensor); if (CONFIG(consumeObdSensors)) { +// registerCanSensor(canPedalSensor); registerCanSensor(obdRpmSensor); - registerCanSensor(obdCltSensor); +// registerCanSensor(obdCltSensor); } - -#endif // EFI_CANBUS_SLAVE } #endif // EFI_CAN_SUPPORT