only:variable shadowing should be avoided #5676
This commit is contained in:
parent
91ba507d4b
commit
35e57475a4
|
@ -139,8 +139,9 @@ static uint8_t cylinderNumberCopy;
|
||||||
|
|
||||||
// Called when its time to start listening for knock
|
// Called when its time to start listening for knock
|
||||||
// Does some math, then hands off to the driver to start any sampling hardware
|
// Does some math, then hands off to the driver to start any sampling hardware
|
||||||
static void startKnockSampling(Engine* engine) {
|
static void startKnockSampling(Engine* p_engine) {
|
||||||
if (!engine->rpmCalculator.isRunning()) {
|
// todo: why do we pass engine as parameter? is that for unit tests?
|
||||||
|
if (!p_engine->rpmCalculator.isRunning()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ SimplePwm::SimplePwm()
|
||||||
seq.phaseCount = 2;
|
seq.phaseCount = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimplePwm::SimplePwm(const char *name) : SimplePwm() {
|
SimplePwm::SimplePwm(const char *p_name) : SimplePwm() {
|
||||||
this->name = name;
|
name = p_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
PwmConfig::PwmConfig() {
|
PwmConfig::PwmConfig() {
|
||||||
|
@ -288,10 +288,12 @@ void copyPwmParameters(PwmConfig *state, MultiChannelStateSequence const * seq)
|
||||||
* this method also starts the timer cycle
|
* this method also starts the timer cycle
|
||||||
* See also startSimplePwm
|
* See also startSimplePwm
|
||||||
*/
|
*/
|
||||||
void PwmConfig::weComplexInit(ExecutorInterface *executor,
|
void PwmConfig::weComplexInit(ExecutorInterface *p_executor,
|
||||||
MultiChannelStateSequence const * seq,
|
MultiChannelStateSequence const * seq,
|
||||||
pwm_cycle_callback *pwmCycleCallback, pwm_gen_callback *stateChangeCallback) {
|
pwm_cycle_callback *p_pwmCycleCallback, pwm_gen_callback *p_stateChangeCallback) {
|
||||||
this->executor = executor;
|
executor = p_executor;
|
||||||
|
pwmCycleCallback = p_pwmCycleCallback;
|
||||||
|
stateChangeCallback = p_stateChangeCallback;
|
||||||
isStopRequested = false;
|
isStopRequested = false;
|
||||||
|
|
||||||
// NaN is 'not initialized' but zero is not expected
|
// 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->phaseCount <= PWM_PHASE_MAX_COUNT, "too many phases in PWM");
|
||||||
criticalAssertVoid(seq->waveCount > 0, "waveCount should be positive");
|
criticalAssertVoid(seq->waveCount > 0, "waveCount should be positive");
|
||||||
|
|
||||||
this->pwmCycleCallback = pwmCycleCallback;
|
|
||||||
this->stateChangeCallback = stateChangeCallback;
|
|
||||||
|
|
||||||
copyPwmParameters(this, seq);
|
copyPwmParameters(this, seq);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,10 @@ TriggerWaveform::TriggerWaveform() {
|
||||||
initialize(OM_NONE, SyncEdge::Rise);
|
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
|
isSynchronizationNeeded = true; // that's default value
|
||||||
isSecondWheelCam = false;
|
isSecondWheelCam = false;
|
||||||
needSecondTriggerInput = false;
|
needSecondTriggerInput = false;
|
||||||
|
@ -67,8 +70,6 @@ void TriggerWaveform::initialize(operation_mode_e operationMode, SyncEdge syncEd
|
||||||
shapeDefinitionError = false;
|
shapeDefinitionError = false;
|
||||||
useOnlyPrimaryForSync = false;
|
useOnlyPrimaryForSync = false;
|
||||||
|
|
||||||
this->operationMode = operationMode;
|
|
||||||
this->syncEdge = syncEdge;
|
|
||||||
triggerShapeSynchPointIndex = 0;
|
triggerShapeSynchPointIndex = 0;
|
||||||
memset(expectedEventCount, 0, sizeof(expectedEventCount));
|
memset(expectedEventCount, 0, sizeof(expectedEventCount));
|
||||||
wave.reset();
|
wave.reset();
|
||||||
|
|
|
@ -1032,9 +1032,9 @@ void onConfigurationChangeTriggerCallback() {
|
||||||
getTriggerCentral()->triggerConfigChangedOnLastConfigurationChange = getTriggerCentral()->triggerConfigChangedOnLastConfigurationChange || changed;
|
getTriggerCentral()->triggerConfigChangedOnLastConfigurationChange = getTriggerCentral()->triggerConfigChangedOnLastConfigurationChange || changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initVvtShape(TriggerWaveform& shape, const TriggerConfiguration& config, TriggerDecoderBase &initState) {
|
static void initVvtShape(TriggerWaveform& shape, const TriggerConfiguration& p_config, TriggerDecoderBase &initState) {
|
||||||
shape.initializeTriggerWaveform(FOUR_STROKE_CAM_SENSOR, config.TriggerType);
|
shape.initializeTriggerWaveform(FOUR_STROKE_CAM_SENSOR, p_config.TriggerType);
|
||||||
shape.initializeSyncPoint(initState, config);
|
shape.initializeSyncPoint(initState, p_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerCentral::validateCamVvtCounters() {
|
void TriggerCentral::validateCamVvtCounters() {
|
||||||
|
|
|
@ -49,8 +49,8 @@
|
||||||
#define NOISE_RATIO_THRESHOLD 3000
|
#define NOISE_RATIO_THRESHOLD 3000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TriggerDecoderBase::TriggerDecoderBase(const char* name)
|
TriggerDecoderBase::TriggerDecoderBase(const char* p_name)
|
||||||
: name(name)
|
: name(p_name)
|
||||||
{
|
{
|
||||||
TriggerDecoderBase::resetState();
|
TriggerDecoderBase::resetState();
|
||||||
}
|
}
|
||||||
|
@ -104,8 +104,8 @@ void TriggerDecoderBase::resetCurrentCycleState() {
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
|
|
||||||
PrimaryTriggerDecoder::PrimaryTriggerDecoder(const char* name)
|
PrimaryTriggerDecoder::PrimaryTriggerDecoder(const char* p_name)
|
||||||
: TriggerDecoderBase(name)
|
: TriggerDecoderBase(p_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 defined(STM32F4XX) || defined(STM32F7XX)
|
||||||
if (isListenOnly)
|
if (isListenOnly)
|
||||||
config->btr += CAN_BTR_SILM;
|
canConfig->btr += CAN_BTR_SILM;
|
||||||
#else
|
#else
|
||||||
if (isListenOnly)
|
if (isListenOnly)
|
||||||
criticalError("CAN:ListenOnly not implemented yet");
|
criticalError("CAN:ListenOnly not implemented yet");
|
||||||
|
@ -377,17 +377,17 @@ void initCan() {
|
||||||
// Initialize peripherals
|
// Initialize peripherals
|
||||||
if (device1) {
|
if (device1) {
|
||||||
// Config based on baud rate
|
// Config based on baud rate
|
||||||
CANConfig config;
|
CANConfig canConfig;
|
||||||
memcpy(&config, findConfig(engineConfiguration->canBaudRate), sizeof(config));
|
memcpy(&canConfig, findConfig(engineConfiguration->canBaudRate), sizeof(canConfig));
|
||||||
applyListenOnly(&config, engineConfiguration->can1ListenMode);
|
applyListenOnly(&canConfig, engineConfiguration->can1ListenMode);
|
||||||
canStart(device1, &config);
|
canStart(device1, &canConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device2) {
|
if (device2) {
|
||||||
CANConfig config;
|
CANConfig canConfig;
|
||||||
memcpy(&config, findConfig(engineConfiguration->can2BaudRate), sizeof(config));
|
memcpy(&canConfig, findConfig(engineConfiguration->can2BaudRate), sizeof(canConfig));
|
||||||
applyListenOnly(&config, engineConfiguration->can2ListenMode);
|
applyListenOnly(&canConfig, engineConfiguration->can2ListenMode);
|
||||||
canStart(device2, &config);
|
canStart(device2, &canConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plumb CAN devices to tx system
|
// Plumb CAN devices to tx system
|
||||||
|
|
|
@ -28,8 +28,8 @@ fifo_buffer<CANTxFrame, 1024> txCanBuffer;
|
||||||
}
|
}
|
||||||
#endif // EFI_CAN_SUPPORT
|
#endif // EFI_CAN_SUPPORT
|
||||||
|
|
||||||
CanTxMessage::CanTxMessage(CanCategory category, uint32_t eid, uint8_t dlc, size_t bus, bool isExtended) {
|
CanTxMessage::CanTxMessage(CanCategory p_category, uint32_t eid, uint8_t dlc, size_t bus, bool isExtended) {
|
||||||
this->category = category;
|
category = p_category;
|
||||||
#if HAS_CAN_FRAME
|
#if HAS_CAN_FRAME
|
||||||
#ifndef STM32H7XX
|
#ifndef STM32H7XX
|
||||||
// ST bxCAN device
|
// ST bxCAN device
|
||||||
|
|
|
@ -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) {
|
void Dac::SetVoltage(int channel, float voltage) {
|
||||||
|
|
|
@ -22,8 +22,8 @@ private:
|
||||||
const ProtectedGpioConfig* m_config;
|
const ProtectedGpioConfig* m_config;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ProtectedGpio::configure(const ProtectedGpioConfig& config) {
|
void ProtectedGpio::configure(const ProtectedGpioConfig& p_config) {
|
||||||
m_config = &config;
|
m_config = &p_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProtectedGpio::setPadMode(iomode_t mode) {
|
int ProtectedGpio::setPadMode(iomode_t mode) {
|
||||||
|
|
|
@ -545,9 +545,9 @@ static MAILBOX_DECL(sent_mb, sent_mb_buffer, SENT_MB_SIZE);
|
||||||
|
|
||||||
static THD_WORKING_AREA(waSentDecoderThread, 256);
|
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 */
|
/* encode to fit msg_t */
|
||||||
msg_t msg = (ch << 16) | clocks;
|
msg_t msg = (channel << 16) | clocks;
|
||||||
|
|
||||||
/* called from ISR */
|
/* called from ISR */
|
||||||
chSysLockFromISR();
|
chSysLockFromISR();
|
||||||
|
@ -567,17 +567,17 @@ static void SentDecoderThread(void*) {
|
||||||
uint8_t n = (msg >> 16) & 0xff;
|
uint8_t n = (msg >> 16) & 0xff;
|
||||||
|
|
||||||
if (n < SENT_CHANNELS_NUM) {
|
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;
|
uint16_t sig0, sig1;
|
||||||
ch.GetSignals(NULL, &sig0, &sig1);
|
channel.GetSignals(NULL, &sig0, &sig1);
|
||||||
engine->sent_state.value0 = sig0;
|
engine->sent_state.value0 = sig0;
|
||||||
engine->sent_state.value1 = sig1;
|
engine->sent_state.value1 = sig1;
|
||||||
|
|
||||||
#if SENT_STATISTIC_COUNTERS
|
#if SENT_STATISTIC_COUNTERS
|
||||||
engine->sent_state.errorRate = ch.statistic.getErrorRate();
|
engine->sent_state.errorRate = channel.statistic.getErrorRate();
|
||||||
#endif // SENT_STATISTIC_COUNTERS
|
#endif // SENT_STATISTIC_COUNTERS
|
||||||
|
|
||||||
|
|
||||||
|
@ -592,11 +592,11 @@ static void SentDecoderThread(void*) {
|
||||||
static void printSentInfo() {
|
static void printSentInfo() {
|
||||||
#if EFI_SENT_SUPPORT
|
#if EFI_SENT_SUPPORT
|
||||||
for (int i = 0; i < SENT_CHANNELS_NUM; i++) {
|
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]);
|
const char * pinName = getBoardSpecificPinName(engineConfiguration->sentInputPins[i]);
|
||||||
efiPrintf("---- SENT ch %d ---- on %s", i, pinName);
|
efiPrintf("---- SENT ch %d ---- on %s", i, pinName);
|
||||||
ch.Info();
|
channel.Info();
|
||||||
efiPrintf("--------------------");
|
efiPrintf("--------------------");
|
||||||
}
|
}
|
||||||
#endif // EFI_SENT_SUPPORT
|
#endif // EFI_SENT_SUPPORT
|
||||||
|
@ -607,9 +607,9 @@ static void printSentInfo() {
|
||||||
float getSentValue(size_t index) {
|
float getSentValue(size_t index) {
|
||||||
if (index < SENT_CHANNELS_NUM) {
|
if (index < SENT_CHANNELS_NUM) {
|
||||||
uint16_t sig0, sig1;
|
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
|
// GM sig0 + sig1 == 0xfff but Ford does not
|
||||||
/* scale to 0.0 .. 1.0 */
|
/* 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) {
|
int getSentValues(size_t index, uint16_t *sig0, uint16_t *sig1) {
|
||||||
if (index < SENT_CHANNELS_NUM) {
|
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 */
|
/* invalid channel */
|
||||||
|
|
|
@ -58,32 +58,32 @@ static SensorConverter& configureTempSensorFunction(const char *msg,
|
||||||
static void configTherm(const char *msg,
|
static void configTherm(const char *msg,
|
||||||
FunctionalSensor &sensor,
|
FunctionalSensor &sensor,
|
||||||
FuncPair &p,
|
FuncPair &p,
|
||||||
ThermistorConf &config,
|
ThermistorConf &p_config,
|
||||||
bool isLinear,
|
bool isLinear,
|
||||||
bool isPulldown) {
|
bool isPulldown) {
|
||||||
// nothing to do if no channel
|
// nothing to do if no channel
|
||||||
if (!isAdcChannelValid(config.adcChannel)) {
|
if (!isAdcChannelValid(p_config.adcChannel)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure the conversion function for this sensor
|
// 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,
|
static void configureTempSensor(const char *msg,
|
||||||
FunctionalSensor &sensor,
|
FunctionalSensor &sensor,
|
||||||
FuncPair &p,
|
FuncPair &p,
|
||||||
ThermistorConf &config,
|
ThermistorConf &p_config,
|
||||||
bool isLinear,
|
bool isLinear,
|
||||||
bool isPulldown = false) {
|
bool isPulldown = false) {
|
||||||
auto channel = config.adcChannel;
|
auto channel = p_config.adcChannel;
|
||||||
|
|
||||||
// Only register if we have a sensor
|
// Only register if we have a sensor
|
||||||
if (!isAdcChannelValid(channel)) {
|
if (!isAdcChannelValid(channel)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
configTherm(msg, sensor, p, config, isLinear, isPulldown);
|
configTherm(msg, sensor, p, p_config, isLinear, isPulldown);
|
||||||
|
|
||||||
// Register & subscribe
|
// Register & subscribe
|
||||||
AdcSubscription::SubscribeSensor(sensor, channel, 2);
|
AdcSubscription::SubscribeSensor(sensor, channel, 2);
|
||||||
|
|
Loading…
Reference in New Issue