StateHandler: redundant code removal

This commit is contained in:
Evgenii Meshcheriakov 2022-10-21 20:16:53 +03:00
parent 95ae3cd4a8
commit 0be8c9a3f0

View File

@ -114,6 +114,7 @@ StateHandler::stateManual (const Event &event)
break; break;
case Event::eKey: case Event::eKey:
handleControlButtons (event.value); handleControlButtons (event.value);
this->A01->write(value[MANUAL].getCurrent() * 10);
break; break;
case Event::eTick: case Event::eTick:
save (event.value, MANUAL); save (event.value, MANUAL);
@ -194,13 +195,9 @@ StateHandler::handleControlButtons (uint8_t button)
{ {
case BUTTON_CONTROL_DOWN: case BUTTON_CONTROL_DOWN:
this->value[(current_mode) ? AUTO : MANUAL].dec (); this->value[(current_mode) ? AUTO : MANUAL].dec ();
if(current_mode == MANUAL)
this->A01->write(value[(current_mode) ? AUTO : MANUAL].getCurrent() * 10);
break; break;
case BUTTON_CONTROL_UP: case BUTTON_CONTROL_UP:
this->value[(current_mode) ? AUTO : MANUAL].inc (); this->value[(current_mode) ? AUTO : MANUAL].inc ();
if(current_mode == MANUAL)
this->A01->write(value[(current_mode) ? AUTO : MANUAL].getCurrent() * 10);
break; break;
case BUTTON_CONTROL_TOG_MODE: case BUTTON_CONTROL_TOG_MODE:
current_mode = !current_mode; current_mode = !current_mode;