AP_LeakDetector: AP_LeakDetector_Digital: Improve status logic

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
This commit is contained in:
Patrick José Pereira 2020-09-30 10:12:44 -03:00 committed by Jacob Walser
parent ea0d869a9c
commit e4f8d47423
1 changed files with 1 additions and 1 deletions

View File

@ -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;
} }