2020-03-31 20:21:05 -07:00
|
|
|
/**
|
|
|
|
* @file init_can_sensors.cpp
|
|
|
|
*
|
|
|
|
* @date March 31, 2020
|
|
|
|
* @author Matthew Kennedy, (c) 2020
|
|
|
|
*/
|
|
|
|
|
2021-08-03 19:05:01 -07:00
|
|
|
#include "pch.h"
|
2020-03-31 20:21:05 -07:00
|
|
|
|
|
|
|
#if EFI_CAN_SUPPORT
|
|
|
|
#include "can_sensor.h"
|
|
|
|
#include "can.h"
|
|
|
|
|
|
|
|
CanSensor<int16_t, PACK_MULT_PERCENT> canPedalSensor(
|
|
|
|
CAN_DEFAULT_BASE + CAN_PEDAL_TPS_OFFSET, /*offset =*/ 0,
|
2020-09-06 20:39:25 -07:00
|
|
|
SensorType::AcceleratorPedal, CAN_TIMEOUT
|
|
|
|
);
|
|
|
|
|
|
|
|
ObdCanSensor<2, 0> obdRpmSensor(
|
|
|
|
PID_RPM, ODB_RPM_MULT,
|
|
|
|
SensorType::Rpm
|
|
|
|
);
|
|
|
|
|
|
|
|
ObdCanSensor<1, ODB_TEMP_EXTRA> obdCltSensor(
|
|
|
|
PID_COOLANT_TEMP, 1,
|
|
|
|
SensorType::Clt
|
2020-08-31 19:47:33 -07:00
|
|
|
);
|
|
|
|
|
2020-09-06 20:39:25 -07:00
|
|
|
ObdCanSensor<1, ODB_TEMP_EXTRA> obdIatSensor(
|
|
|
|
PID_INTAKE_TEMP, 1,
|
|
|
|
SensorType::Iat
|
2020-03-31 20:21:05 -07:00
|
|
|
);
|
|
|
|
|
2020-09-06 20:39:25 -07:00
|
|
|
ObdCanSensor<1, 0> obdTpsSensor(
|
|
|
|
PID_INTAKE_TEMP, ODB_TPS_BYTE_PERCENT,
|
|
|
|
SensorType::Tps1
|
2020-09-03 20:27:53 -07:00
|
|
|
);
|
|
|
|
|
2020-09-06 20:39:25 -07:00
|
|
|
//ObdCanSensor<1, ODB_TPS_BYTE_PERCENT> obdTpsSensor(
|
|
|
|
// PID_ENGINE_LOAD,
|
|
|
|
// SensorType::Tps, TIMEOUT
|
|
|
|
//);
|
2020-09-03 20:27:53 -07:00
|
|
|
|
2020-03-31 20:21:05 -07:00
|
|
|
void initCanSensors() {
|
2021-11-17 00:54:21 -08:00
|
|
|
if (engineConfiguration->consumeObdSensors) {
|
2020-09-06 19:36:31 -07:00
|
|
|
// registerCanSensor(canPedalSensor);
|
2020-09-03 20:27:53 -07:00
|
|
|
registerCanSensor(obdRpmSensor);
|
2020-09-07 13:25:00 -07:00
|
|
|
registerCanSensor(obdCltSensor);
|
|
|
|
registerCanSensor(obdIatSensor);
|
|
|
|
registerCanSensor(obdTpsSensor);
|
2020-09-03 20:27:53 -07:00
|
|
|
}
|
2020-03-31 20:21:05 -07:00
|
|
|
}
|
|
|
|
#endif // EFI_CAN_SUPPORT
|