only:stftCorrection vs fuelPidCorrection vs engine

This commit is contained in:
Andrey 2024-06-05 21:43:09 -04:00
parent a0abaa1f16
commit 109b30f063
7 changed files with 14 additions and 13 deletions

View File

@ -553,9 +553,10 @@ static void updateSensors() {
}
static void updateFuelCorrections() {
engine->outputChannels.fuelPidCorrection[0] = 100.0f * (engine->stftCorrection[0] - 1.0f);
engine->outputChannels.fuelPidCorrection[1] = 100.0f * (engine->stftCorrection[1] - 1.0f);
engine->outputChannels.Gego = 100.0f * engine->stftCorrection[0];
for (size_t i = 0; i < STFT_BANK_COUNT; i++) {
engine->outputChannels.fuelPidCorrection[i] = 100.0f * (engine->engineState.stftCorrection[i] - 1.0f);
}
engine->outputChannels.Gego = 100.0f * engine->engineState.stftCorrection[0];
}
static void updateFuelResults() {

View File

@ -287,9 +287,6 @@ public:
#endif // EFI_SHAFT_POSITION_INPUT
float stftCorrection[STFT_BANK_COUNT] = {0};
/**
* See FAST_CALLBACK_PERIOD_MS
*/

View File

@ -176,13 +176,14 @@ void EngineState::periodicFastCallback() {
// compute per-bank fueling
for (size_t i = 0; i < STFT_BANK_COUNT; i++) {
float corr = clResult.banks[i];
engine->stftCorrection[i] = corr;
// todo: move to engine_state.txt and get rid of fuelPidCorrection in output_channels.txt?
engine->engineState.stftCorrection[i] = corr;
}
// Now apply that to per-cylinder fueling and timing
for (size_t i = 0; i < engineConfiguration->cylindersCount; i++) {
uint8_t bankIndex = engineConfiguration->cylinderBankSelect[i];
auto bankTrim = engine->stftCorrection[bankIndex];
auto bankTrim = engine->engineState.stftCorrection[bankIndex];
auto cylinderTrim = getCylinderFuelTrim(i, rpm, fuelLoad);
// Apply both per-bank and per-cylinder trims

View File

@ -33,6 +33,8 @@ public:
// Per-injection fuel mass, including TPS accel enrich
float injectionMass[MAX_CYLINDER_COUNT] = {0};
// todo: move to .txt or even better extract injection.txt?
float stftCorrection[STFT_BANK_COUNT] = {0};
float injectionStage2Fraction = 0;

View File

@ -72,7 +72,7 @@ static void populateFrame(ms1514& msg)
msg.afrtgt1 = (float)engine->fuelComputer.targetLambda * STOICH_RATIO;
msg.AFR1 = Sensor::getOrZero(SensorType::Lambda1) * STOICH_RATIO;
/* TODO: banks? */
msg.EGOcor1 = engine->stftCorrection[0];
msg.EGOcor1 = engine->engineState.stftCorrection[0];
/* TODO */
msg.egt1 = 0;
msg.pwseq1 = engine->engineState.injectionDuration;

View File

@ -165,8 +165,8 @@ static void populateFrame(Fueling2& msg) {
msg.fuelConsumedGram = engine->module<TripOdometer>()->getConsumedGrams();
msg.fuelFlowRate = engine->module<TripOdometer>()->getConsumptionGramPerSecond();
for (size_t i = 0; i < 2; i++) {
msg.fuelTrim[i] = 100.0f * (engine->stftCorrection[i] - 1.0f);
for (size_t i = 0; i < STFT_BANK_COUNT; i++) {
msg.fuelTrim[i] = 100.0f * (engine->engineState.stftCorrection[i] - 1.0f);
}
}

View File

@ -126,10 +126,10 @@ static void handleGetDataRequest(const CANRxFrame& rx, size_t busIndex) {
obdSendValue(_1_MODE, pid, 1, Sensor::getOrZero(SensorType::Clt) + ODB_TEMP_EXTRA, busIndex);
break;
case PID_STFT_BANK1:
obdSendValue(_1_MODE, pid, 1, 128 * engine->stftCorrection[0], busIndex);
obdSendValue(_1_MODE, pid, 1, 128 * engine->engineState.stftCorrection[0], busIndex);
break;
case PID_STFT_BANK2:
obdSendValue(_1_MODE, pid, 1, 128 * engine->stftCorrection[1], busIndex);
obdSendValue(_1_MODE, pid, 1, 128 * engine->engineState.stftCorrection[1], busIndex);
break;
case PID_INTAKE_MAP:
obdSendValue(_1_MODE, pid, 1, Sensor::getOrZero(SensorType::Map), busIndex);