rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
can_verbose.cpp File Reference

Detailed Description

TODO: change 'verbose' into 'broadcast'?

If you edit this file, please update rusEFI_CAN_verbose.dbc! Kvaser Database Editor works well for this task, and is free.

Author
Matthew Kennedy, (c) 2020

Definition in file can_verbose.cpp.

Functions

static void populateFrame (Status &msg)
 
static void populateFrame (Speeds &msg)
 
static void populateFrame (PedalAndTps &msg)
 
static void populateFrame (Sensors1 &msg)
 
static void populateFrame (Sensors2 &msg)
 
static void populateFrame (Fueling &msg)
 
static void populateFrame (Fueling2 &msg)
 
static void populateFrame (Fueling3 &msg)
 
static void populateFrame (PerCylinderKnock &msg)
 
static void populateFrame (Cams &msg)
 
static void populateFrame (Egts &msg)
 
void sendCanVerbose ()
 

Function Documentation

◆ populateFrame() [1/11]

static void populateFrame ( Cams &  msg)
static

Definition at line 219 of file can_verbose.cpp.

219 {
220#if EFI_SHAFT_POSITION_INPUT
221 msg.Bank1IntakeActual = engine->triggerCentral.getVVTPosition(0, 0);
222 msg.Bank1ExhaustActual = engine->triggerCentral.getVVTPosition(0, 1);
223 msg.Bank2IntakeActual = engine->triggerCentral.getVVTPosition(1, 0);
224 msg.Bank2ExhaustActual = engine->triggerCentral.getVVTPosition(1, 1);
225#endif // EFI_SHAFT_POSITION_INPUT
226
227 // TODO: maybe don't rely on outputChannels here
228 msg.Bank1IntakeTarget = engine->outputChannels.vvtTargets[0];
229 msg.Bank1ExhaustTarget = engine->outputChannels.vvtTargets[1];
230 msg.Bank2IntakeTarget = engine->outputChannels.vvtTargets[2];
231 msg.Bank2ExhaustTarget = engine->outputChannels.vvtTargets[3];
232}
TriggerCentral triggerCentral
Definition engine.h:318
TunerStudioOutputChannels outputChannels
Definition engine.h:109
angle_t getVVTPosition(uint8_t bankIndex, uint8_t camIndex)
static EngineAccessor engine
Definition engine.h:413
Here is the call graph for this function:

◆ populateFrame() [2/11]

static void populateFrame ( Egts &  msg)
static

Definition at line 238 of file can_verbose.cpp.

238 {
239 msg.egt[0] = Sensor::getOrZero(SensorType::EGT1) / 5;
240 msg.egt[1] = Sensor::getOrZero(SensorType::EGT2) / 5;
241 // DBC Defines signals Egt3 through Egt8 but we do not have the code
242}
static float getOrZero(SensorType type)
Definition sensor.h:83
Here is the call graph for this function:

◆ populateFrame() [3/11]

static void populateFrame ( Fueling &  msg)
static

Definition at line 158 of file can_verbose.cpp.

158 {
159#if EFI_ENGINE_CONTROL
161 msg.estAirflow = engine->engineState.airflowEstimate;
163 msg.knockCount = engine->module<KnockController>()->getKnockCount();
164#endif // EFI_ENGINE_CONTROL
165}
FuelComputer fuelComputer
Definition engine.h:139
EngineState engineState
Definition engine.h:344
constexpr auto & module()
Definition engine.h:200
float airflowEstimate
scaled_channel< uint16_t, 300, 1 > actualLastInjection
Here is the call graph for this function:

◆ populateFrame() [4/11]

static void populateFrame ( Fueling2 &  msg)
static

Definition at line 173 of file can_verbose.cpp.

