parent
5b2f79722e
commit
30a96f0b03
|
@ -855,7 +855,7 @@ static void triggerShapeInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
extern PwmConfig triggerSignal;
|
extern PwmConfig triggerEmulatorSignal;
|
||||||
#endif /* #if EFI_PROD_CODE */
|
#endif /* #if EFI_PROD_CODE */
|
||||||
|
|
||||||
void triggerInfo(void) {
|
void triggerInfo(void) {
|
||||||
|
@ -924,7 +924,7 @@ void triggerInfo(void) {
|
||||||
#if EFI_EMULATE_POSITION_SENSORS
|
#if EFI_EMULATE_POSITION_SENSORS
|
||||||
efiPrintf("secondary trigger simulator: %s %s phase=%d",
|
efiPrintf("secondary trigger simulator: %s %s phase=%d",
|
||||||
hwPortname(engineConfiguration->triggerSimulatorPins[1]),
|
hwPortname(engineConfiguration->triggerSimulatorPins[1]),
|
||||||
getPin_output_mode_e(engineConfiguration->triggerSimulatorPinModes[1]), triggerSignal.safe.phaseIndex);
|
getPin_output_mode_e(engineConfiguration->triggerSimulatorPinModes[1]), triggerEmulatorSignal.safe.phaseIndex);
|
||||||
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ void TriggerEmulatorHelper::handleEmulatorCallback(const MultiChannelStateSequen
|
||||||
#endif // EFI_SHAFT_POSITION_INPUT
|
#endif // EFI_SHAFT_POSITION_INPUT
|
||||||
}
|
}
|
||||||
|
|
||||||
PwmConfig triggerSignal;
|
PwmConfig triggerEmulatorSignal;
|
||||||
|
|
||||||
static int atTriggerVersion = 0;
|
static int atTriggerVersion = 0;
|
||||||
|
|
||||||
|
@ -89,11 +89,11 @@ void setTriggerEmulatorRPM(int rpm) {
|
||||||
* togglePwmState() would see that the periodMs has changed and act accordingly
|
* togglePwmState() would see that the periodMs has changed and act accordingly
|
||||||
*/
|
*/
|
||||||
if (rpm == 0) {
|
if (rpm == 0) {
|
||||||
triggerSignal.setFrequency(NAN);
|
triggerEmulatorSignal.setFrequency(NAN);
|
||||||
} else {
|
} else {
|
||||||
float rpmM = getRpmMultiplier(getEngineRotationState()->getOperationMode());
|
float rpmM = getRpmMultiplier(getEngineRotationState()->getOperationMode());
|
||||||
float rPerSecond = rpm * rpmM / 60.0; // per minute converted to per second
|
float rPerSecond = rpm * rpmM / 60.0; // per minute converted to per second
|
||||||
triggerSignal.setFrequency(rPerSecond);
|
triggerEmulatorSignal.setFrequency(rPerSecond);
|
||||||
}
|
}
|
||||||
engine->resetEngineSnifferIfInTestMode();
|
engine->resetEngineSnifferIfInTestMode();
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ static void startSimulatedTriggerSignal() {
|
||||||
|
|
||||||
TriggerWaveform *s = &engine->triggerCentral.triggerShape;
|
TriggerWaveform *s = &engine->triggerCentral.triggerShape;
|
||||||
setTriggerEmulatorRPM(engineConfiguration->triggerSimulatorFrequency);
|
setTriggerEmulatorRPM(engineConfiguration->triggerSimulatorFrequency);
|
||||||
triggerSignal.weComplexInit("position sensor",
|
triggerEmulatorSignal.weComplexInit("position sensor",
|
||||||
&engine->executor,
|
&engine->executor,
|
||||||
&s->wave,
|
&s->wave,
|
||||||
updateTriggerWaveformIfNeeded, (pwm_gen_callback*)emulatorApplyPinState);
|
updateTriggerWaveformIfNeeded, (pwm_gen_callback*)emulatorApplyPinState);
|
||||||
|
@ -169,7 +169,7 @@ void enableExternalTriggerStimulator() {
|
||||||
|
|
||||||
void disableTriggerStimulator() {
|
void disableTriggerStimulator() {
|
||||||
engine->triggerCentral.directSelfStimulation = false;
|
engine->triggerCentral.directSelfStimulation = false;
|
||||||
triggerSignal.stop();
|
triggerEmulatorSignal.stop();
|
||||||
hasInitTriggerEmulator = false;
|
hasInitTriggerEmulator = false;
|
||||||
incrementGlobalConfigurationVersion();
|
incrementGlobalConfigurationVersion();
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ void initTriggerEmulator() {
|
||||||
void startTriggerEmulatorPins() {
|
void startTriggerEmulatorPins() {
|
||||||
hasStimPins = false;
|
hasStimPins = false;
|
||||||
for (size_t i = 0; i < efi::size(emulatorOutputs); i++) {
|
for (size_t i = 0; i < efi::size(emulatorOutputs); i++) {
|
||||||
triggerSignal.outputPins[i] = &emulatorOutputs[i];
|
triggerEmulatorSignal.outputPins[i] = &emulatorOutputs[i];
|
||||||
|
|
||||||
brain_pin_e pin = engineConfiguration->triggerSimulatorPins[i];
|
brain_pin_e pin = engineConfiguration->triggerSimulatorPins[i];
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ void startTriggerEmulatorPins() {
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
if (isConfigurationChanged(triggerSimulatorPins[i])) {
|
if (isConfigurationChanged(triggerSimulatorPins[i])) {
|
||||||
triggerSignal.outputPins[i]->initPin("Trigger emulator", pin,
|
triggerEmulatorSignal.outputPins[i]->initPin("Trigger emulator", pin,
|
||||||
&engineConfiguration->triggerSimulatorPinModes[i]);
|
&engineConfiguration->triggerSimulatorPinModes[i]);
|
||||||
}
|
}
|
||||||
#endif // EFI_PROD_CODE
|
#endif // EFI_PROD_CODE
|
||||||
|
@ -221,7 +221,7 @@ void stopTriggerEmulatorPins() {
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
for (size_t i = 0; i < efi::size(emulatorOutputs); i++) {
|
for (size_t i = 0; i < efi::size(emulatorOutputs); i++) {
|
||||||
if (isConfigurationChanged(triggerSimulatorPins[i])) {
|
if (isConfigurationChanged(triggerSimulatorPins[i])) {
|
||||||
triggerSignal.outputPins[i]->deInit();
|
triggerEmulatorSignal.outputPins[i]->deInit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // EFI_PROD_CODE
|
#endif // EFI_PROD_CODE
|
||||||
|
|
Loading…
Reference in New Issue