diff --git a/src/drivers/include/relative_wheel.hpp b/src/drivers/include/relative_wheel.hpp index b5532a4c..88077d08 100644 --- a/src/drivers/include/relative_wheel.hpp +++ b/src/drivers/include/relative_wheel.hpp @@ -25,8 +25,8 @@ class RelativeWheel { auto Update() -> void; auto SetEnabled(bool) -> void; - auto is_clicking() -> bool; - auto ticks() -> std::int_fast16_t; + auto is_clicking() const -> bool; + auto ticks() const -> std::int_fast16_t; // Not copyable or movable. RelativeWheel(const RelativeWheel&) = delete; diff --git a/src/drivers/relative_wheel.cpp b/src/drivers/relative_wheel.cpp index c014ab5e..859f69e3 100644 --- a/src/drivers/relative_wheel.cpp +++ b/src/drivers/relative_wheel.cpp @@ -65,22 +65,18 @@ auto RelativeWheel::SetEnabled(bool en) -> void { is_enabled_ = en; } -auto RelativeWheel::is_clicking() -> bool { +auto RelativeWheel::is_clicking() const -> bool { if (!is_enabled_) { return false; } - bool ret = is_clicking_; - is_clicking_ = 0; - return ret; + return is_clicking_; } -auto RelativeWheel::ticks() -> std::int_fast16_t { +auto RelativeWheel::ticks() const -> std::int_fast16_t { if (!is_enabled_) { return 0; } - int_fast16_t t = ticks_; - ticks_ = 0; - return t; + return ticks_; } } // namespace drivers