FrequencySensor::initIfValid: check for error
Do not set m_pin until we fully happy. Otherwise deInit() can do bad things to pin that is possibly not belongs to us.
This commit is contained in:
parent
f4cd6de86d
commit
0ce7db29b0
|
@ -28,15 +28,16 @@ void FrequencySensor::initIfValid(brain_pin_e pin, SensorConverter &converter, f
|
|||
|
||||
setFunction(converter);
|
||||
|
||||
m_pin = pin;
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
// todo: refactor https://github.com/rusefi/rusefi/issues/2123
|
||||
efiExtiEnablePin(getSensorName(), pin,
|
||||
PAL_EVENT_MODE_FALLING_EDGE,
|
||||
freqSensorExtiCallback, reinterpret_cast<void*>(this));
|
||||
if (efiExtiEnablePin(getSensorName(), pin, PAL_EVENT_MODE_FALLING_EDGE,
|
||||
freqSensorExtiCallback, reinterpret_cast<void*>(this)) < 0) {
|
||||
return;
|
||||
}
|
||||
#endif // EFI_PROD_CODE
|
||||
|
||||
m_pin = pin;
|
||||
|
||||
Register();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue