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 (Status11 &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/12]

static void populateFrame ( Cams &  msg)
static

Definition at line 227 of file can_verbose.cpp.

227 {
228#if EFI_SHAFT_POSITION_INPUT
229 msg.Bank1IntakeActual = engine->triggerCentral.getVVTPosition(0, 0);
230 msg.Bank1ExhaustActual = engine->triggerCentral.getVVTPosition(0, 1);
231 msg.Bank2IntakeActual = engine->triggerCentral.getVVTPosition(1, 0);
232 msg.Bank2ExhaustActual = engine->triggerCentral.getVVTPosition(1, 1);
233#endif // EFI_SHAFT_POSITION_INPUT
234
235 // TODO: maybe don't rely on outputChannels here
236 msg.Bank1IntakeTarget = engine->outputChannels.vvtTargets[0];
237 msg.Bank1ExhaustTarget = engine->outputChannels.vvtTargets[1];
238 msg.Bank2IntakeTarget = engine->outputChannels.vvtTargets[2];
239 msg.Bank2ExhaustTarget = engine->outputChannels.vvtTargets[3];
240}
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/12]

static void populateFrame ( Egts &  msg)
static

Definition at line 246 of file can_verbose.cpp.

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

◆ populateFrame() [3/12]

static void populateFrame ( Fueling &  msg)
static

Definition at line 166 of file can_verbose.cpp.

166 {
167#if EFI_ENGINE_CONTROL
169 msg.estAirflow = engine->engineState.airflowEstimate;
171 msg.knockCount = engine->module<KnockController>()->getKnockCount();
172#endif // EFI_ENGINE_CONTROL
173}
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/12]

static void populateFrame ( Fueling2 &  msg)
static

Definition at line 181 of file can_verbose.cpp.

181 {
182#ifdef MODULE_ODOMETER
183 msg.fuelConsumedGram = engine->module<TripOdometer>()->getConsumedGrams();
184 msg.fuelFlowRate = engine->module<TripOdometer>()->getConsumptionGramPerSecond();
185#endif // MODULE_ODOMETER
186
187 for (size_t i = 0; i < FT_BANK_COUNT; i++) {
188 msg.fuelTrim[i] = 100.0f * (engine->engineState.stftCorrection[i] - 1.0f);
189 }
190}
float stftCorrection[FT_BANK_COUNT]
Here is the call graph for this function:

◆ populateFrame() [5/12]

static void populateFrame ( Fueling3 &  msg)
static

Definition at line 199 of file can_verbose.cpp.

199 {
202 msg.FuelPressureLow = Sensor::getOrZero(SensorType::FuelPressureLow);
203 msg.FuelPressureHigh = KPA2BAR(Sensor::getOrZero(SensorType::FuelPressureHigh));
204}
Here is the call graph for this function:

◆ populateFrame() [6/12]

static void populateFrame ( PedalAndTps &  msg)
static

Definition at line 109 of file can_verbose.cpp.

110{
111 msg.pedal = Sensor::get(SensorType::AcceleratorPedal).value_or(-1);
112 msg.tps1 = Sensor::get(SensorType::Tps1).value_or(-1);
113 msg.tps2 = Sensor::get(SensorType::Tps2).value_or(-1);
114 msg.wastegate = Sensor::get(SensorType::WastegatePosition).value_or(-1);
115}
virtual SensorResult get() const =0
Here is the call graph for this function:

◆ populateFrame() [7/12]

static void populateFrame ( PerCylinderKnock &  msg)
static

Definition at line 210 of file can_verbose.cpp.

210 {
211 for (size_t index = 0;index<std::min(8, MAX_CYLINDER_COUNT);index++) {
212 msg.knock[index] = engine->module<KnockController>()->m_knockCyl[index];
213 }
214}
Here is the call graph for this function:

◆ populateFrame() [8/12]

static void populateFrame ( Sensors1 &  msg)
static

