warnings fixes (#3851)

* unused things

* !!! actual bug !!!

* dead

* unused

* unused

* multi-bus lua RX was just broken

* make the compiler angry about it

* dead config

* alphax 2

* just call, no store

* compiler too angry
This commit is contained in:
Matthew Kennedy 2022-01-31 15:37:42 -08:00 committed by GitHub
parent 2986a6794b
commit c6f45c5022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 46 additions and 63 deletions

View File

@ -103,7 +103,7 @@ void boardInitHardware() {
boardOnConfigurationChange(nullptr);
}
void boardOnConfigurationChange(engine_configuration_s *previousConfiguration) {
void boardOnConfigurationChange(engine_configuration_s * /*previousConfiguration*/) {
alphaTachPullUp.setValue(engineConfiguration->boardUseTachPullUp);
alphaTempPullUp.setValue(engineConfiguration->boardUseTempPullUp);
alphaCrankPPullUp.setValue(engineConfiguration->boardUseCrankPullUp);

View File

@ -158,7 +158,7 @@ void onBurnRequest() {
}
// Weak link a stub so that every board doesn't have to implement this function
__attribute__((weak)) void boardOnConfigurationChange(engine_configuration_s *previousConfiguration) { }
__attribute__((weak)) void boardOnConfigurationChange(engine_configuration_s* /*previousConfiguration*/) { }
/**
* this is the top-level method which should be called in case of any changes to engine configuration

View File

@ -161,8 +161,8 @@ static void doTestSolenoid(int humanIndex, const char *delayStr, const char * on
pinbench(delayStr, onTimeStr, offTimeStr, countStr, &enginePins.tcuSolenoids[humanIndex - 1], b);
}
static void doBenchTestFsio(int humanIndex, const char *delayStr, const char * onTimeStr, const char *offTimeStr,
const char *countStr) {
static void doBenchTestFsio(int /*humanIndex*/, const char * /*delayStr*/, const char * /*onTimeStr*/, const char * /*offTimeStr*/,
const char * /*countStr*/) {
// if (humanIndex < 1 || humanIndex > FSIO_COMMAND_COUNT) {
// efiPrintf("Invalid index: %d", humanIndex);
// return;

View File

@ -14,7 +14,7 @@
typedef float SCRIPT_TABLE_8x8_f32t_linear[SCRIPT_TABLE_8 * SCRIPT_TABLE_8];
bool acceptCanRx(int sid) {
bool acceptCanRx(int /*sid*/) {
if (!engineConfiguration->usescriptTableForCanSniffingFiltering) {
// accept anything if filtering is not enabled
return true;
@ -115,7 +115,7 @@ static int16_t getShiftedLSB_intel(const CANRxFrame& frame, int offset) {
return getLSB_intel(frame, offset) - 0x8000;
}
static void processCanRxImu(const CANRxFrame& frame, efitick_t nowNt) {
static void processCanRxImu(const CANRxFrame& frame) {
/*
if (CAN_SID(frame) == 0x130) {
float a = getShiftedLSB_intel(frame, 0);
@ -172,7 +172,7 @@ void processCanRxMessage(const size_t busIndex, const CANRxFrame &frame, efitick
processCanRxVss(frame, nowNt);
// todo: convert to CanListener or not?
processCanRxImu(frame, nowNt);
processCanRxImu(frame);
processLuaCan(busIndex, frame);

View File

@ -12,5 +12,5 @@ public:
virtual void onFastCallback() { }
// Called whenever the ignition switch state changes
virtual void onIgnitionStateChanged(bool ignitionOn) { }
virtual void onIgnitionStateChanged(bool /*ignitionOn*/) { }
};

View File

@ -187,31 +187,6 @@ void runFsio() {
enginePins.o2heater.setValue(engine->rpmCalculator.isRunning());
}
static void showFsio(const char *msg, LEElement *element) {
#if EFI_PROD_CODE || EFI_SIMULATOR
if (msg != NULL)
efiPrintf("%s:", msg);
while (element->action != LE_METHOD_RETURN) {
efiPrintf("action %d: fValue=%.2f", element->action, element->fValue);
element++;
}
efiPrintf("<end>");
#endif
}
// todo: move somewhere else
static void showFsioInfo() {
#if EFI_PROD_CODE || EFI_SIMULATOR
for (int i = 0; i < SCRIPT_SETTING_COUNT; i++) {
float v = engineConfiguration->scriptSetting[i];
if (!cisnan(v)) {
efiPrintf("user property #%d: %.2f", i + 1, v);
}
}
#endif
}
ValueProvider3D *getscriptTable(int index) {
switch (index) {
default:

View File

@ -140,6 +140,8 @@ void Engine::onSparkFireKnockSense(uint8_t cylinderNumber, efitick_t nowNt) {
#if EFI_HIP_9011 || EFI_SOFTWARE_KNOCK
scheduleByAngle(&startSampling, nowNt,
/*angle*/engineConfiguration->knockDetectionWindowStart, { startKnockSampling, engine });
#else
UNUSED(nowNt);
#endif
#if EFI_HIP_9011

View File

@ -92,7 +92,6 @@ static void startAveraging(scheduling_s *endAveragingScheduling) {
}
#if HAL_USE_ADC
static int fastMapCounter = 0;
/**
* This method is invoked from ADC callback.

View File

@ -285,8 +285,8 @@ void readFromFlash() {
* HW_CHECK_MODE mode where we would not need actual address
* todo: rename method to emphasis the fact of validation check?
*/
auto firstCopyAddr = getFlashAddrFirstCopy();
auto secondyCopyAddr = getFlashAddrSecondCopy();
getFlashAddrFirstCopy();
getFlashAddrSecondCopy();
resetConfigurationExt(DEFAULT_ENGINE_TYPE);
#else

View File

@ -21,12 +21,18 @@ static bool shouldRxCanFrame(const CANRxFrame& frame) {
return false;
}
// Stores information about one received CAN frame: which bus, plus the actual frame
struct CanFrameData {
uint8_t BusIndex;
CANRxFrame Frame;
};
constexpr size_t canFrameCount = 32;
static CANRxFrame canFrames[canFrameCount];
static CanFrameData canFrames[canFrameCount];
// CAN frame buffers that are not in use
chibios_rt::Mailbox<CANRxFrame*, canFrameCount> freeBuffers;
chibios_rt::Mailbox<CanFrameData*, canFrameCount> freeBuffers;
// CAN frame buffers that are waiting to be processed by the lua thread
chibios_rt::Mailbox<CANRxFrame*, canFrameCount> filledBuffers;
chibios_rt::Mailbox<CanFrameData*, canFrameCount> filledBuffers;
void processLuaCan(const size_t busIndex, const CANRxFrame& frame) {
// Filter the frame if we aren't listening for it
@ -34,7 +40,7 @@ void processLuaCan(const size_t busIndex, const CANRxFrame& frame) {
return;
}
CANRxFrame* frameBuffer;
CanFrameData* frameBuffer;
msg_t msg;
{
@ -50,7 +56,8 @@ void processLuaCan(const size_t busIndex, const CANRxFrame& frame) {
}
// Copy the frame in to the buffer
*frameBuffer = frame;
frameBuffer->BusIndex = busIndex;
frameBuffer->Frame = frame;
{
// Push the frame in to the queue under lock
@ -59,7 +66,7 @@ void processLuaCan(const size_t busIndex, const CANRxFrame& frame) {
}
}
static void handleCanFrame(LuaHandle& ls, CANRxFrame* frame) {
static void handleCanFrame(LuaHandle& ls, CanFrameData* data) {
lua_getglobal(ls, "onCanRx");
if (lua_isnil(ls, -1)) {
// no rx function, ignore
@ -68,17 +75,17 @@ static void handleCanFrame(LuaHandle& ls, CANRxFrame* frame) {
return;
}
auto dlc = frame->DLC;
auto dlc = data->Frame.DLC;
// Push bus, ID and DLC
lua_pushinteger(ls, 1); // TODO: support multiple busses!
lua_pushinteger(ls, CAN_EID(*frame));
lua_pushinteger(ls, data->BusIndex); // TODO: support multiple busses!
lua_pushinteger(ls, CAN_EID(data->Frame));
lua_pushinteger(ls, dlc);
// Build table for data
lua_newtable(ls);
for (size_t i = 0; i < dlc; i++) {
lua_pushinteger(ls, frame->data8[i]);
lua_pushinteger(ls, data->Frame.data8[i]);
// index is i+1 because Lua "arrays" (tables) are 1-indexed
lua_rawseti(ls, -2, i + 1);
@ -98,9 +105,9 @@ static void handleCanFrame(LuaHandle& ls, CANRxFrame* frame) {
}
bool doOneLuaCanRx(LuaHandle& ls) {
CANRxFrame* frame;
CanFrameData* data;
msg_t msg = filledBuffers.fetch(&frame, TIME_IMMEDIATE);
msg_t msg = filledBuffers.fetch(&data, TIME_IMMEDIATE);
if (msg == MSG_TIMEOUT) {
// No new CAN messages rx'd, nothing more to do.
@ -114,10 +121,10 @@ bool doOneLuaCanRx(LuaHandle& ls) {
}
// We've accepted the frame, process it in Lua.
handleCanFrame(ls, frame);
handleCanFrame(ls, data);
// We're done, return this frame to the free list
msg = freeBuffers.post(frame, TIME_IMMEDIATE);
msg = freeBuffers.post(data, TIME_IMMEDIATE);
efiAssert(OBD_PCM_Processor_Fault, msg == MSG_OK, "lua can post to free buffer fail", false);
// We processed a frame so we should check again

View File

@ -602,7 +602,7 @@ void configureRusefiLuaHooks(lua_State* l) {
lua_register(l, "getAirmass", lua_getAirmass);
lua_register(l, "setAirmass", lua_setAirmass);
lua_register(l, "stopEngine", [](lua_State* l) {
lua_register(l, "stopEngine", [](lua_State*) {
doScheduleStopEngine();
return 0;
});

View File

@ -35,7 +35,7 @@ void configureRusefiLuaUtilHooks(lua_State* l) {
lua_register(l, "interpolate", lua_interpolate);
#if defined(STM32F4) || defined(STM32F7)
lua_register(l, "mcu_standby", [](lua_State* l) {
lua_register(l, "mcu_standby", [](lua_State*) {
stm32_standby();
return 0;
});

View File

@ -14,8 +14,6 @@
* @return unchanged mapKPa parameter or NaN
*/
static float validateBaroMap(float mapKPa) {
const float atmoPressure = 100.0f;
// Highest interstate is the Eisenhower Tunnel at 11158 feet -> 66 kpa
// Lowest point is the Dead Sea, -1411 feet -> 106 kpa
if (cisnan(mapKPa) || mapKPa > 110 || mapKPa < 60) {

View File

@ -108,7 +108,7 @@ void efiExtiDisablePin(brain_pin_e brainPin)
channel.CallbackData = nullptr;
}
digital_input_s* startDigitalCaptureExti(const char *msg, brain_pin_e brainPin) {
digital_input_s* startDigitalCaptureExti(const char * /*msg*/, brain_pin_e /*brainPin*/) {
return nullptr;
}

View File

@ -10,13 +10,9 @@
#ifdef EFI_USE_COMPRESSED_INI_MSD
#include "compressed_block_device.h"
#include "ramdisk_image_compressed.h"
static CompressedBlockDevice cbd;
#else
#include "ramdisk.h"
#include "ramdisk_image.h"
static RamDisk ramdisk;
#endif
// If the ramdisk image told us not to use it, don't use it.
@ -26,6 +22,14 @@
#endif
#endif
#if EFI_EMBED_INI_MSD
#ifdef EFI_USE_COMPRESSED_INI_MSD
static CompressedBlockDevice cbd;
#else
static RamDisk ramdisk;
#endif
#endif
#if STM32_USB_USE_OTG1
USBDriver *usb_driver = &USBD1;
#elif STM32_USB_USE_OTG2

View File

@ -87,7 +87,7 @@ static MapCfg getMapCfg(air_pressure_sensor_type_e sensorType) {
}
void configureMapFunction(LinearFunc& converter, air_pressure_sensor_type_e sensorType) {
auto cfg = getMapCfg(engineConfiguration->map.sensor.type);
auto cfg = getMapCfg(sensorType);
converter.configure(
cfg.v1,

View File

@ -1176,9 +1176,7 @@ int16_t tps2Max;Full throttle#2. tpsMax value as 10 bit ADC value. Not Voltage!\
uint8_t autoscale noFuelTrimAfterDfcoTime;Pause closed loop fueling after deceleration fuel cut occurs. Set this to a little longer than however long is required for normal fueling behavior to resume after fuel cut.;"sec", 0.1, 0, 0, 10, 1
float tpsAccelEnrichmentThreshold;+Maximum change delta of TPS percentage over the 'length'. Actual TPS change has to be above this value in order for TPS/TPS acceleration to kick in.;"roc", 1, 0, 0, 200, 1
int engineLoadAccelLength;;"cycles", 1, 0, 1, 200, 0
int unused1696;;"", 1, 0, 0, 1, 0
uint32_t uartConsoleSerialSpeed;Band rate for primary TTL;"BPs", 1, 0, 0, 1000000, 0
float tpsDecelEnleanmentThreshold;For decel we simply multiply delta of TPS and tFor decel we do not use table?!;"roc", 1, 0, 0, 200, 1