microRusEFI used as Body Control Module BCM BCU

This commit is contained in:
rusefi 2020-09-06 22:36:31 -04:00
parent 7d0c8b4870
commit 8296f54923
3 changed files with 14 additions and 8 deletions

View File

@ -204,6 +204,9 @@ void setBoardConfigurationOverrides(void) {
setupTle8888(); setupTle8888();
setupEtb(); setupEtb();
engineConfiguration->canTxPin = GPIOB_6;
engineConfiguration->canRxPin = GPIOB_12;
// MRE has a special main relay control low side pin // MRE has a special main relay control low side pin
// rusEfi firmware is totally not involved with main relay control on microRusEfi board // 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 // todo: maybe even set EFI_MAIN_RELAY_CONTROL to FALSE for MRE configuration

View File

@ -82,11 +82,15 @@ private:
template <typename TStorage, int TScale> template <typename TStorage, int TScale>
class ObdCanSensor: public CanSensorBase { class ObdCanSensor: public CanSensorBase {
public: 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) { CanSensorBase(eid, type, timeout) {
this->PID = PID;
} }
void decodeFrame(const CANRxFrame& frame, efitick_t nowNt) override { void decodeFrame(const CANRxFrame& frame, efitick_t nowNt) override {
if (frame.data8[2] != PID) {
return;
}
// Compute the location of our data within the frame // Compute the location of our data within the frame
const uint8_t* dataLocation = &frame.data8[0]; const uint8_t* dataLocation = &frame.data8[0];
@ -108,5 +112,7 @@ public:
} }
return m_next; return m_next;
} }
int PID;
}; };

View File

@ -23,24 +23,21 @@ CanSensor<int16_t, PACK_MULT_PERCENT> canPedalSensor(
); );
ObdCanSensor<int16_t, ODB_RPM_MULT> obdRpmSensor( ObdCanSensor<int16_t, ODB_RPM_MULT> obdRpmSensor(
PID_RPM, OBD_TEST_RESPONSE, PID_RPM,
SensorType::Rpm, TIMEOUT SensorType::Rpm, TIMEOUT
); );
ObdCanSensor<int16_t, 1> obdCltSensor( ObdCanSensor<int16_t, 1> obdCltSensor(
PID_COOLANT_TEMP, OBD_TEST_RESPONSE, PID_COOLANT_TEMP,
SensorType::Clt, TIMEOUT SensorType::Clt, TIMEOUT
); );
void initCanSensors() { void initCanSensors() {
#if EFI_CANBUS_SLAVE
registerCanSensor(canPedalSensor);
if (CONFIG(consumeObdSensors)) { if (CONFIG(consumeObdSensors)) {
// registerCanSensor(canPedalSensor);
registerCanSensor(obdRpmSensor); registerCanSensor(obdRpmSensor);
registerCanSensor(obdCltSensor); // registerCanSensor(obdCltSensor);
} }
#endif // EFI_CANBUS_SLAVE
} }
#endif // EFI_CAN_SUPPORT #endif // EFI_CAN_SUPPORT