state-handler: add printout in displaySet

Create printouts on lcd for both manual and auto modes.
This commit is contained in:
Vasily Davydov 2022-10-10 15:06:47 +03:00
parent 2dd4d78bc2
commit 0a0f55a079
2 changed files with 36 additions and 14 deletions

View File

@ -96,7 +96,7 @@ private:
* @param newstate new state to be set to current * @param newstate new state to be set to current
*/ */
void SetState (state_pointer newstate); void SetState (state_pointer newstate);
bool current_mode; uint8_t current_mode;
Counter value[2] = { { 0, 100 }, { 0, 120 } }; Counter value[2] = { { 0, 100 }, { 0, 120 } };
LiquidCrystal *_lcd; LiquidCrystal *_lcd;

View File

@ -21,19 +21,41 @@ StateHandler::~StateHandler ()
void void
StateHandler::displaySet (unsigned int value1, unsigned int value2) StateHandler::displaySet (unsigned int value1, unsigned int value2)
{ {
// TODO char line_up[16] = { 0 };
/** char line_down[16] = { 0 };
* MANUAL MODE:
* ---------------- switch (current_mode)
* SPEED: 20% {
* PRESSURE: XXPa /*
* ---------------- * MANUAL MODE:
* AUTO MODE: * ----------------
* ---------------- * SPEED: 20%
* PRESSURE SET: 35Pa * PRESSURE: XXPa
* PRESSURE CUR: XXPa * ----------------
* ---------------- */
*/ case MANUAL:
snprintf (line_up, 16, "SPEED: %02d%", value1);
snprintf (line_down, 16, "PRESSURE: %02dPa", value2);
break;
/*
* AUTO MODE:
* ----------------
* PRESSURE SET: 35Pa
* PRESSURE CUR: XXPa
* ----------------
*/
case AUTO:
snprintf (line_up, 16, "P. SET: %02dPa", value1);
snprintf (line_down, 16, "P. CURR: %02dPa", value2);
break;
default:
break;
}
_lcd->clear ();
_lcd->setCursor (0, 0);
_lcd->print (line_up);
_lcd->setCursor (0, 1);
_lcd->print (line_down);
} }
unsigned int unsigned int