Definition at line 127 of file can_verbose.cpp.

127 {
129
130 msg.clt = Sensor::getOrZero(SensorType::Clt) + PACK_ADD_TEMPERATURE;
131 msg.iat = Sensor::getOrZero(SensorType::Iat) + PACK_ADD_TEMPERATURE;
132
133 msg.aux1 = Sensor::getOrZero(SensorType::AuxTemp1) + PACK_ADD_TEMPERATURE;
134 msg.aux2 = Sensor::getOrZero(SensorType::AuxTemp2) + PACK_ADD_TEMPERATURE;
135
136#if HAL_USE_ADC
137 msg.mcuTemp = getMCUInternalTemperature() + PACK_ADD_TEMPERATURE;
138#endif
139
141}
float getMCUInternalTemperature(void)
Here is the call graph for this function:

◆ populateFrame() [9/12]

static void populateFrame ( Sensors2 &  msg)
static

Definition at line 152 of file can_verbose.cpp.

152 {
153 msg.oilPressure = Sensor::get(SensorType::OilPressure).value_or(-1);
154 msg.oilTemp = Sensor::getOrZero(SensorType::OilTemperature) + PACK_ADD_TEMPERATURE;
155 msg.fuelTemp = Sensor::getOrZero(SensorType::FuelTemperature) + PACK_ADD_TEMPERATURE;
157}
Here is the call graph for this function:

◆ populateFrame() [10/12]

static void populateFrame ( Speeds &  msg)
static

Definition at line 87 of file can_verbose.cpp.

87 {
89 msg.rpm = rpm;
90
91 auto timing = engine->engineState.timingAdvance[0];
92 msg.timing = timing > 360 ? timing - 720 : timing;
93#if EFI_ENGINE_CONTROL
94 msg.injDuty = getInjectorDutyCycle(rpm);
95 msg.coilDuty = getCoilDutyCycle(rpm);
96#endif // EFI_ENGINE_CONTROL
98
100}
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/12]

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:

◆ populateFrame() [12/12]

static void populateFrame ( Status11 &  msg)
static

Definition at line 74 of file can_verbose.cpp.

74 {
75 msg.brakePedal = engine->engineState.brakePedalState;
76}

◆ sendCanVerbose()

void sendCanVerbose ( )

Definition at line 252 of file can_verbose.cpp.

252 {
253#if HW_HELLEN && EFI_PROD_CODE
254 if (!getHellenBoardEnabled()) {
255 return;
256 }
257#endif // HW_HELLEN
261
262 transmitStruct<Status> (CanCategory::VERBOSE, base + 0, isExt, canChannel);
263 transmitStruct<Speeds> (CanCategory::VERBOSE, base + 1, isExt, canChannel);
264 transmitStruct<PedalAndTps> (CanCategory::VERBOSE, base + CAN_PEDAL_TPS_OFFSET, isExt, canChannel);
265 transmitStruct<Sensors1> (CanCategory::VERBOSE, base + CAN_SENSOR_1_OFFSET, isExt, canChannel);
266 transmitStruct<Sensors2> (CanCategory::VERBOSE, base + 4, isExt, canChannel);
267 transmitStruct<Fueling> (CanCategory::VERBOSE, base + 5, isExt, canChannel);
268 transmitStruct<Fueling2> (CanCategory::VERBOSE, base + 6, isExt, canChannel);
269 transmitStruct<Fueling3> (CanCategory::VERBOSE, base + 7, isExt, canChannel);
270 transmitStruct<Cams> (CanCategory::VERBOSE, base + 8, isExt, canChannel);
271
272 transmitStruct<Egts> (CanCategory::VERBOSE, base + 9, isExt, canChannel);
273 transmitStruct<PerCylinderKnock> (CanCategory::VERBOSE, base + 10, isExt, canChannel);
274 transmitStruct<Status11> (CanCategory::VERBOSE, base + 11, isExt, canChannel);
275}
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.