warnings & assorted cleanup (#2793)

* lua hook

* validateBuffer

* tables

* simplify fsio table

* test

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2021-06-03 11:30:25 -07:00 committed by GitHub
parent d489a50d1b
commit 3ef969d743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 29 additions and 48 deletions

View File

@ -27,8 +27,8 @@
EXTERN_ENGINE;
static boostOpenLoop_Map3D_t boostMapOpen("boostmapopen");
static boostOpenLoop_Map3D_t boostMapClosed("boostmapclosed");
static boostOpenLoop_Map3D_t boostMapOpen;
static boostOpenLoop_Map3D_t boostMapClosed;
static SimplePwm boostPwmControl("boost");
void BoostController::init(SimplePwm* pwm, const ValueProvider3D* openLoopMap, const ValueProvider3D* closedLoopTargetMap, pid_s* pidParams) {

View File

@ -93,7 +93,7 @@
#define ETB_MAX_COUNT 2
#endif /* ETB_MAX_COUNT */
static pedal2tps_t pedal2tpsMap("Pedal2Tps");
static pedal2tps_t pedal2tpsMap;
EXTERN_ENGINE;

View File

@ -12,10 +12,10 @@ static GppwmChannel channels[GPPWM_CHANNELS];
static OutputPin pins[GPPWM_CHANNELS];
static SimplePwm outputs[GPPWM_CHANNELS];
static gppwm_Map3D_t table1("GPPWM 1");
static gppwm_Map3D_t table2("GPPWM 2");
static gppwm_Map3D_t table3("GPPWM 3");
static gppwm_Map3D_t table4("GPPWM 4");
static gppwm_Map3D_t table1;
static gppwm_Map3D_t table2;
static gppwm_Map3D_t table3;
static gppwm_Map3D_t table4;
static gppwm_Map3D_t* tables[] = {
&table1,

View File

@ -120,7 +120,7 @@ float getIdlePidMinValue(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
static uint32_t lastCrankingCyclesCounter = 0;
static float lastCrankingIacPosition;
static iacPidMultiplier_t iacPidMultMap("iacPidMultiplier");
static iacPidMultiplier_t iacPidMultMap;
#if ! EFI_UNIT_TEST

View File

@ -22,8 +22,8 @@
EXTERN_ENGINE;
static fsio8_Map3D_u8t vvtTable1("vvt#1");
static fsio8_Map3D_u8t vvtTable2("vvt#2");
static fsio8_Map3D_u8t vvtTable1;
static fsio8_Map3D_u8t vvtTable2;
void VvtController::init(int index, int bankIndex, int camIndex, const ValueProvider3D* targetMap) {
this->index = index;

View File

@ -34,7 +34,7 @@
EXTERN_ENGINE;
tps_tps_Map3D_t tpsTpsMap("tpsTps");
static tps_tps_Map3D_t tpsTpsMap;
void WallFuel::resetWF() {
wallFuel = 0;

View File

@ -33,9 +33,8 @@
EXTERN_ENGINE;
static ign_Map3D_t advanceMap("advance");
// This coeff in ctor parameter is sufficient for int16<->float conversion!
static ign_Map3D_t iatAdvanceCorrectionMap("iat corr");
static ign_Map3D_t advanceMap;
static ign_Map3D_t iatAdvanceCorrectionMap;
// todo: reset this between cranking attempts?! #2735
int minCrankingRpm = 0;

View File

@ -41,11 +41,11 @@
EXTERN_ENGINE;
fuel_Map3D_t fuelPhaseMap("fl ph");
static fuel_Map3D_t fuelPhaseMap;
extern fuel_Map3D_t veMap;
extern lambda_Map3D_t lambdaMap;
extern baroCorr_Map3D_t baroCorrMap;
mapEstimate_Map3D_t mapEstimationTable("map est");
static mapEstimate_Map3D_t mapEstimationTable;
#if EFI_ENGINE_CONTROL

View File

@ -21,13 +21,6 @@
#include "fsio_core.h"
#include "fsio_impl.h"
extern fsio8_Map3D_f32t fsioTable1;
extern fsio8_Map3D_u8t fsioTable2;
extern fsio8_Map3D_u8t fsioTable3;
extern fsio8_Map3D_u8t fsioTable4;
static fsio8_Map3D_u8t * fsio8t_tables[] = {NULL, NULL, &fsioTable2, &fsioTable3, &fsioTable4};
EXTERN_ENGINE;
LENameOrdinalPair * LE_FIRST = nullptr;
@ -229,15 +222,8 @@ FsioResult LECalculator::processElement(const LEElement *element DECLARE_ENGINE_
if (index < 1 || index > MAX_TABLE_INDEX) {
return unexpected;
} else {
if (index == 1) {
fsio8_Map3D_f32t *t = &fsioTable1;
return t->getValue(xValue, yValue);
} else {
fsio8_Map3D_u8t *t = fsio8t_tables[index];
return t->getValue(xValue, yValue);
}
// index parameter is 1-based, getFSIOTable is 0-based
return getFSIOTable(index - 1)->getValue(xValue, yValue);
}
}
case LE_METHOD_FSIO_DIGITAL_INPUT:

View File

@ -38,10 +38,10 @@ EXTERN_ENGINE;
*/
#define NO_PWM 0
fsio8_Map3D_f32t fsioTable1("fsio#1");
fsio8_Map3D_u8t fsioTable2("fsio#2");
fsio8_Map3D_u8t fsioTable3("fsio#3");
fsio8_Map3D_u8t fsioTable4("fsio#4");
static fsio8_Map3D_f32t fsioTable1;
static fsio8_Map3D_u8t fsioTable2;
static fsio8_Map3D_u8t fsioTable3;
static fsio8_Map3D_u8t fsioTable4;
/**
* Here we define all rusEfi-specific methods

View File

@ -170,7 +170,7 @@ static int lua_setDebug(lua_State* l) {
return 0;
}
static int lua_stopEngine(lua_State* l) {
static int lua_stopEngine(lua_State*) {
doScheduleStopEngine();
return 0;

View File

@ -26,10 +26,9 @@
EXTERN_ENGINE;
fuel_Map3D_t veMap("VE");
fuel_Map3D_t ve2Map("VE2");
lambda_Map3D_t lambdaMap("lambda");
baroCorr_Map3D_t baroCorrMap("baro");
fuel_Map3D_t veMap;
lambda_Map3D_t lambdaMap;
baroCorr_Map3D_t baroCorrMap;
#define tpMin 0
#define tpMax 100

View File

@ -29,9 +29,6 @@ public:
template<int TColNum, int TRowNum, typename vType, typename kType, typename TValueMultiplier = efi::ratio<1>>
class Map3D : public ValueProvider3D {
public:
explicit Map3D(const char*name) {
}
template<int mult>
void init(scaled_channel<vType, mult> table[TRowNum][TColNum], const kType rowBins[TRowNum], const kType columnBins[TColNum]) {
static_assert(TValueMultiplier::den == mult);

View File

@ -43,7 +43,7 @@
/**
* @returns true if data does not fit into this buffer
*/
bool Logging::validateBuffer(const char *text, uint32_t extraLen) {
bool Logging::validateBuffer(uint32_t extraLen) {
if (remainingSize() < extraLen + 1) {
#if EFI_PROD_CODE
warning(CUSTOM_LOGGING_BUFFER_OVERFLOW, "output overflow %s %d", name, extraLen);
@ -57,7 +57,7 @@ bool Logging::validateBuffer(const char *text, uint32_t extraLen) {
void Logging::append(const char *text) {
efiAssertVoid(CUSTOM_APPEND_NULL, text != NULL, "append NULL");
uint32_t extraLen = efiStrlen(text);
bool isCapacityProblem = validateBuffer(text, extraLen);
bool isCapacityProblem = validateBuffer(extraLen);
if (isCapacityProblem) {
return;
}

View File

@ -47,7 +47,7 @@ public:
}
//private:
bool validateBuffer(const char *text, uint32_t extraLen);
bool validateBuffer(uint32_t extraLen);
const char* const name = nullptr;

View File

@ -22,7 +22,7 @@ float map[4][5] = {
};
static float getValue(float rpm, float maf) {
Map3D<5, 4, float, float> x("test");
Map3D<5, 4, float, float> x;
x.init(map, mafBins, rpmBins);
return x.getValue(rpm, maf);