diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 9cd62a9d2c..158b5dca5b 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -655,6 +655,7 @@ public: LcdController() : PeriodicController("BenchThread") { } private: void PeriodicTask(efitime_t nowNt) override { + UNUSED(nowNt); setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->bc.lcdThreadPeriodMs)); if (engineConfiguration->bc.useLcdScreen) { #if EFI_HD44780_LCD diff --git a/firmware/controllers/algo/aux_pid.cpp b/firmware/controllers/algo/aux_pid.cpp index 63b3543344..63887c2609 100644 --- a/firmware/controllers/algo/aux_pid.cpp +++ b/firmware/controllers/algo/aux_pid.cpp @@ -62,6 +62,7 @@ public: AuxPidController() : PeriodicController("AuxPidController") { } private: void PeriodicTask(efitime_t nowNt) override { + UNUSED(nowNt); setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->auxPid[0].periodMs)); if (parametersVersion.isOld(engine->getGlobalConfigurationVersion())) { diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index 219fcb24bd..9a92afb733 100644 --- a/firmware/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/controllers/algo/engine_configuration_generated_structures.h @@ -1493,7 +1493,7 @@ typedef struct { * At what trigger index should some ignition-related math be executed? This is a performance trick to reduce load on synchronization trigger callback. * offset 1500 */ - int ignMathCalculateAtIndex; + unsigned int ignMathCalculateAtIndex; /** * offset 1504 */ diff --git a/firmware/controllers/alternatorController.cpp b/firmware/controllers/alternatorController.cpp index b10204e08e..58ff06a21f 100644 --- a/firmware/controllers/alternatorController.cpp +++ b/firmware/controllers/alternatorController.cpp @@ -47,6 +47,7 @@ public: AlternatorController() : PeriodicController("AlternatorController") { } private: void PeriodicTask(efitime_t nowNt) override { + UNUSED(nowNt); setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->alternatorControl.periodMs)); #if ! EFI_UNIT_TEST || defined(__DOXYGEN__) diff --git a/firmware/controllers/electronic_throttle.cpp b/firmware/controllers/electronic_throttle.cpp index 1133280b51..af0ce0e2fe 100644 --- a/firmware/controllers/electronic_throttle.cpp +++ b/firmware/controllers/electronic_throttle.cpp @@ -82,13 +82,13 @@ static LoggingWithStorage logger("ETB"); /** * @brief Pulse-Width Modulation state */ -static SimplePwm etbPwmUp("etbUp") CCM_OPTIONAL; +/*CCM_OPTIONAL*/ static SimplePwm etbPwmUp("etbUp"); static float valueOverride = NAN; /* -static SimplePwm etbPwmDown("etbDown") CCM_OPTIONAL; +CCM_OPTIONAL static SimplePwm etbPwmDown("etbDown"); */ -static OutputPin outputDirectionOpen CCM_OPTIONAL; -static OutputPin outputDirectionClose CCM_OPTIONAL; +/*CCM_OPTIONAL*/ static OutputPin outputDirectionOpen; +/*CCM_OPTIONAL*/ static OutputPin outputDirectionClose; EXTERN_ENGINE; @@ -96,7 +96,7 @@ static Pid pid(&engineConfiguration->etb); static percent_t currentEtbDuty; -static bool wasEtbBraking = false; +//static bool wasEtbBraking = false; // todo: need to fix PWM so that it supports zero duty cycle #define PERCENT_TO_DUTY(X) (maxF(minI(X, 99.9), 0.1) / 100.0) @@ -108,6 +108,7 @@ private: float feedForward = 0; void PeriodicTask(efitime_t nowNt) override { + UNUSED(nowNt); setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->etb.periodMs)); diff --git a/firmware/controllers/idle_thread.cpp b/firmware/controllers/idle_thread.cpp index d9798d333d..16eda7b506 100644 --- a/firmware/controllers/idle_thread.cpp +++ b/firmware/controllers/idle_thread.cpp @@ -269,6 +269,7 @@ public: IdleController() : PeriodicController("IdleValve") { } private: void PeriodicTask(efitime_t nowNt) override { + UNUSED(nowNt); setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->idleRpmPid.periodMs)); /* diff --git a/firmware/controllers/injector_central.cpp b/firmware/controllers/injector_central.cpp index 1a96af253e..0d93a8f9d3 100644 --- a/firmware/controllers/injector_central.cpp +++ b/firmware/controllers/injector_central.cpp @@ -220,6 +220,7 @@ public: BenchController() : PeriodicController("BenchThread") { } private: void PeriodicTask(efitime_t nowNt) override { + UNUSED(nowNt); setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->auxPid[0].periodMs)); // naive inter-thread communication - waiting for a flag diff --git a/firmware/controllers/malfunction_indicator.cpp b/firmware/controllers/malfunction_indicator.cpp index 21bd7f14a1..435616b24b 100644 --- a/firmware/controllers/malfunction_indicator.cpp +++ b/firmware/controllers/malfunction_indicator.cpp @@ -84,6 +84,7 @@ public: MILController() : PeriodicController("MFIndicator") { } private: void PeriodicTask(efitime_t nowNt) override { + UNUSED(nowNt); static error_codes_set_s localErrorCopy; getErrorCodes(&localErrorCopy); diff --git a/firmware/controllers/sensors/tps.cpp b/firmware/controllers/sensors/tps.cpp index b094aaed45..bc8deca882 100644 --- a/firmware/controllers/sensors/tps.cpp +++ b/firmware/controllers/sensors/tps.cpp @@ -19,6 +19,7 @@ static percent_t mockPedalPosition = MOCK_UNDEFINED; * this allows unit tests to simulate TPS position */ void setMockTpsPosition(percent_t tpsPosition) { + UNUSED(tpsPosition); #if !EFI_PROD_CODE mockTps = TPS_TS_CONVERSION * tpsPosition; #endif @@ -52,7 +53,7 @@ void saveTpsState(efitimeus_t now, float curValue) { next->curTime = now; next->curValue = curValue; - int diffSysticks = overflowDiff(now, cur->curTime); + //int diffSysticks = overflowDiff(now, cur->curTime); float diffSeconds = 0;// TODO: do we need this? diffSysticks * 1.0 / CH_FREQUENCY; next->rateOfChange = (curValue - cur->curValue) / diffSeconds; diff --git a/firmware/controllers/trigger/aux_valves.cpp b/firmware/controllers/trigger/aux_valves.cpp index eabf77797e..306cfff51c 100644 --- a/firmware/controllers/trigger/aux_valves.cpp +++ b/firmware/controllers/trigger/aux_valves.cpp @@ -36,6 +36,7 @@ static void turnOff(NamedOutputPin *output) { static void auxValveTriggerCallback(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) { + UNUSED(ckpSignalType); #if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__) if (index != SCHEDULING_TRIGGER_INDEX) { return; @@ -79,6 +80,7 @@ static void auxValveTriggerCallback(trigger_event_e ckpSignalType, } void initAuxValves(Logging *sharedLogger) { + UNUSED(sharedLogger); #if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__) if (engineConfiguration->auxValves[0] == GPIO_UNASSIGNED) { return; diff --git a/firmware/controllers/trigger/decoders/trigger_gm.cpp b/firmware/controllers/trigger/decoders/trigger_gm.cpp index 444bdc16f6..0a94f9a66e 100644 --- a/firmware/controllers/trigger/decoders/trigger_gm.cpp +++ b/firmware/controllers/trigger/decoders/trigger_gm.cpp @@ -61,7 +61,6 @@ static int gm_tooth_pair(float startAngle, bool isLongShort, TriggerShape* s, in */ void initGmLS24(TriggerShape *s) { s->initialize(FOUR_STROKE_CRANK_SENSOR, false); - trigger_wheel_e ch = T_PRIMARY; /* * Okay, here's how this magic works: diff --git a/firmware/controllers/trigger/decoders/trigger_honda.cpp b/firmware/controllers/trigger/decoders/trigger_honda.cpp index 390d9db1b2..566c01e874 100644 --- a/firmware/controllers/trigger/decoders/trigger_honda.cpp +++ b/firmware/controllers/trigger/decoders/trigger_honda.cpp @@ -246,7 +246,6 @@ void configureHondaCbr600custom(TriggerShape *s) { } void configureHondaAccordShifted(TriggerShape *s) { - float w = 720 / 2 / 24; s->initialize(FOUR_STROKE_CAM_SENSOR, true); float sb = S24; @@ -278,6 +277,7 @@ void configureHondaAccordShifted(TriggerShape *s) { } void configureOnePlus16(TriggerShape *s, operation_mode_e operationMode) { + UNUSED(operationMode); s->initialize(FOUR_STROKE_CAM_SENSOR, true); int totalTeethCount = 16; diff --git a/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp b/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp index 973e910489..cc6a26fb21 100644 --- a/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp +++ b/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp @@ -37,8 +37,6 @@ void initializeMitsubishi4g18(TriggerShape *s) { s->setTriggerSynchronizationGap(1.6666); - int secondaryWidth = 70; - s->addEvent720(106.77999999999997, T_PRIMARY, TV_FALL); s->addEvent720(120.09999999999998, T_SECONDARY, TV_RISE); s->addEvent720(188.0775, T_SECONDARY, TV_FALL); diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index 757bc7b715..e48a1e5412 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -163,6 +163,7 @@ extern bool printTriggerDebug; #endif void TriggerShape::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger) { + UNUSED(useOnlyRisingEdgeForTrigger); // todo: move the following logic from below here // if (!useOnlyRisingEdgeForTrigger || stateParam == TV_RISE) { // expectedEventCount[channelIndex]++; diff --git a/firmware/controllers/trigger/decoders/trigger_structure.h b/firmware/controllers/trigger/decoders/trigger_structure.h index 1c4aa09a5e..7de8cfd1fd 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.h +++ b/firmware/controllers/trigger/decoders/trigger_structure.h @@ -206,7 +206,7 @@ public: * but name is supposed to hint at the fact that decoders should not be assigning to it * Please use "getTriggerSize()" macro or "getSize()" method to read this value */ - int privateTriggerDefinitionSize; + unsigned int privateTriggerDefinitionSize; bool useOnlyRisingEdgeForTriggerTemp; diff --git a/firmware/controllers/trigger/decoders/trigger_universal.cpp b/firmware/controllers/trigger/decoders/trigger_universal.cpp index 525a9f74b8..6229f34fcd 100644 --- a/firmware/controllers/trigger/decoders/trigger_universal.cpp +++ b/firmware/controllers/trigger/decoders/trigger_universal.cpp @@ -47,8 +47,6 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode) { - float engineCycle = getEngineCycle(operationMode); - s->initialize(FOUR_STROKE_CAM_SENSOR, true); s->addEvent720(180, T_PRIMARY, TV_RISE); @@ -62,6 +60,7 @@ void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode) { } void configureOnePlus60_2(TriggerShape *s, operation_mode_e operationMode) { + UNUSED(operationMode); s->initialize(FOUR_STROKE_CAM_SENSOR, true); int totalTeethCount = 60; @@ -80,6 +79,7 @@ void configureOnePlus60_2(TriggerShape *s, operation_mode_e operationMode) { } void configure3_1_cam(TriggerShape *s, operation_mode_e operationMode) { + UNUSED(operationMode); s->initialize(FOUR_STROKE_CAM_SENSOR, true); diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 068d5e3909..d11f117066 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -136,7 +136,7 @@ void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE shape->riseOnlyIndexes[0] = 0; } else { assertAngleRange(shape->triggerShapeSynchPointIndex, "triggerShapeSynchPointIndex", CUSTOM_ERR_6552); - int triggerDefinitionCoordinate = (shape->triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount; + unsigned int triggerDefinitionCoordinate = (shape->triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount; efiAssertVoid(CUSTOM_ERR_6595, engine->engineCycleEventCount != 0, "zero engineCycleEventCount"); int triggerDefinitionIndex = triggerDefinitionCoordinate >= shape->privateTriggerDefinitionSize ? triggerDefinitionCoordinate - shape->privateTriggerDefinitionSize : triggerDefinitionCoordinate; float angle = shape->getAngle(triggerDefinitionCoordinate) - firstAngle; @@ -536,7 +536,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no getTriggerSize()); } #endif /* EFI_UNIT_TEST */ - int endOfCycleIndex = getTriggerSize() - (CONFIG(useOnlyRisingEdgeForTrigger) ? 2 : 1); + unsigned int endOfCycleIndex = getTriggerSize() - (CONFIG(useOnlyRisingEdgeForTrigger) ? 2 : 1); isSynchronizationPoint = !shaft_is_synchronized || (currentCycle.current_index >= endOfCycleIndex); @@ -632,6 +632,7 @@ static void onFindIndexCallback(TriggerState *state) { */ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX) { + UNUSED(triggerConfig); #if EFI_PROD_CODE || defined(__DOXYGEN__) efiAssert(CUSTOM_ERR_ASSERT, getRemainingStack(chThdGetSelfX()) > 128, "findPos", -1); #endif @@ -685,6 +686,7 @@ efitime_t TriggerState::getStartOfRevolutionIndex() const { } void TriggerState::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { + UNUSED(nowNt); // empty base implementation } diff --git a/firmware/global.h b/firmware/global.h index 82d3adfbde..40774fae51 100644 --- a/firmware/global.h +++ b/firmware/global.h @@ -27,7 +27,7 @@ extern "C" #if defined __GNUC__ // GCC #include -#define ALWAYS_INLINE __attribute__((always_inline)) +#define ALWAYS_INLINE __attribute__((always_inline)) inline #else // IAR typedef unsigned int time_t; diff --git a/firmware/hw_layer/cdm_ion_sense.cpp b/firmware/hw_layer/cdm_ion_sense.cpp index 2f90e97c16..4fe6505903 100644 --- a/firmware/hw_layer/cdm_ion_sense.cpp +++ b/firmware/hw_layer/cdm_ion_sense.cpp @@ -62,7 +62,7 @@ void cdmIonInit(void) { return; } - enableExti(CONFIGB(cdmInputPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extIonCallback); + enableExti(CONFIGB(cdmInputPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extIonCallback); } #endif /* EFI_CDM_INTEGRATION */ diff --git a/firmware/hw_layer/joystick.cpp b/firmware/hw_layer/joystick.cpp index 8f9db44455..32ccba94c7 100644 --- a/firmware/hw_layer/joystick.cpp +++ b/firmware/hw_layer/joystick.cpp @@ -104,11 +104,11 @@ void initJoystick(Logging *shared) { return; sharedLogger = shared; - enableExti(CONFIGB(joystickCenterPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extCallback); - enableExti(CONFIGB(joystickAPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extCallback); + enableExti(CONFIGB(joystickCenterPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extCallback); + enableExti(CONFIGB(joystickAPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extCallback); // not used so far applyPin(CONFIGB(joystickBPin)); // not used so far applyPin(CONFIGB(joystickCPin)); - enableExti(CONFIGB(joystickDPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extCallback); + enableExti(CONFIGB(joystickDPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extCallback); efiSetPadMode("joy center", CONFIGB(joystickCenterPin), PAL_MODE_INPUT_PULLUP); efiSetPadMode("joy A", CONFIGB(joystickAPin), PAL_MODE_INPUT_PULLUP); diff --git a/firmware/util/cyclic_buffer.h b/firmware/util/cyclic_buffer.h index 413e89aca0..7556f2fd6c 100644 --- a/firmware/util/cyclic_buffer.h +++ b/firmware/util/cyclic_buffer.h @@ -41,7 +41,7 @@ class cyclic_buffer T sum(int length) const; T maxValue(int length) const; T minValue(int length) const; - void setSize(int size); + void setSize(unsigned int size); bool contains(T value) const; int getSize() const; int getCount() const; @@ -125,7 +125,7 @@ bool cyclic_buffer::contains(T value) const { } template -void cyclic_buffer::setSize(int size) { +void cyclic_buffer::setSize(unsigned int size) { clear(); this->size = size < maxSize ? size : maxSize; }