mirror of https://github.com/rusefi/rusefi.git
only:variable shadowing should be avoided #5676
This commit is contained in:
parent
781a236885
commit
b3d921d961
|
@ -30,11 +30,11 @@ void TwoPinDcMotor::enable() {
|
|||
msg = nullptr;
|
||||
}
|
||||
|
||||
void TwoPinDcMotor::disable(const char *msg) {
|
||||
void TwoPinDcMotor::disable(const char *p_msg) {
|
||||
msg = p_msg;
|
||||
if (m_disable) {
|
||||
m_disable->setValue(true);
|
||||
}
|
||||
this->msg = msg;
|
||||
// Also set the duty to zero
|
||||
set(0);
|
||||
}
|
||||
|
|
|
@ -57,18 +57,18 @@ static const char* const auxValveShortNames[] = { "a1", "a2"};
|
|||
|
||||
static RegisteredOutputPin * registeredOutputHead = nullptr;
|
||||
|
||||
RegisteredNamedOutputPin::RegisteredNamedOutputPin(const char *name, size_t pinOffset,
|
||||
size_t pinModeOffset) : RegisteredOutputPin(name, pinOffset, pinModeOffset) {
|
||||
RegisteredNamedOutputPin::RegisteredNamedOutputPin(const char *p_name, size_t pinOffset,
|
||||
size_t pinModeOffset) : RegisteredOutputPin(p_name, pinOffset, pinModeOffset) {
|
||||
}
|
||||
|
||||
RegisteredNamedOutputPin::RegisteredNamedOutputPin(const char *name, size_t pinOffset) :
|
||||
RegisteredOutputPin(name, pinOffset) {
|
||||
RegisteredNamedOutputPin::RegisteredNamedOutputPin(const char *p_name, size_t pinOffset) :
|
||||
RegisteredOutputPin(p_name, pinOffset) {
|
||||
}
|
||||
|
||||
RegisteredOutputPin::RegisteredOutputPin(const char *registrationName, size_t pinOffset,
|
||||
RegisteredOutputPin::RegisteredOutputPin(const char *p_registrationName, size_t pinOffset,
|
||||
size_t pinModeOffset)
|
||||
: next(registeredOutputHead)
|
||||
, registrationName(registrationName)
|
||||
, registrationName(p_registrationName)
|
||||
, m_pinOffset(static_cast<uint16_t>(pinOffset))
|
||||
, m_hasPinMode(true)
|
||||
, m_pinModeOffset(static_cast<uint16_t>(pinModeOffset))
|
||||
|
@ -77,9 +77,9 @@ RegisteredOutputPin::RegisteredOutputPin(const char *registrationName, size_t pi
|
|||
registeredOutputHead = this;
|
||||
}
|
||||
|
||||
RegisteredOutputPin::RegisteredOutputPin(const char *registrationName, size_t pinOffset)
|
||||
RegisteredOutputPin::RegisteredOutputPin(const char *p_registrationName, size_t pinOffset)
|
||||
: next(registeredOutputHead)
|
||||
, registrationName(registrationName)
|
||||
, registrationName(p_registrationName)
|
||||
, m_pinOffset(static_cast<uint16_t>(pinOffset))
|
||||
, m_hasPinMode(false)
|
||||
, m_pinModeOffset(-1)
|
||||
|
@ -374,8 +374,8 @@ OutputPin *EnginePins::getOutputPinForBenchMode(bench_mode_e index) {
|
|||
NamedOutputPin::NamedOutputPin() : OutputPin() {
|
||||
}
|
||||
|
||||
NamedOutputPin::NamedOutputPin(const char *name) : OutputPin() {
|
||||
this->name = name;
|
||||
NamedOutputPin::NamedOutputPin(const char *p_name) : OutputPin() {
|
||||
name = p_name;
|
||||
}
|
||||
|
||||
const char *NamedOutputPin::getName() const {
|
||||
|
@ -657,16 +657,16 @@ void initOutputPins() {
|
|||
#endif /* EFI_GPIO_HARDWARE */
|
||||
}
|
||||
|
||||
void OutputPin::initPin(const char *msg, brain_pin_e brainPin) {
|
||||
initPin(msg, brainPin, OM_DEFAULT);
|
||||
void OutputPin::initPin(const char *p_msg, brain_pin_e p_brainPin) {
|
||||
initPin(p_msg, p_brainPin, OM_DEFAULT);
|
||||
}
|
||||
|
||||
void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError) {
|
||||
void OutputPin::initPin(const char *msg, brain_pin_e p_brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError) {
|
||||
#if EFI_UNIT_TEST
|
||||
pinToggleCounter = 0;
|
||||
#endif
|
||||
|
||||
if (!isBrainPinValid(brainPin)) {
|
||||
if (!isBrainPinValid(p_brainPin)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -681,7 +681,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e
|
|||
|
||||
// Check that this OutputPin isn't already assigned to another pin (reinit is allowed to change mode)
|
||||
// To avoid this error, call deInit() first
|
||||
if (isBrainPinValid(this->brainPin) && this->brainPin != brainPin) {
|
||||
if (isBrainPinValid(brainPin) && brainPin != p_brainPin) {
|
||||
firmwareError(ObdCode::CUSTOM_OBD_PIN_CONFLICT, "outputPin [%s] already assigned, cannot reassign without unregister first", msg);
|
||||
return;
|
||||
}
|
||||
|
@ -690,30 +690,27 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e
|
|||
firmwareError(ObdCode::CUSTOM_INVALID_MODE_SETTING, "%s invalid pin_output_mode_e %d %s",
|
||||
msg,
|
||||
outputMode,
|
||||
hwPortname(brainPin)
|
||||
hwPortname(p_brainPin)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
#if EFI_GPIO_HARDWARE && EFI_PROD_CODE
|
||||
iomode_t mode = (outputMode == OM_DEFAULT || outputMode == OM_INVERTED) ?
|
||||
iomode_t l_mode = (outputMode == OM_DEFAULT || outputMode == OM_INVERTED) ?
|
||||
PAL_MODE_OUTPUT_PUSHPULL : PAL_MODE_OUTPUT_OPENDRAIN;
|
||||
|
||||
#if (BOARD_EXT_GPIOCHIPS > 0)
|
||||
this->ext = false;
|
||||
#endif
|
||||
if (brain_pin_is_onchip(brainPin)) {
|
||||
ioportid_t port = getHwPort(msg, brainPin);
|
||||
int pin = getHwPin(msg, brainPin);
|
||||
if (brain_pin_is_onchip(p_brainPin)) {
|
||||
port = getHwPort(msg, p_brainPin);
|
||||
pin = getHwPin(msg, p_brainPin);
|
||||
|
||||
// Validate port
|
||||
if (port == GPIO_NULL) {
|
||||
criticalError("OutputPin::initPin got invalid port for pin idx %d", static_cast<int>(brainPin));
|
||||
criticalError("OutputPin::initPin got invalid port for pin idx %d", static_cast<int>(p_brainPin));
|
||||
return;
|
||||
}
|
||||
|
||||
this->port = port;
|
||||
this->pin = pin;
|
||||
}
|
||||
#if (BOARD_EXT_GPIOCHIPS > 0)
|
||||
else {
|
||||
|
@ -722,7 +719,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e
|
|||
#endif
|
||||
#endif // briefly leave the include guard because we need to set default state in tests
|
||||
|
||||
this->brainPin = brainPin;
|
||||
brainPin = p_brainPin;
|
||||
|
||||
// The order of the next two calls may look strange, which is a good observation.
|
||||
// We call them in this order so that the pin is set to a known state BEFORE
|
||||
|
@ -731,7 +728,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e
|
|||
setDefaultPinState(outputMode);
|
||||
|
||||
#if EFI_GPIO_HARDWARE && EFI_PROD_CODE
|
||||
efiSetPadMode(msg, brainPin, mode);
|
||||
efiSetPadMode(msg, brainPin, l_mode);
|
||||
if (brain_pin_is_onchip(brainPin)) {
|
||||
int actualValue = palReadPad(port, pin);
|
||||
// we had enough drama with pin configuration in board.h and else that we shall self-check
|
||||
|
|
|
@ -43,7 +43,7 @@ TriggerEmulatorHelper::TriggerEmulatorHelper() {
|
|||
|
||||
static OutputPin emulatorOutputs[NUM_EMULATOR_CHANNELS][PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||
|
||||
void TriggerEmulatorHelper::handleEmulatorCallback(int ch, const MultiChannelStateSequence& multiChannelStateSequence, int stateIndex) {
|
||||
void TriggerEmulatorHelper::handleEmulatorCallback(int channel, const MultiChannelStateSequence& multiChannelStateSequence, int stateIndex) {
|
||||
efitick_t stamp = getTimeNowNt();
|
||||
|
||||
// todo: code duplication with TriggerStimulatorHelper::feedSimulatedEvent?
|
||||
|
@ -55,7 +55,7 @@ void TriggerEmulatorHelper::handleEmulatorCallback(int ch, const MultiChannelSta
|
|||
isRise ^= (i == 0 && engineConfiguration->invertPrimaryTriggerSignal);
|
||||
isRise ^= (i == 1 && engineConfiguration->invertSecondaryTriggerSignal);
|
||||
|
||||
if (ch == 0) {
|
||||
if (channel == 0) {
|
||||
handleShaftSignal(i, isRise, stamp);
|
||||
} else {
|
||||
// handleVvtCamSignal(isRise ? TriggerValue::RISE : TriggerValue::FALL, stamp, INDEX_BY_BANK_CAM(ch - 1, i));
|
||||
|
@ -111,13 +111,13 @@ void setTriggerEmulatorRPM(int rpm) {
|
|||
}
|
||||
|
||||
static void updateTriggerWaveformIfNeeded(PwmConfig *state) {
|
||||
for (int ch = 0; ch < 1; ch++) {
|
||||
if (atTriggerVersions[ch] < triggerEmulatorWaveforms[ch]->version) {
|
||||
atTriggerVersions[ch] = triggerEmulatorWaveforms[ch]->version;
|
||||
efiPrintf("Stimulator: updating trigger shape for ch%d: %d/%d %d", ch, atTriggerVersions[ch],
|
||||
for (int channel = 0; channel < 1; channel++) {
|
||||
if (atTriggerVersions[channel] < triggerEmulatorWaveforms[channel]->version) {
|
||||
atTriggerVersions[channel] = triggerEmulatorWaveforms[channel]->version;
|
||||
efiPrintf("Stimulator: updating trigger shape for ch%d: %d/%d %d", channel, atTriggerVersions[channel],
|
||||
engine->getGlobalConfigurationVersion(), getTimeNowMs());
|
||||
|
||||
copyPwmParameters(state, &triggerEmulatorWaveforms[ch]->wave);
|
||||
copyPwmParameters(state, &triggerEmulatorWaveforms[channel]->wave);
|
||||
state->safe.periodNt = -1; // this would cause loop re-initialization
|
||||
}
|
||||
}
|
||||
|
@ -163,11 +163,11 @@ static void startSimulatedTriggerSignal() {
|
|||
|
||||
setTriggerEmulatorRPM(engineConfiguration->triggerSimulatorRpm);
|
||||
|
||||
for (int ch = 0; ch < 1; ch++) {
|
||||
TriggerWaveform *s = triggerEmulatorWaveforms[ch];
|
||||
for (int channel = 0; channel < 1; channel++) {
|
||||
TriggerWaveform *s = triggerEmulatorWaveforms[channel];
|
||||
if (s->getSize() == 0)
|
||||
continue;
|
||||
triggerEmulatorSignals[ch].weComplexInit(
|
||||
triggerEmulatorSignals[channel].weComplexInit(
|
||||
&engine->executor,
|
||||
&s->wave,
|
||||
updateTriggerWaveformIfNeeded, emulatorApplyPinState);
|
||||
|
@ -196,8 +196,8 @@ void enableExternalTriggerStimulator() {
|
|||
|
||||
void disableTriggerStimulator() {
|
||||
engine->triggerCentral.directSelfStimulation = false;
|
||||
for (int ch = 0; ch < 1; ch++) {
|
||||
triggerEmulatorSignals[ch].stop();
|
||||
for (int channel = 0; channel < 1; channel++) {
|
||||
triggerEmulatorSignals[channel].stop();
|
||||
}
|
||||
hasInitTriggerEmulator = false;
|
||||
incrementGlobalConfigurationVersion("disTrg");
|
||||
|
@ -223,12 +223,12 @@ void initTriggerEmulator() {
|
|||
|
||||
void startTriggerEmulatorPins() {
|
||||
hasStimPins = false;
|
||||
for (int ch = 0; ch < 1; ch++) {
|
||||
for (size_t i = 0; i < efi::size(emulatorOutputs[ch]); i++) {
|
||||
triggerEmulatorSignals[ch].outputPins[i] = &emulatorOutputs[ch][i];
|
||||
for (int channel = 0; channel < 1; channel++) {
|
||||
for (size_t i = 0; i < efi::size(emulatorOutputs[channel]); i++) {
|
||||
triggerEmulatorSignals[channel].outputPins[i] = &emulatorOutputs[channel][i];
|
||||
|
||||
// todo: add pin configs for cam simulator channels
|
||||
if (ch != 0)
|
||||
if (channel != 0)
|
||||
continue;
|
||||
brain_pin_e pin = engineConfiguration->triggerSimulatorPins[i];
|
||||
|
||||
|
@ -239,7 +239,7 @@ void startTriggerEmulatorPins() {
|
|||
|
||||
#if EFI_PROD_CODE
|
||||
if (isConfigurationChanged(triggerSimulatorPins[i])) {
|
||||
triggerEmulatorSignals[ch].outputPins[i]->initPin("Trigger emulator", pin,
|
||||
triggerEmulatorSignals[channel].outputPins[i]->initPin("Trigger emulator", pin,
|
||||
engineConfiguration->triggerSimulatorPinModes[i]);
|
||||
}
|
||||
#endif // EFI_PROD_CODE
|
||||
|
@ -249,13 +249,13 @@ void startTriggerEmulatorPins() {
|
|||
|
||||
void stopTriggerEmulatorPins() {
|
||||
#if EFI_PROD_CODE
|
||||
for (int ch = 0; ch < NUM_EMULATOR_CHANNELS; ch++) {
|
||||
for (int channel = 0; channel < NUM_EMULATOR_CHANNELS; channel++) {
|
||||
// todo: add pin configs for cam simulator channels
|
||||
if (ch != 0)
|
||||
if (channel != 0)
|
||||
continue;
|
||||
for (size_t i = 0; i < efi::size(emulatorOutputs[ch]); i++) {
|
||||
for (size_t i = 0; i < efi::size(emulatorOutputs[channel]); i++) {
|
||||
if (isConfigurationChanged(triggerSimulatorPins[i])) {
|
||||
triggerEmulatorSignals[ch].outputPins[i]->deInit();
|
||||
triggerEmulatorSignals[channel].outputPins[i]->deInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ void TriggerStimulatorHelper::feedSimulatedEvent(
|
|||
const TriggerConfiguration& triggerConfiguration,
|
||||
TriggerDecoderBase& state,
|
||||
const TriggerWaveform& shape,
|
||||
int i
|
||||
int index
|
||||
) {
|
||||
efiAssertVoid(ObdCode::CUSTOM_ERR_6593, shape.getSize() > 0, "size not zero");
|
||||
int stateIndex = i % shape.getSize();
|
||||
int stateIndex = index % shape.getSize();
|
||||
|
||||
int time = getSimulatedEventTime(shape, i);
|
||||
int time = getSimulatedEventTime(shape, index);
|
||||
|
||||
const auto & multiChannelStateSequence = shape.wave;
|
||||
|
||||
|
|
|
@ -130,13 +130,13 @@ void Logging::reset() {
|
|||
*linePointer = 0;
|
||||
}
|
||||
|
||||
Logging::Logging(char const *name, char *buffer, int bufferSize)
|
||||
: name(name)
|
||||
, buffer(buffer)
|
||||
, bufferSize(bufferSize)
|
||||
Logging::Logging(char const *p_name, char *p_buffer, int p_bufferSize)
|
||||
: name(p_name)
|
||||
, buffer(p_buffer)
|
||||
, bufferSize(p_bufferSize)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
LoggingWithStorage::LoggingWithStorage(const char *name) : Logging(name, DEFAULT_BUFFER, sizeof(DEFAULT_BUFFER)) {
|
||||
LoggingWithStorage::LoggingWithStorage(const char *p_name) : Logging(p_name, DEFAULT_BUFFER, sizeof(DEFAULT_BUFFER)) {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue