more fuel info in verbose CAN (#3229)

* more fuel info

* missed a comma
This commit is contained in:
Matthew Kennedy 2021-09-07 14:39:30 -07:00 committed by GitHub
parent 2e5a4b3691
commit e5fef07db8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 89 additions and 76 deletions

View File

@ -120,16 +120,28 @@ struct Fueling {
scaled_channel<uint16_t, 1000> cylAirmass; scaled_channel<uint16_t, 1000> cylAirmass;
scaled_channel<uint16_t, 100> estAirflow; scaled_channel<uint16_t, 100> estAirflow;
scaled_ms fuel_pulse; scaled_ms fuel_pulse;
scaled_percent stft; uint16_t pad;
}; };
static void populateFrame(Fueling& msg) { static void populateFrame(Fueling& msg) {
msg.cylAirmass = engine->engineState.sd.airMassInOneCylinder; msg.cylAirmass = engine->engineState.sd.airMassInOneCylinder;
msg.estAirflow = engine->engineState.airFlow; msg.estAirflow = engine->engineState.airFlow;
msg.fuel_pulse = engine->actualLastInjection[0]; msg.fuel_pulse = engine->actualLastInjection[0];
}
// todo struct Fueling2 {
msg.stft = 0; scaled_channel<uint16_t> fuelConsumedGram;
scaled_channel<uint16_t, PACK_MULT_FUEL_FLOW> fuelFlowRate;
scaled_percent fuelTrim[2];
};
static void populateFrame(Fueling2& msg) {
msg.fuelConsumedGram = engine->engineState.fuelConsumption.getConsumedGrams();
msg.fuelFlowRate = engine->engineState.fuelConsumption.getConsumptionGramPerSecond();
for (size_t i = 0; i < 2; i++) {
msg.fuelTrim[i] = 100.0f * (ENGINE(stftCorrection)[i] - 1.0f);
}
} }
void sendCanVerbose() { void sendCanVerbose() {
@ -141,6 +153,7 @@ void sendCanVerbose() {
transmitStruct<Sensors1> (base + CAN_SENSOR_1_OFFSET); transmitStruct<Sensors1> (base + CAN_SENSOR_1_OFFSET);
transmitStruct<Sensors2> (base + 4); transmitStruct<Sensors2> (base + 4);
transmitStruct<Fueling> (base + 5); transmitStruct<Fueling> (base + 5);
transmitStruct<Fueling2> (base + 6);
} }
#endif // EFI_CAN_SUPPORT #endif // EFI_CAN_SUPPORT