From 3d0fa410a83288e55cc36e083178c6f7d13c6f69 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Sun, 17 Jul 2016 17:18:27 +0100 Subject: [PATCH] hysteresis: astyle --- src/modules/systemlib/hysteresis/hysteresis.cpp | 9 ++++++--- src/modules/systemlib/hysteresis/hysteresis.h | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/modules/systemlib/hysteresis/hysteresis.cpp b/src/modules/systemlib/hysteresis/hysteresis.cpp index 0b4e86ed9e..33aee834c1 100644 --- a/src/modules/systemlib/hysteresis/hysteresis.cpp +++ b/src/modules/systemlib/hysteresis/hysteresis.cpp @@ -41,7 +41,8 @@ #include "systemlib/hysteresis/hysteresis.h" -namespace systemlib { +namespace systemlib +{ void @@ -52,9 +53,11 @@ Hysteresis::set_state_and_update(const bool new_state) _requested_state = new_state; _last_time_to_change_state = hrt_absolute_time(); } + } else { _requested_state = _state; } + update(); } @@ -64,8 +67,8 @@ Hysteresis::update() if (_requested_state != _state) { if (hrt_elapsed_time(&_last_time_to_change_state) >= (_state ? - _hysteresis_time_from_true_us : - _hysteresis_time_from_false_us)) { + _hysteresis_time_from_true_us : + _hysteresis_time_from_false_us)) { _state = _requested_state; } } diff --git a/src/modules/systemlib/hysteresis/hysteresis.h b/src/modules/systemlib/hysteresis/hysteresis.h index 05b4102639..97cd6c049e 100644 --- a/src/modules/systemlib/hysteresis/hysteresis.h +++ b/src/modules/systemlib/hysteresis/hysteresis.h @@ -43,7 +43,8 @@ #include -namespace systemlib { +namespace systemlib +{ class Hysteresis { @@ -59,15 +60,18 @@ public: ~Hysteresis() {} - void set_hysteresis_time_from(const bool from_state, const hrt_abstime new_hysteresis_time_us) { + void set_hysteresis_time_from(const bool from_state, const hrt_abstime new_hysteresis_time_us) + { if (from_state == true) { _hysteresis_time_from_true_us = new_hysteresis_time_us; + } else { _hysteresis_time_from_false_us = new_hysteresis_time_us; } } - bool get_state() const { + bool get_state() const + { return _state; }