173 {
174#ifdef MODULE_ODOMETER
175 msg.fuelConsumedGram = engine->module<TripOdometer>()->getConsumedGrams();
176 msg.fuelFlowRate = engine->module<TripOdometer>()->getConsumptionGramPerSecond();
177#endif // MODULE_ODOMETER
178
179 for (size_t i = 0; i < FT_BANK_COUNT; i++) {
180 msg.fuelTrim[i] = 100.0f * (engine->engineState.stftCorrection[i] - 1.0f);
181 }
182}
float stftCorrection[FT_BANK_COUNT]
Here is the call graph for this function:

◆ populateFrame() [5/11]

static void populateFrame ( Fueling3 &  msg)
static

Definition at line 191 of file can_verbose.cpp.

191 {
194 msg.FuelPressureLow = Sensor::getOrZero(SensorType::FuelPressureLow);
195 msg.FuelPressureHigh = KPA2BAR(Sensor::getOrZero(SensorType::FuelPressureHigh));
196}
Here is the call graph for this function:

◆ populateFrame() [6/11]

static void populateFrame ( PedalAndTps &  msg)
static

Definition at line 101 of file can_verbose.cpp.

102{
103 msg.pedal = Sensor::get(SensorType::AcceleratorPedal).value_or(-1);
104 msg.tps1 = Sensor::get(SensorType::Tps1).value_or(-1);
105 msg.tps2 = Sensor::get(SensorType::Tps2).value_or(-1);
106 msg.wastegate = Sensor::get(SensorType::WastegatePosition).value_or(-1);
107}
virtual SensorResult get() const =0
Here is the call graph for this function:

◆ populateFrame() [7/11]

static void populateFrame ( PerCylinderKnock &  msg)
static

Definition at line 202 of file can_verbose.cpp.

202 {
203 for (size_t index = 0;index<std::min(8, MAX_CYLINDER_COUNT);index++) {
204 msg.knock[index] = engine->module<KnockController>()->m_knockCyl[index];
205 }
206}
Here is the call graph for this function:

◆ populateFrame() [8/11]

static void populateFrame ( Sensors1 &  msg)
static

Definition at line 119 of file can_verbose.cpp.

119 {
121
122 msg.clt = Sensor::getOrZero(SensorType::Clt) + PACK_ADD_TEMPERATURE;
123 msg.iat = Sensor::getOrZero(SensorType::Iat) + PACK_ADD_TEMPERATURE;
124
125 msg.aux1 = Sensor::getOrZero(SensorType::AuxTemp1) + PACK_ADD_TEMPERATURE;
126 msg.aux2 = Sensor::getOrZero(SensorType::AuxTemp2) + PACK_ADD_TEMPERATURE;
127
128#if HAL_USE_ADC
129 msg.mcuTemp = getMCUInternalTemperature() + PACK_ADD_TEMPERATURE;
130#endif
131
133}
float getMCUInternalTemperature(void)
Here is the call graph for this function:

◆ populateFrame() [9/11]

static void populateFrame ( Sensors2 &  msg)
static

Definition at line 144 of file can_verbose.cpp.

144 {
145 msg.oilPressure = Sensor::get(SensorType::OilPressure).value_or(-1);
146 msg.oilTemp = Sensor::getOrZero(SensorType::OilTemperature) + PACK_ADD_TEMPERATURE;
147 msg.fuelTemp = Sensor::getOrZero(SensorType::FuelTemperature) + PACK_ADD_TEMPERATURE;
149}
Here is the call graph for this function:

◆ populateFrame() [10/11]

static void populateFrame ( Speeds &  msg)
static

Definition at line 79 of file can_verbose.cpp.

79 {
81 msg.rpm = rpm;
82
83 auto timing = engine->engineState.timingAdvance[0];
84 msg.timing = timing > 360 ? timing - 720 : timing;
85#if EFI_ENGINE_CONTROL
86 msg.injDuty = getInjectorDutyCycle(rpm);
87 msg.coilDuty = getCoilDutyCycle(rpm);
88#endif // EFI_ENGINE_CONTROL
90
92}
angle_t timingAdvance[MAX_CYLINDER_COUNT]
percent_t getInjectorDutyCycle(float rpm)
@ FuelEthanolPercent
percent_t getCoilDutyCycle(float rpm)
Here is the call graph for this function:

