made activation state more clear

This commit is contained in:
Jonas Zeunert
2018-12-07 11:44:07 +01:00
parent 0f0f404e19
commit 8fd5588d02
4 changed files with 5 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ namespace flippR_driver
namespace input namespace input
{ {
Detector::Detector(std::unique_ptr<IInputGPIOInterface> input_gpio_interface, std::vector<std::shared_ptr<DistributingEvent>>& events) : Detector::Detector(std::unique_ptr<IInputGPIOInterface> input_gpio_interface, std::vector<std::shared_ptr<DistributingEvent>> events) :
input_gpio_interface(std::move(input_gpio_interface)), events(std::move(events)), is_running(true) input_gpio_interface(std::move(input_gpio_interface)), events(std::move(events)), is_running(true)
{ {
this->detect_thread = std::thread(&Detector::detect, this); this->detect_thread = std::thread(&Detector::detect, this);

View File

@@ -34,8 +34,8 @@ class Detector : public IDetector
{ {
public: public:
Detector(std::unique_ptr<IInputGPIOInterface> input_gpio_interface, std::vector<std::shared_ptr<DistributingEvent>>& events); Detector(std::unique_ptr<IInputGPIOInterface> input_gpio_interface, std::vector<std::shared_ptr<DistributingEvent>> events);
~Detector(); ~Detector() override;
private: private:
void detect(); void detect();

View File

@@ -23,7 +23,7 @@ void flippR_driver::input::DistributingEvent::active()
{ {
if(activation_state != ACTIVATED) if(activation_state != ACTIVATED)
{ {
activation_state = static_cast<ActivationState>(static_cast<int>(activation_state) + 1); activation_state = activation_state == NOT_ACTIVATED ? FIRST_ACTIVATED : ACTIVATED;
} }
last_activation = std::chrono::high_resolution_clock::now(); last_activation = std::chrono::high_resolution_clock::now();

View File

@@ -25,7 +25,7 @@ class DisplayController : public IDisplayController
{ {
public: public:
explicit DisplayController(std::vector<std::shared_ptr<items::IDisplay>> displays, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface); explicit DisplayController(std::vector<std::shared_ptr<items::IDisplay>> displays, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface);
~DisplayController(); ~DisplayController() override;
private: private:
void cycle_displays(); void cycle_displays();