rusefi-1/firmware/init/sensor/init_can_sensors.cpp

44 lines
770 B
C++
Raw Normal View History

/**
* @file init_can_sensors.cpp
*
* @date March 31, 2020
* @author Matthew Kennedy, (c) 2020
*/
2020-09-03 20:27:53 -07:00
#include "engine_configuration.h"
#if EFI_CAN_SUPPORT
#include "can_sensor.h"
#include "can.h"
2020-09-03 20:27:53 -07:00
EXTERN_CONFIG
;
2020-08-31 19:47:33 -07:00
#define TIMEOUT MS2NT(100)
CanSensor<int16_t, PACK_MULT_PERCENT> canPedalSensor(
CAN_DEFAULT_BASE + CAN_PEDAL_TPS_OFFSET, /*offset =*/ 0,
2020-08-31 19:47:33 -07:00
SensorType::AcceleratorPedal, TIMEOUT
);
ObdCanSensor<2, ODB_RPM_MULT> obdRpmSensor(
PID_RPM,
2020-08-31 19:47:33 -07:00
SensorType::Rpm, TIMEOUT
);
ObdCanSensor<1, 1> obdCltSensor(
PID_COOLANT_TEMP,
2020-09-03 20:27:53 -07:00
SensorType::Clt, TIMEOUT
);
void initCanSensors() {
2020-09-03 20:27:53 -07:00
if (CONFIG(consumeObdSensors)) {
// registerCanSensor(canPedalSensor);
2020-09-03 20:27:53 -07:00
registerCanSensor(obdRpmSensor);
// registerCanSensor(obdCltSensor);
2020-09-03 20:27:53 -07:00
}
}
#endif // EFI_CAN_SUPPORT