2019-07-27 23:07:29 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the "bluetoothheater" distribution
|
|
|
|
* (https://gitlab.com/mrjones.id.au/bluetoothheater)
|
|
|
|
*
|
2019-09-08 00:14:36 +00:00
|
|
|
* Copyright (C) 2019 Ray Jones <ray@mrjones.id.au>
|
2019-07-27 23:07:29 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "MenuTrunkScreen.h"
|
|
|
|
#include "KeyPad.h"
|
|
|
|
#include "../Utility/helpers.h"
|
|
|
|
#include "../Utility/macros.h"
|
|
|
|
#include "fonts/Arial.h"
|
2019-09-07 13:48:46 +00:00
|
|
|
#include "../Utility/NVStorage.h"
|
2019-07-27 23:07:29 +00:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// CMenuTrunkScreen
|
|
|
|
//
|
|
|
|
// This screen presents Bluetooth status information
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
static const int LIMIT_AWAY = 0;
|
|
|
|
static const int LIMIT_LEFT = 1;
|
|
|
|
static const int LIMIT_RIGHT = 2;
|
|
|
|
|
2019-11-21 08:25:14 +00:00
|
|
|
CMenuTrunkScreen::CMenuTrunkScreen(C128x64_OLED& display, CScreenManager& mgr) : CUIEditScreen(display, mgr)
|
2019-07-27 23:07:29 +00:00
|
|
|
{
|
|
|
|
_initUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
CMenuTrunkScreen::show()
|
|
|
|
{
|
|
|
|
_display.clearDisplay();
|
|
|
|
|
|
|
|
CScreen::show();
|
|
|
|
|
|
|
|
int yPos[] = { 53, 41, 29, 17 };
|
|
|
|
|
|
|
|
_showTitle("Menu Trunk");
|
|
|
|
|
|
|
|
_printMenuText(_display.xCentre(), yPos[_rowSel], " \021 \020 ", true, eCentreJustify);
|
|
|
|
|
2019-09-15 02:51:51 +00:00
|
|
|
if(NVstore.getUserSettings().menuMode == 0) {
|
2019-09-07 13:48:46 +00:00
|
|
|
_printMenuText(_display.xCentre(), yPos[3], "Heater Tuning", false, eCentreJustify);
|
|
|
|
}
|
2019-09-15 02:51:51 +00:00
|
|
|
if(NVstore.getUserSettings().menuMode != 1) {
|
|
|
|
_printMenuText(_display.xCentre(), yPos[2], "System Settings", false, eCentreJustify);
|
|
|
|
}
|
2019-07-27 23:07:29 +00:00
|
|
|
_printMenuText(_display.xCentre(), yPos[1], "User Settings", false, eCentreJustify);
|
|
|
|
_printMenuText(_display.xCentre(), yPos[0], "Root menu", false, eCentreJustify);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
CMenuTrunkScreen::keyHandler(uint8_t event)
|
|
|
|
{
|
|
|
|
if(event & keyPressed) {
|
|
|
|
// press CENTRE
|
|
|
|
if(event & key_Centre) {
|
2019-11-21 08:25:14 +00:00
|
|
|
if(_rowSel == 0) {
|
|
|
|
_ScreenManager.clearDisplay();
|
|
|
|
_ScreenManager.selectHomeMenu();
|
|
|
|
}
|
2019-07-27 23:07:29 +00:00
|
|
|
_rowSel = 0;
|
|
|
|
}
|
|
|
|
// press LEFT
|
|
|
|
if(event & key_Left) {
|
|
|
|
switch(_rowSel) {
|
|
|
|
case 0:
|
|
|
|
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop);
|
|
|
|
_ScreenManager.prevMenu();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
_ScreenManager.selectMenu(CScreenManager::UserSettingsLoop);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
_ScreenManager.selectMenu(CScreenManager::SystemSettingsLoop);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
_ScreenManager.selectMenu(CScreenManager::BranchMenu, CScreenManager::HtrSettingsUI);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// press RIGHT
|
|
|
|
if(event & key_Right) {
|
|
|
|
switch(_rowSel) {
|
|
|
|
case 0:
|
|
|
|
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop);
|
|
|
|
_ScreenManager.nextMenu();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
_ScreenManager.selectMenu(CScreenManager::UserSettingsLoop);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
_ScreenManager.selectMenu(CScreenManager::SystemSettingsLoop);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
_ScreenManager.selectMenu(CScreenManager::BranchMenu, CScreenManager::HtrSettingsUI);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// press UP
|
|
|
|
if(event & key_Up) {
|
|
|
|
_rowSel++;
|
2019-09-15 02:51:51 +00:00
|
|
|
int lim = 3;
|
|
|
|
switch(NVstore.getUserSettings().menuMode) {
|
|
|
|
case 1: lim = 1; break;
|
|
|
|
case 2: lim = 2; break;
|
|
|
|
}
|
2019-09-07 13:48:46 +00:00
|
|
|
UPPERLIMIT(_rowSel, lim);
|
2019-07-27 23:07:29 +00:00
|
|
|
}
|
|
|
|
// press DOWN
|
|
|
|
if(event & key_Down) {
|
|
|
|
_rowSel--;
|
|
|
|
LOWERLIMIT(_rowSel, 0);
|
|
|
|
}
|
|
|
|
_ScreenManager.reqUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|