mirror of https://github.com/ArduPilot/ardupilot
AP_LeakDetector: AP_LeakDetector_Digital: Improve status logic
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
This commit is contained in:
parent
ea0d869a9c
commit
e4f8d47423
|
@ -11,7 +11,7 @@ void AP_LeakDetector_Digital::read()
|
||||||
{
|
{
|
||||||
if (leak_detector._pin[state.instance] >= 0) {
|
if (leak_detector._pin[state.instance] >= 0) {
|
||||||
hal.gpio->pinMode(leak_detector._pin[state.instance], HAL_GPIO_INPUT);
|
hal.gpio->pinMode(leak_detector._pin[state.instance], HAL_GPIO_INPUT);
|
||||||
state.status = hal.gpio->read(leak_detector._pin[state.instance])==leak_detector._default_reading[state.instance]?false:true;
|
state.status = hal.gpio->read(leak_detector._pin[state.instance]) != leak_detector._default_reading[state.instance];
|
||||||
} else {
|
} else {
|
||||||
state.status = false;
|
state.status = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue