hella_oil_level: check for errors, deInit()
This commit is contained in:
parent
6f564bd73b
commit
605b9c6db7
|
@ -15,17 +15,30 @@ void HellaOilLevelSensor::init(brain_pin_e pin) {
|
|||
return;
|
||||
}
|
||||
|
||||
m_pin = pin;
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
efiExtiEnablePin(getSensorName(), pin,
|
||||
PAL_EVENT_MODE_BOTH_EDGES,
|
||||
hellaSensorExtiCallback, reinterpret_cast<void*>(this));
|
||||
if (efiExtiEnablePin(getSensorName(), pin, PAL_EVENT_MODE_BOTH_EDGES,
|
||||
hellaSensorExtiCallback, reinterpret_cast<void*>(this)) < 0) {
|
||||
return;
|
||||
}
|
||||
#endif // EFI_PROD_CODE
|
||||
|
||||
m_pin = pin;
|
||||
|
||||
Register();
|
||||
}
|
||||
|
||||
void HellaOilLevelSensor::deInit() {
|
||||
if (!isBrainPinValid(m_pin)) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
efiExtiDisablePin(m_pin);
|
||||
#endif
|
||||
|
||||
m_pin = Gpio::Unassigned;
|
||||
}
|
||||
|
||||
void HellaOilLevelSensor::onEdge(efitick_t nowNt) {
|
||||
if (efiReadPin(m_pin)) {
|
||||
// Start pulse width timing at the rising edge
|
||||
|
|
|
@ -7,6 +7,7 @@ public:
|
|||
HellaOilLevelSensor(SensorType type) : StoredValueSensor(type, MS2NT(2000)) {}
|
||||
|
||||
void init(brain_pin_e pin);
|
||||
void deInit();
|
||||
|
||||
void onEdge(efitick_t nowNt);
|
||||
|
||||
|
|
Loading…
Reference in New Issue