Added _drawMenuText variants, tidied up Screen5 so far
This commit is contained in:
parent
388aef2c48
commit
0b4fe001fa
|
@ -55,29 +55,31 @@ CScreen5::show(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
|
||||||
|
|
||||||
switch(_rowSel) {
|
switch(_rowSel) {
|
||||||
case 0:
|
case 0:
|
||||||
|
// show settings overview (initial screen entry)
|
||||||
|
// pump max/min
|
||||||
yPos = 28;
|
yPos = 28;
|
||||||
_display.setCursor(0, yPos);
|
_display.setCursor(0, yPos);
|
||||||
_display.print("Pump (Hz)");
|
_display.print("Pump (Hz)");
|
||||||
_display.setCursor(col2, yPos);
|
|
||||||
sprintf(str, "%.1f", getPumpMin());
|
sprintf(str, "%.1f", getPumpMin());
|
||||||
|
_display.setCursor(col2, yPos);
|
||||||
_display.printRightJustified(str);
|
_display.printRightJustified(str);
|
||||||
_display.setCursor(col3, yPos);
|
|
||||||
sprintf(str, "%.1f", getPumpMax());
|
sprintf(str, "%.1f", getPumpMax());
|
||||||
|
_display.setCursor(col3, yPos);
|
||||||
_display.printRightJustified(str);
|
_display.printRightJustified(str);
|
||||||
|
// fan max/min
|
||||||
yPos = 40;
|
yPos = 40;
|
||||||
_display.setCursor(0, yPos);
|
_display.setCursor(0, yPos);
|
||||||
_display.print("Fan (RPM)");
|
_display.print("Fan (RPM)");
|
||||||
_display.setCursor(col2, yPos);
|
|
||||||
sprintf(str, "%d", getFanMin());
|
sprintf(str, "%d", getFanMin());
|
||||||
|
_display.setCursor(col2, yPos);
|
||||||
_display.printRightJustified(str);
|
_display.printRightJustified(str);
|
||||||
_display.setCursor(col3, yPos);
|
|
||||||
sprintf(str, "%d", getFanMax());
|
sprintf(str, "%d", getFanMax());
|
||||||
|
_display.setCursor(col3, yPos);
|
||||||
_display.printRightJustified(str);
|
_display.printRightJustified(str);
|
||||||
|
// navigation line
|
||||||
yPos = 53;
|
yPos = 53;
|
||||||
xPos = _display.xCentre();
|
xPos = _display.xCentre();
|
||||||
_display.setCursor(xPos, yPos);
|
_drawMenuTextCentreJustified(xPos, yPos, true, baseLabel);
|
||||||
_display.printCentreJustified(baseLabel);
|
|
||||||
_drawSelectionBoxCentreJustified(xPos, yPos, baseLabel);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -91,48 +93,31 @@ CScreen5::show(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
_display.clearDisplay();
|
_display.clearDisplay();
|
||||||
//50, 38, 26, 14
|
|
||||||
yPos = border + 36;
|
|
||||||
// Pump Minimum adjustment
|
// Pump Minimum adjustment
|
||||||
|
yPos = border + 36;
|
||||||
_display.setCursor(0, yPos);
|
_display.setCursor(0, yPos);
|
||||||
_display.print("Pump Min");
|
_display.print("Pump Min");
|
||||||
_display.setCursor(col3, yPos);
|
|
||||||
sprintf(str, "%.1f", adjPump[0]);
|
sprintf(str, "%.1f", adjPump[0]);
|
||||||
_display.printRightJustified(str);
|
_drawMenuTextRightJustified(col3, yPos, _rowSel == 2, str);
|
||||||
if(_rowSel == 2) {
|
|
||||||
_drawSelectionBoxRightJustified(col3, yPos, str);
|
|
||||||
}
|
|
||||||
// Pump Maximum adjustment
|
// Pump Maximum adjustment
|
||||||
yPos = border + 24;
|
yPos = border + 24;
|
||||||
_display.setCursor(0, yPos);
|
_display.setCursor(0, yPos);
|
||||||
_display.print("Pump Hz Max");
|
_display.print("Pump Hz Max");
|
||||||
_display.setCursor(col3, yPos);
|
|
||||||
sprintf(str, "%.1f", adjPump[1]);
|
sprintf(str, "%.1f", adjPump[1]);
|
||||||
_display.printRightJustified(str);
|
_drawMenuTextRightJustified(col3, yPos, _rowSel == 3, str);
|
||||||
if(_rowSel == 3) {
|
|
||||||
_drawSelectionBoxRightJustified(col3, yPos, str);
|
|
||||||
}
|
|
||||||
// Fan Minimum adjustment
|
// Fan Minimum adjustment
|
||||||
yPos = border + 12;
|
yPos = border + 12;
|
||||||
_display.setCursor(0, yPos);
|
_display.setCursor(0, yPos);
|
||||||
_display.print("Fan Min");
|
_display.print("Fan Min");
|
||||||
_display.setCursor(col3, yPos);
|
|
||||||
sprintf(str, "%d", adjFan[0]);
|
sprintf(str, "%d", adjFan[0]);
|
||||||
_display.printRightJustified(str);
|
_drawMenuTextRightJustified(col3, yPos, _rowSel == 4, str);
|
||||||
if(_rowSel == 4) {
|
|
||||||
_drawSelectionBoxRightJustified(col3, yPos, str);
|
|
||||||
}
|
|
||||||
// Fan Maximum adjustment
|
// Fan Maximum adjustment
|
||||||
yPos = border;
|
yPos = border;
|
||||||
_display.setCursor(0, yPos);
|
_display.setCursor(0, yPos);
|
||||||
_display.print("Fan RPM Max");
|
_display.print("Fan RPM Max");
|
||||||
_display.setCursor(col3, yPos);
|
|
||||||
sprintf(str, "%d", adjFan[1]);
|
sprintf(str, "%d", adjFan[1]);
|
||||||
_display.printRightJustified(str);
|
_drawMenuTextRightJustified(col3, yPos, _rowSel == 5, str);
|
||||||
if(_rowSel == 5) {
|
// navigation line
|
||||||
_drawSelectionBoxRightJustified(col3, yPos, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
yPos = 53;
|
yPos = 53;
|
||||||
_display.setCursor(_display.xCentre(), yPos);
|
_display.setCursor(_display.xCentre(), yPos);
|
||||||
_display.printCentreJustified(baseLabel);
|
_display.printCentreJustified(baseLabel);
|
||||||
|
|
|
@ -369,3 +369,29 @@ CScreen::_drawSelectionBoxRightJustified(int x, int y, const char* str, int bord
|
||||||
_drawSelectionBox(x, y, str, border, radius);
|
_drawSelectionBox(x, y, str, border, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CScreen::_drawMenuText(int x, int y, bool selected, const char* str, int border, int radius)
|
||||||
|
{
|
||||||
|
_display.setCursor(x, y);
|
||||||
|
_display.print(str);
|
||||||
|
if(selected)
|
||||||
|
_drawSelectionBox(x, y, str, border, radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CScreen::_drawMenuTextCentreJustified(int x, int y, bool selected, const char* str, int border, int radius)
|
||||||
|
{
|
||||||
|
_display.setCursor(x, y);
|
||||||
|
_display.printCentreJustified(str);
|
||||||
|
if(selected)
|
||||||
|
_drawSelectionBoxCentreJustified(x, y, str, border, radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CScreen::_drawMenuTextRightJustified(int x, int y, bool selected, const char* str, int border, int radius)
|
||||||
|
{
|
||||||
|
_display.setCursor(x, y);
|
||||||
|
_display.printRightJustified(str);
|
||||||
|
if(selected)
|
||||||
|
_drawSelectionBoxRightJustified(x, y, str, border, radius);
|
||||||
|
}
|
||||||
|
|
|
@ -59,6 +59,9 @@ protected:
|
||||||
void _drawSelectionBox(int x, int y, const char* str, int border = 3, int radius = 4);
|
void _drawSelectionBox(int x, int y, const char* str, int border = 3, int radius = 4);
|
||||||
void _drawSelectionBoxRightJustified(int x, int y, const char* str, int border = 3, int radius = 4);
|
void _drawSelectionBoxRightJustified(int x, int y, const char* str, int border = 3, int radius = 4);
|
||||||
void _drawSelectionBoxCentreJustified(int x, int y, const char* str, int border = 3, int radius = 4);
|
void _drawSelectionBoxCentreJustified(int x, int y, const char* str, int border = 3, int radius = 4);
|
||||||
|
void _drawMenuText(int x, int y, bool selected, const char* str, int border = 3, int radius = 4);
|
||||||
|
void _drawMenuTextCentreJustified(int x, int y, bool selected, const char* str, int border = 3, int radius = 4);
|
||||||
|
void _drawMenuTextRightJustified(int x, int y, bool selected, const char* str, int border = 3, int radius = 4);
|
||||||
public:
|
public:
|
||||||
CScreen(C128x64_OLED& disp, CScreenManager& mgr);
|
CScreen(C128x64_OLED& disp, CScreenManager& mgr);
|
||||||
virtual ~CScreen();
|
virtual ~CScreen();
|
||||||
|
|
Loading…
Reference in a new issue