diff --git a/firmware/controllers/engine_cycle/knock_controller.cpp b/firmware/controllers/engine_cycle/knock_controller.cpp index 3d3b4e77ab..4384388e55 100644 --- a/firmware/controllers/engine_cycle/knock_controller.cpp +++ b/firmware/controllers/engine_cycle/knock_controller.cpp @@ -139,8 +139,9 @@ static uint8_t cylinderNumberCopy; // Called when its time to start listening for knock // Does some math, then hands off to the driver to start any sampling hardware -static void startKnockSampling(Engine* engine) { - if (!engine->rpmCalculator.isRunning()) { +static void startKnockSampling(Engine* p_engine) { + // todo: why do we pass engine as parameter? is that for unit tests? + if (!p_engine->rpmCalculator.isRunning()) { return; } diff --git a/firmware/controllers/system/timer/pwm_generator_logic.cpp b/firmware/controllers/system/timer/pwm_generator_logic.cpp index 02eca29f79..7155e625ed 100644 --- a/firmware/controllers/system/timer/pwm_generator_logic.cpp +++ b/firmware/controllers/system/timer/pwm_generator_logic.cpp @@ -26,8 +26,8 @@ SimplePwm::SimplePwm() seq.phaseCount = 2; } -SimplePwm::SimplePwm(const char *name) : SimplePwm() { - this->name = name; +SimplePwm::SimplePwm(const char *p_name) : SimplePwm() { + name = p_name; } PwmConfig::PwmConfig() { @@ -288,10 +288,12 @@ void copyPwmParameters(PwmConfig *state, MultiChannelStateSequence const * seq) * this method also starts the timer cycle * See also startSimplePwm */ -void PwmConfig::weComplexInit(ExecutorInterface *executor, +void PwmConfig::weComplexInit(ExecutorInterface *p_executor, MultiChannelStateSequence const * seq, - pwm_cycle_callback *pwmCycleCallback, pwm_gen_callback *stateChangeCallback) { - this->executor = executor; + pwm_cycle_callback *p_pwmCycleCallback, pwm_gen_callback *p_stateChangeCallback) { + executor = p_executor; + pwmCycleCallback = p_pwmCycleCallback; + stateChangeCallback = p_stateChangeCallback; isStopRequested = false; // NaN is 'not initialized' but zero is not expected @@ -300,8 +302,6 @@ void PwmConfig::weComplexInit(ExecutorInterface *executor, criticalAssertVoid(seq->phaseCount <= PWM_PHASE_MAX_COUNT, "too many phases in PWM"); criticalAssertVoid(seq->waveCount > 0, "waveCount should be positive"); - this->pwmCycleCallback = pwmCycleCallback; - this->stateChangeCallback = stateChangeCallback; copyPwmParameters(this, seq); diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index 9950875ec4..eef466bc7e 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -47,7 +47,10 @@ TriggerWaveform::TriggerWaveform() { initialize(OM_NONE, SyncEdge::Rise); } -void TriggerWaveform::initialize(operation_mode_e operationMode, SyncEdge syncEdge) { +void TriggerWaveform::initialize(operation_mode_e p_operationMode, SyncEdge p_syncEdge) { + operationMode = p_operationMode; + syncEdge = p_syncEdge; + isSynchronizationNeeded = true; // that's default value isSecondWheelCam = false; needSecondTriggerInput = false; @@ -67,8 +70,6 @@ void TriggerWaveform::initialize(operation_mode_e operationMode, SyncEdge syncEd shapeDefinitionError = false; useOnlyPrimaryForSync = false; - this->operationMode = operationMode; - this->syncEdge = syncEdge; triggerShapeSynchPointIndex = 0; memset(expectedEventCount, 0, sizeof(expectedEventCount)); wave.reset(); diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 42163c912b..231a50cc7a 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -1032,9 +1032,9 @@ void onConfigurationChangeTriggerCallback() { getTriggerCentral()->triggerConfigChangedOnLastConfigurationChange = getTriggerCentral()->triggerConfigChangedOnLastConfigurationChange || changed; } -static void initVvtShape(TriggerWaveform& shape, const TriggerConfiguration& config, TriggerDecoderBase &initState) { - shape.initializeTriggerWaveform(FOUR_STROKE_CAM_SENSOR, config.TriggerType); - shape.initializeSyncPoint(initState, config); +static void initVvtShape(TriggerWaveform& shape, const TriggerConfiguration& p_config, TriggerDecoderBase &initState) { + shape.initializeTriggerWaveform(FOUR_STROKE_CAM_SENSOR, p_config.TriggerType); + shape.initializeSyncPoint(initState, p_config); } void TriggerCentral::validateCamVvtCounters() { diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 4423b76dfe..df567bb02c 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -49,8 +49,8 @@ #define NOISE_RATIO_THRESHOLD 3000 #endif -TriggerDecoderBase::TriggerDecoderBase(const char* name) - : name(name) +TriggerDecoderBase::TriggerDecoderBase(const char* p_name) + : name(p_name) { TriggerDecoderBase::resetState(); } @@ -104,8 +104,8 @@ void TriggerDecoderBase::resetCurrentCycleState() { #if EFI_SHAFT_POSITION_INPUT -PrimaryTriggerDecoder::PrimaryTriggerDecoder(const char* name) - : TriggerDecoderBase(name) +PrimaryTriggerDecoder::PrimaryTriggerDecoder(const char* p_name) + : TriggerDecoderBase(p_name) { } diff --git a/firmware/hw_layer/drivers/can/can_hw.cpp b/firmware/hw_layer/drivers/can/can_hw.cpp index 0435d833fc..e84665032f 100644 --- a/firmware/hw_layer/drivers/can/can_hw.cpp +++ b/firmware/hw_layer/drivers/can/can_hw.cpp @@ -339,10 +339,10 @@ static const CANConfig * findConfig(can_baudrate_e rate) { } } -static void applyListenOnly(CANConfig* config, bool isListenOnly) { +static void applyListenOnly(CANConfig* canConfig, bool isListenOnly) { #if defined(STM32F4XX) || defined(STM32F7XX) if (isListenOnly) - config->btr += CAN_BTR_SILM; + canConfig->btr += CAN_BTR_SILM; #else if (isListenOnly) criticalError("CAN:ListenOnly not implemented yet"); @@ -377,17 +377,17 @@ void initCan() { // Initialize peripherals if (device1) { // Config based on baud rate - CANConfig config; - memcpy(&config, findConfig(engineConfiguration->canBaudRate), sizeof(config)); - applyListenOnly(&config, engineConfiguration->can1ListenMode); - canStart(device1, &config); + CANConfig canConfig; + memcpy(&canConfig, findConfig(engineConfiguration->canBaudRate), sizeof(canConfig)); + applyListenOnly(&canConfig, engineConfiguration->can1ListenMode); + canStart(device1, &canConfig); } if (device2) { - CANConfig config; - memcpy(&config, findConfig(engineConfiguration->can2BaudRate), sizeof(config)); - applyListenOnly(&config, engineConfiguration->can2ListenMode); - canStart(device2, &config); + CANConfig canConfig; + memcpy(&canConfig, findConfig(engineConfiguration->can2BaudRate), sizeof(canConfig)); + applyListenOnly(&canConfig, engineConfiguration->can2ListenMode); + canStart(device2, &canConfig); } // Plumb CAN devices to tx system diff --git a/firmware/hw_layer/drivers/can/can_msg_tx.cpp b/firmware/hw_layer/drivers/can/can_msg_tx.cpp index 7b109b6038..84105fbeea 100644 --- a/firmware/hw_layer/drivers/can/can_msg_tx.cpp +++ b/firmware/hw_layer/drivers/can/can_msg_tx.cpp @@ -28,8 +28,8 @@ fifo_buffer txCanBuffer; } #endif // EFI_CAN_SUPPORT -CanTxMessage::CanTxMessage(CanCategory category, uint32_t eid, uint8_t dlc, size_t bus, bool isExtended) { - this->category = category; +CanTxMessage::CanTxMessage(CanCategory p_category, uint32_t eid, uint8_t dlc, size_t bus, bool isExtended) { + category = p_category; #if HAS_CAN_FRAME #ifndef STM32H7XX // ST bxCAN device diff --git a/firmware/hw_layer/drivers/dac.cpp b/firmware/hw_layer/drivers/dac.cpp index cdf353a471..4b2f1ba30f 100644 --- a/firmware/hw_layer/drivers/dac.cpp +++ b/firmware/hw_layer/drivers/dac.cpp @@ -15,9 +15,9 @@ Dac::Dac(DACDriver& driver) { } -void Dac::Start(DACConfig& config) +void Dac::Start(DACConfig& p_config) { - dacStart(m_driver, &config); + dacStart(m_driver, &p_config); } void Dac::SetVoltage(int channel, float voltage) { diff --git a/firmware/hw_layer/drivers/gpio/protected_gpio.cpp b/firmware/hw_layer/drivers/gpio/protected_gpio.cpp index 0de5ce1e5e..e607fe3930 100644 --- a/firmware/hw_layer/drivers/gpio/protected_gpio.cpp +++ b/firmware/hw_layer/drivers/gpio/protected_gpio.cpp @@ -22,8 +22,8 @@ private: const ProtectedGpioConfig* m_config; }; -void ProtectedGpio::configure(const ProtectedGpioConfig& config) { - m_config = &config; +void ProtectedGpio::configure(const ProtectedGpioConfig& p_config) { + m_config = &p_config; } int ProtectedGpio::setPadMode(iomode_t mode) { diff --git a/firmware/hw_layer/drivers/sent/sent.cpp b/firmware/hw_layer/drivers/sent/sent.cpp index 0560aa3c9a..08b693b13c 100644 --- a/firmware/hw_layer/drivers/sent/sent.cpp +++ b/firmware/hw_layer/drivers/sent/sent.cpp @@ -545,9 +545,9 @@ static MAILBOX_DECL(sent_mb, sent_mb_buffer, SENT_MB_SIZE); static THD_WORKING_AREA(waSentDecoderThread, 256); -void SENT_ISR_Handler(uint8_t ch, uint16_t clocks) { +void SENT_ISR_Handler(uint8_t channel, uint16_t clocks) { /* encode to fit msg_t */ - msg_t msg = (ch << 16) | clocks; + msg_t msg = (channel << 16) | clocks; /* called from ISR */ chSysLockFromISR(); @@ -567,17 +567,17 @@ static void SentDecoderThread(void*) { uint8_t n = (msg >> 16) & 0xff; if (n < SENT_CHANNELS_NUM) { - sent_channel &ch = channels[n]; + sent_channel &channel = channels[n]; - if (ch.Decoder(tick) > 0) { + if (channel.Decoder(tick) > 0) { uint16_t sig0, sig1; - ch.GetSignals(NULL, &sig0, &sig1); + channel.GetSignals(NULL, &sig0, &sig1); engine->sent_state.value0 = sig0; engine->sent_state.value1 = sig1; #if SENT_STATISTIC_COUNTERS - engine->sent_state.errorRate = ch.statistic.getErrorRate(); + engine->sent_state.errorRate = channel.statistic.getErrorRate(); #endif // SENT_STATISTIC_COUNTERS @@ -592,11 +592,11 @@ static void SentDecoderThread(void*) { static void printSentInfo() { #if EFI_SENT_SUPPORT for (int i = 0; i < SENT_CHANNELS_NUM; i++) { - sent_channel &ch = channels[i]; + sent_channel &channel = channels[i]; const char * pinName = getBoardSpecificPinName(engineConfiguration->sentInputPins[i]); efiPrintf("---- SENT ch %d ---- on %s", i, pinName); - ch.Info(); + channel.Info(); efiPrintf("--------------------"); } #endif // EFI_SENT_SUPPORT @@ -607,9 +607,9 @@ static void printSentInfo() { float getSentValue(size_t index) { if (index < SENT_CHANNELS_NUM) { uint16_t sig0, sig1; - sent_channel &ch = channels[index]; + sent_channel &channel = channels[index]; - if (ch.GetSignals(NULL, &sig0, &sig1) == 0) { + if (channel.GetSignals(NULL, &sig0, &sig1) == 0) { // GM sig0 + sig1 == 0xfff but Ford does not /* scale to 0.0 .. 1.0 */ @@ -622,9 +622,9 @@ float getSentValue(size_t index) { int getSentValues(size_t index, uint16_t *sig0, uint16_t *sig1) { if (index < SENT_CHANNELS_NUM) { - sent_channel &ch = channels[index]; + sent_channel &channel = channels[index]; - return ch.GetSignals(NULL, sig0, sig1); + return channel.GetSignals(NULL, sig0, sig1); } /* invalid channel */ diff --git a/firmware/init/sensor/init_thermistors.cpp b/firmware/init/sensor/init_thermistors.cpp index c5980beb0a..59971f2379 100644 --- a/firmware/init/sensor/init_thermistors.cpp +++ b/firmware/init/sensor/init_thermistors.cpp @@ -58,32 +58,32 @@ static SensorConverter& configureTempSensorFunction(const char *msg, static void configTherm(const char *msg, FunctionalSensor &sensor, FuncPair &p, - ThermistorConf &config, + ThermistorConf &p_config, bool isLinear, bool isPulldown) { // nothing to do if no channel - if (!isAdcChannelValid(config.adcChannel)) { + if (!isAdcChannelValid(p_config.adcChannel)) { return; } // Configure the conversion function for this sensor - sensor.setFunction(configureTempSensorFunction(msg, config.config, p, isLinear, isPulldown)); + sensor.setFunction(configureTempSensorFunction(msg, p_config.config, p, isLinear, isPulldown)); } static void configureTempSensor(const char *msg, FunctionalSensor &sensor, FuncPair &p, - ThermistorConf &config, + ThermistorConf &p_config, bool isLinear, bool isPulldown = false) { - auto channel = config.adcChannel; + auto channel = p_config.adcChannel; // Only register if we have a sensor if (!isAdcChannelValid(channel)) { return; } - configTherm(msg, sensor, p, config, isLinear, isPulldown); + configTherm(msg, sensor, p, p_config, isLinear, isPulldown); // Register & subscribe AdcSubscription::SubscribeSensor(sensor, channel, 2);