Skip to content
Snippets Groups Projects
Commit 3d0fa410 authored by Julian Oes's avatar Julian Oes
Browse files

hysteresis: astyle

parent fd6ad656
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
......
......@@ -43,7 +43,8 @@
#include <drivers/drv_hrt.h>
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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment