state-handler: #6 change constructor args

This commit is contained in:
Vasily Davydov 2022-10-05 11:47:14 +03:00
parent 0c389658fa
commit f95c15e13c

View File

@ -7,46 +7,57 @@
#include <StateHandler.h> #include <StateHandler.h>
StateHandler::StateHandler(LiquidCrystal * lcd) { StateHandler::StateHandler (LiquidCrystal *lcd)
this->_lcd = lcd; {
// TODO this->_lcd = lcd;
// TODO
} }
StateHandler::~StateHandler() { StateHandler::~StateHandler ()
// TODO Auto-generated destructor stub {
// TODO Auto-generated destructor stub
} }
unsigned int StateHandler::getSetPressure(){ unsigned int
return (unsigned int)this->set[PRESSURE].getCurrent(); StateHandler::getSetPressure ()
{
return (unsigned int)this->set[PRESSURE].getCurrent ();
} }
unsigned int StateHandler::getSetSpeed(){ unsigned int
return (unsigned int)this->set[FAN_SPEED].getCurrent(); StateHandler::getSetSpeed ()
{
return (unsigned int)this->set[FAN_SPEED].getCurrent ();
} }
void StateHandler::displaySet(unsigned int value1, unsigned int value2){ void
// TODO StateHandler::displaySet (unsigned int value1, unsigned int value2)
/** {
* MANUAL MODE: // TODO
* ---------------- /**
* SPEED: 20% * MANUAL MODE:
* PRESSURE: XXPa * ----------------
* ---------------- * SPEED: 20%
* AUTO MODE: * PRESSURE: XXPa
* ---------------- * ----------------
* PRESSURE SET: 35Pa * AUTO MODE:
* PRESSURE CUR: XXPa * ----------------
* ---------------- * PRESSURE SET: 35Pa
*/ * PRESSURE CUR: XXPa
* ----------------
*/
} }
void StateHandler::HandleState(const Event &event){ void
(this->*current)(event); StateHandler::HandleState (const Event &event)
{
(this->*current) (event);
} }
void StateHandler::SetState(state_pointer newstate){ void
(this->*current)(Event(Event::eExit)); StateHandler::SetState (state_pointer newstate)
current = newstate; {
(this->*current)(Event(Event::eEnter)); (this->*current) (Event (Event::eExit));
current = newstate;
(this->*current) (Event (Event::eEnter));
} }