only:variable shadowing should be avoided #5676

This commit is contained in:
rusefillc 2023-11-01 12:12:50 -04:00
parent 91ba507d4b
commit 35e57475a4
11 changed files with 55 additions and 53 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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();

View File

@ -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() {

View File

@ -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)
{
}

View File

@ -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

View File

@ -28,8 +28,8 @@ fifo_buffer<CANTxFrame, 1024> 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

View File

@ -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) {

View File

@ -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) {

View File

@ -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 */

View File

@ -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);