◆ populateFrame() [11/11]

static void populateFrame ( Status &  msg)
static

Definition at line 47 of file can_verbose.cpp.

47 {
48 msg.warningCounter = engine->engineState.warnings.warningCounter;
49 msg.lastErrorCode = static_cast<uint16_t>(engine->engineState.warnings.lastErrorCode);
50
51 msg.revLimit = !engine->module<LimpManager>()->allowInjection() || !engine->module<LimpManager>()->allowIgnition();
52 msg.mainRelay = enginePins.mainRelay.getLogicValue();
53 msg.fuelPump = enginePins.fuelPumpRelay.getLogicValue();
54 msg.checkEngine = enginePins.checkEnginePin.getLogicValue();
55 msg.o2Heater = enginePins.o2heater.getLogicValue();
56#if EFI_SHAFT_POSITION_INPUT
57 msg.lambdaProtectActive = engine->lambdaMonitor.isCut();
58#endif // EFI_SHAFT_POSITION_INPUT
61
63
64#ifdef MODULE_ODOMETER
65 // scale to units of 0.1km
66 msg.distanceTraveled = engine->module<TripOdometer>()->getDistanceMeters() / 100;
67#endif // MODULE_ODOMETER
68}
LambdaMonitor lambdaMonitor
Definition engine.h:236
RegisteredOutputPin mainRelay
Definition efi_gpio.h:76
OutputPin o2heater
Definition efi_gpio.h:99
RegisteredOutputPin fanRelay
Definition efi_gpio.h:86
RegisteredOutputPin fanRelay2
Definition efi_gpio.h:87
RegisteredOutputPin fuelPumpRelay
Definition efi_gpio.h:91
RegisteredOutputPin checkEnginePin
Definition efi_gpio.h:118
WarningCodeState warnings
bool getLogicValue() const
Definition efi_gpio.cpp:667
ObdCode lastErrorCode
EnginePins enginePins
Definition efi_gpio.cpp:24
Here is the call graph for this function:

◆ sendCanVerbose()

void sendCanVerbose ( )

Definition at line 244 of file can_verbose.cpp.

244 {
245#if HW_HELLEN && EFI_PROD_CODE
246 if (!getHellenBoardEnabled()) {
247 return;
248 }
249#endif // HW_HELLEN
253
254 transmitStruct<Status> (CanCategory::VERBOSE, base + 0, isExt, canChannel);
255 transmitStruct<Speeds> (CanCategory::VERBOSE, base + 1, isExt, canChannel);
256 transmitStruct<PedalAndTps> (CanCategory::VERBOSE, base + CAN_PEDAL_TPS_OFFSET, isExt, canChannel);
257 transmitStruct<Sensors1> (CanCategory::VERBOSE, base + CAN_SENSOR_1_OFFSET, isExt, canChannel);
258 transmitStruct<Sensors2> (CanCategory::VERBOSE, base + 4, isExt, canChannel);
259 transmitStruct<Fueling> (CanCategory::VERBOSE, base + 5, isExt, canChannel);
260 transmitStruct<Fueling2> (CanCategory::VERBOSE, base + 6, isExt, canChannel);
261 transmitStruct<Fueling3> (CanCategory::VERBOSE, base + 7, isExt, canChannel);
262 transmitStruct<Cams> (CanCategory::VERBOSE, base + 8, isExt, canChannel);
263
264 transmitStruct<Egts> (CanCategory::VERBOSE, base + 9, isExt, canChannel);
265 transmitStruct<PerCylinderKnock> (CanCategory::VERBOSE, base + 10, isExt, canChannel);
266}
static constexpr engine_configuration_s * engineConfiguration
bool getHellenBoardEnabled()
static CanTsChannel canChannel

Referenced by CanWrite::PeriodicTask().

Here is the call graph for this function:
Here is the caller graph for this function:

Go to the source code of this file.