Skip to content

Commit

Permalink
don't inject VE table, prep #459
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Sep 25, 2024
1 parent c3c7026 commit e259625
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 18 deletions.
10 changes: 8 additions & 2 deletions firmware/controllers/algo/airmass/airmass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ static float getVeLoadAxis(ve_override_e mode, float passedLoad) {
}

float AirmassVeModelBase::getVe(float rpm, float load, bool postState) const {
efiAssert(ObdCode::OBD_PCM_Processor_Fault, m_veTable != nullptr, "VE table null", 0);

// Override the load value if necessary
load = getVeLoadAxis(engineConfiguration->veOverrideMode, load);

Expand Down Expand Up @@ -71,3 +69,11 @@ float AirmassVeModelBase::getVe(float rpm, float load, bool postState) const {

return ve * PERCENT_DIV;
}

float AirmassVeModelBase::getVeImpl(float rpm, percent_t load) const {
return interpolate3d(
config->veTable,
config->veLoadBins, load,
config->veRpmBins, rpm
);
}
2 changes: 1 addition & 1 deletion firmware/controllers/algo/airmass/airmass.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AirmassVeModelBase : public AirmassModelBase {
// Retrieve the user-calibrated volumetric efficiency from the table
float getVe(float rpm, percent_t load, bool postState) const;

virtual float getVeImpl(float /*rpm*/, percent_t /*load*/) const { return 0.0f; }
virtual float getVeImpl(float /*rpm*/, percent_t /*load*/) const;

private:
const ValueProvider3D* const m_veTable;
Expand Down
2 changes: 1 addition & 1 deletion firmware/controllers/algo/airmass/alphan_airmass.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class AlphaNAirmass : public SpeedDensityBase {
public:
explicit AlphaNAirmass(const ValueProvider3D* veTable) : SpeedDensityBase(veTable) {}
explicit AlphaNAirmass(const ValueProvider3D* veTable = nullptr) : SpeedDensityBase(veTable) {}

AirmassResult getAirmass(float rpm, bool postState) override;
};
7 changes: 3 additions & 4 deletions firmware/controllers/algo/fuel_math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "speed_density_base.h"
#include "lua_hooks.h"

extern fuel_Map3D_t veMap;
static mapEstimate_Map3D_t mapEstimationTable;

#if EFI_ENGINE_CONTROL
Expand Down Expand Up @@ -141,9 +140,9 @@ float getRunningFuel(float baseFuel) {
return runningFuel;
}

static SpeedDensityAirmass sdAirmass(&veMap, mapEstimationTable);
static MafAirmass mafAirmass(&veMap);
static AlphaNAirmass alphaNAirmass(&veMap);
static SpeedDensityAirmass sdAirmass(nullptr, mapEstimationTable);
static MafAirmass mafAirmass;
static AlphaNAirmass alphaNAirmass;

AirmassModelBase* getAirmassModel(engine_load_mode_e mode) {
switch (mode) {
Expand Down
1 change: 0 additions & 1 deletion firmware/controllers/engine_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ Engine * engine;
void initDataStructures() {
#if EFI_ENGINE_CONTROL
initFuelMap();
initSpeedDensity();
#endif // EFI_ENGINE_CONTROL
}

Expand Down
6 changes: 0 additions & 6 deletions firmware/controllers/math/speed_density.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#define rpmMin 500
#define rpmMax 8000

fuel_Map3D_t veMap;

#define tpMin 0
#define tpMax 100

Expand Down Expand Up @@ -113,7 +111,3 @@ temperature_t IFuelComputer::getTCharge(float rpm, float tps) {

return Tcharge;
}

void initSpeedDensity() {
veMap.init(config->veTable, config->veLoadBins, config->veRpmBins);
}
2 changes: 0 additions & 2 deletions firmware/controllers/math/speed_density.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@

#define gramm_second_to_cc_minute(gs) ((gs) / 0.0119997981)
#define cc_minute_to_gramm_second(ccm) ((ccm) * 0.0119997981)

void initSpeedDensity();
1 change: 0 additions & 1 deletion firmware/util/containers/table_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class Map3D : public ValueProvider3D {
float m_valueMult = 1;
};

typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, uint16_t, uint16_t, uint16_t> fuel_Map3D_t;
typedef Map3D<PEDAL_TO_TPS_SIZE, PEDAL_TO_TPS_SIZE, uint8_t, uint8_t, uint8_t> pedal2tps_t;
typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, uint16_t, uint16_t, uint16_t> mapEstimate_Map3D_t;

Expand Down

0 comments on commit e259625

Please sign in to comment.