switch-controller: modify sw behaviour

This commit is contained in:
Vasily Davydov 2022-10-24 17:04:32 +03:00
parent 59486a746a
commit 94518925f8

View File

@ -24,17 +24,15 @@ SwitchController::~SwitchController ()
void void
SwitchController::listen () SwitchController::listen ()
{ {
/** Button is pressed for the first time*/ /** Button is pressed for the first time */
if (b->read () && !b_pressed) if (b->read () && !b_pressed)
{ {
h->HandleState (Event (Event::eKey, b_mode));
b_pressed = true; b_pressed = true;
} }
/** Button is released before 2 seconds*/ /** Button is released */
if (!b->read () && b_pressed) if (!b->read () && b_pressed)
{ {
h->HandleState (Event (Event::eKey, b_mode));
b_pressed = false; b_pressed = false;
} }
} }