mirror of https://github.com/rusefi/rusefi.git
Map3D should not be silently return 0 if not initialized #6461
preparation: giving tables names
This commit is contained in:
parent
06266b709f
commit
6fb2a2b170
|
@ -17,8 +17,8 @@
|
|||
#error "Unexpected OS ACCESS HERE"
|
||||
#endif
|
||||
|
||||
static boostOpenLoop_Map3D_t boostMapOpen;
|
||||
static boostOpenLoop_Map3D_t boostMapClosed;
|
||||
static boostOpenLoop_Map3D_t boostMapOpen{"bo"};
|
||||
static boostOpenLoop_Map3D_t boostMapClosed{"bc"};
|
||||
static SimplePwm boostPwmControl("boost");
|
||||
|
||||
void BoostController::init(IPwm* pwm, const ValueProvider3D* openLoopMap, const ValueProvider3D* closedLoopTargetMap, pid_s* pidParams) {
|
||||
|
|
|
@ -78,9 +78,9 @@
|
|||
#define ETB_MAX_COUNT 2
|
||||
#endif /* ETB_MAX_COUNT */
|
||||
|
||||
static pedal2tps_t pedal2tpsMap;
|
||||
static Map3D<ETB2_TRIM_SIZE, ETB2_TRIM_SIZE, int8_t, uint8_t, uint8_t> throttle2TrimTable;
|
||||
static Map3D<TRACTION_CONTROL_ETB_DROP_SIZE, TRACTION_CONTROL_ETB_DROP_SIZE, int8_t, uint16_t, uint8_t> tcEtbDropTable;
|
||||
static pedal2tps_t pedal2tpsMap{"p2t"};
|
||||
static Map3D<ETB2_TRIM_SIZE, ETB2_TRIM_SIZE, int8_t, uint8_t, uint8_t> throttle2TrimTable{"t2t"};
|
||||
static Map3D<TRACTION_CONTROL_ETB_DROP_SIZE, TRACTION_CONTROL_ETB_DROP_SIZE, int8_t, uint16_t, uint8_t> tcEtbDropTable{"tce"};
|
||||
|
||||
constexpr float etbPeriodSeconds = 1.0f / ETB_LOOP_FREQUENCY;
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ static GppwmChannel channels[GPPWM_CHANNELS];
|
|||
static OutputPin pins[GPPWM_CHANNELS];
|
||||
static SimplePwm outputs[GPPWM_CHANNELS];
|
||||
|
||||
static gppwm_Map3D_t table1;
|
||||
static gppwm_Map3D_t table2;
|
||||
static gppwm_Map3D_t table3;
|
||||
static gppwm_Map3D_t table4;
|
||||
static gppwm_Map3D_t table1{"gppwm1"};
|
||||
static gppwm_Map3D_t table2{"gppwm2"};
|
||||
static gppwm_Map3D_t table3{"gppwm3"};
|
||||
static gppwm_Map3D_t table4{"gppwm4"};
|
||||
|
||||
static gppwm_Map3D_t* tables[] = {
|
||||
&table1,
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
using vvt_map_t = Map3D<SCRIPT_TABLE_8, SCRIPT_TABLE_8, int8_t, uint16_t, uint16_t>;
|
||||
|
||||
static vvt_map_t vvtTable1;
|
||||
static vvt_map_t vvtTable2;
|
||||
static vvt_map_t vvtTable1{"vvt1"};
|
||||
static vvt_map_t vvtTable2{"vvt2"};
|
||||
|
||||
VvtController::VvtController(int p_index)
|
||||
: index(p_index)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "pch.h"
|
||||
#include "accel_enrichment.h"
|
||||
|
||||
static tps_tps_Map3D_t tpsTpsMap;
|
||||
static tps_tps_Map3D_t tpsTpsMap{"tps"};
|
||||
|
||||
floatms_t TpsAccelEnrichment::getTpsEnrichment() {
|
||||
ScopePerf perf(PE::GetTpsEnrichment);
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
// todo: reset this between cranking attempts?! #2735
|
||||
int minCrankingRpm = 0;
|
||||
|
||||
static Map3D<TRACTION_CONTROL_ETB_DROP_SIZE, TRACTION_CONTROL_ETB_DROP_SIZE, int8_t, uint16_t, uint8_t> tcTimingDropTable;
|
||||
static Map3D<TRACTION_CONTROL_ETB_DROP_SIZE, TRACTION_CONTROL_ETB_DROP_SIZE, int8_t, uint16_t, uint8_t> tcSparkSkipTable;
|
||||
static Map3D<TRACTION_CONTROL_ETB_DROP_SIZE, TRACTION_CONTROL_ETB_DROP_SIZE, int8_t, uint16_t, uint8_t> tcTimingDropTable{"tct"};
|
||||
static Map3D<TRACTION_CONTROL_ETB_DROP_SIZE, TRACTION_CONTROL_ETB_DROP_SIZE, int8_t, uint16_t, uint8_t> tcSparkSkipTable{"tcs"};
|
||||
|
||||
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "lua_hooks.h"
|
||||
|
||||
extern fuel_Map3D_t veMap;
|
||||
static mapEstimate_Map3D_t mapEstimationTable;
|
||||
static mapEstimate_Map3D_t mapEstimationTable{"mape"};
|
||||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
float getMaximumRetard() const override;
|
||||
|
||||
private:
|
||||
Map3D<KNOCK_TABLE_SIZE, KNOCK_TABLE_SIZE, uint8_t, uint8_t, uint8_t> m_maxRetardTable;
|
||||
Map3D<KNOCK_TABLE_SIZE, KNOCK_TABLE_SIZE, uint8_t, uint8_t, uint8_t> m_maxRetardTable{"knock"};
|
||||
};
|
||||
|
||||
void initKnockCtrl();
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
#include "script_impl.h"
|
||||
|
||||
static fsio8_Map3D_f32t scriptTable1;
|
||||
static script2_Map3D_f32t scriptTable2;
|
||||
static fsio8_Map3D_u8t scriptTable3;
|
||||
static script4_Map3D_u8t scriptTable4;
|
||||
static fsio8_Map3D_f32t scriptTable1{"script1"};
|
||||
static script2_Map3D_f32t scriptTable2{"script2"};
|
||||
static fsio8_Map3D_u8t scriptTable3{"script3"};
|
||||
static script4_Map3D_u8t scriptTable4{"script4"};
|
||||
|
||||
ValueProvider3D *getscriptTable(int index) {
|
||||
switch (index) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define rpmMin 500
|
||||
#define rpmMax 8000
|
||||
|
||||
fuel_Map3D_t veMap;
|
||||
fuel_Map3D_t veMap{"ve"};
|
||||
|
||||
#define tpMin 0
|
||||
#define tpMax 100
|
||||
|
|
|
@ -33,6 +33,9 @@ public:
|
|||
template<int TColNum, int TRowNum, typename TValue, typename TXColumn, typename TRow>
|
||||
class Map3D : public ValueProvider3D {
|
||||
public:
|
||||
Map3D(const char *name) {
|
||||
m_name = name;
|
||||
}
|
||||
template <typename TValueInit, typename TXColumnInit, typename TRowInit>
|
||||
void initTable(TValueInit (&table)[TRowNum][TColNum],
|
||||
const TXColumnInit (&columnBins)[TColNum], const TRowInit (&rowBins)[TRowNum]) {
|
||||
|
@ -124,6 +127,7 @@ private:
|
|||
float m_rowMult = 1;
|
||||
float m_colMult = 1;
|
||||
float m_valueMult = 1;
|
||||
const char *m_name;
|
||||
};
|
||||
|
||||
typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, uint8_t, uint16_t, uint16_t> lambda_Map3D_t;
|
||||
|
|
|
@ -36,25 +36,25 @@ float map[VALUE_COUNT][RPM_COUNT] = {
|
|||
};
|
||||
|
||||
static float getValue(float rpm, float maf) {
|
||||
Map3D<RPM_COUNT, VALUE_COUNT, float, float, float> x1;
|
||||
Map3D<RPM_COUNT, VALUE_COUNT, float, float, float> x1{"x"};
|
||||
// note "5, 4" above
|
||||
// note "map[4][5], Bins[4], rpm[5] below
|
||||
x1.initTable(map, rpmBins, mafBins);
|
||||
float result1 = x1.getValue(rpm, maf);
|
||||
|
||||
|
||||
Map3D<RPM_COUNT, VALUE_COUNT, float, float, int> x2;
|
||||
Map3D<RPM_COUNT, VALUE_COUNT, float, float, int> x2{"x"};
|
||||
x2.initTable(map, rpmBins, mafBinsScaledInt);
|
||||
float result2 = x2.getValue(rpm, maf);
|
||||
EXPECT_NEAR_M4(result1, result2);
|
||||
|
||||
|
||||
Map3D<RPM_COUNT, VALUE_COUNT, float, float, uint8_t> x3;
|
||||
Map3D<RPM_COUNT, VALUE_COUNT, float, float, uint8_t> x3{"x"};
|
||||
x3.initTable(map, rpmBins, mafBinsScaledByte);
|
||||
float result3 = x3.getValue(rpm, maf);
|
||||
EXPECT_NEAR_M4(result1, result3);
|
||||
|
||||
Map3D<RPM_COUNT, VALUE_COUNT, float, uint8_t, float> x4;
|
||||
Map3D<RPM_COUNT, VALUE_COUNT, float, uint8_t, float> x4{"x"};
|
||||
x4.initTable(map, rpmBinsScaledByte, mafBins);
|
||||
float result4 = x4.getValue(rpm, maf);
|
||||
EXPECT_NEAR_M4(result1, result4);
|
||||
|
@ -67,7 +67,7 @@ static float getValue(float rpm, float maf) {
|
|||
EXPECT_NEAR_M4(result1, result5);
|
||||
|
||||
// Test with values stored in scaled bytes
|
||||
Map3D<RPM_COUNT, VALUE_COUNT, uint32_t, float, float> x6;
|
||||
Map3D<RPM_COUNT, VALUE_COUNT, uint32_t, float, float> x6{"x"};
|
||||
x6.initTable(mapScaledChannel, rpmBins, mafBins);
|
||||
float result6 = x6.getValue(rpm, maf);
|
||||
EXPECT_NEAR(result1, result6, 1e-3);
|
||||
|
|
Loading…
Reference in New Issue