2020-03-31 20:21:05 -07:00
|
|
|
/**
|
|
|
|
* @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"
|
2020-03-31 20:21:05 -07:00
|
|
|
|
|
|
|
#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)
|
|
|
|
|
2020-03-31 20:21:05 -07:00
|
|
|
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
|
|
|
|
);
|
|
|
|
|
2020-09-06 20:19:32 -07:00
|
|
|
ObdCanSensor<2, ODB_RPM_MULT> obdRpmSensor(
|
|
|
|
PID_RPM,
|
2020-08-31 19:47:33 -07:00
|
|
|
SensorType::Rpm, TIMEOUT
|
2020-03-31 20:21:05 -07:00
|
|
|
);
|
|
|
|
|
2020-09-06 20:19:32 -07:00
|
|
|
ObdCanSensor<1, 1> obdCltSensor(
|
|
|
|
PID_COOLANT_TEMP,
|
2020-09-03 20:27:53 -07:00
|
|
|
SensorType::Clt, TIMEOUT
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2020-03-31 20:21:05 -07:00
|
|
|
void initCanSensors() {
|
2020-09-03 20:27:53 -07:00
|
|
|
if (CONFIG(consumeObdSensors)) {
|
2020-09-06 19:36:31 -07:00
|
|
|
// registerCanSensor(canPedalSensor);
|
2020-09-03 20:27:53 -07:00
|
|
|
registerCanSensor(obdRpmSensor);
|
2020-09-06 19:36:31 -07:00
|
|
|
// registerCanSensor(obdCltSensor);
|
2020-09-03 20:27:53 -07:00
|
|
|
}
|
2020-03-31 20:21:05 -07:00
|
|
|
}
|
|
|
|
#endif // EFI_CAN_SUPPORT
|