2018-11-26 11:58:15 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the "bluetoothheater" distribution
|
|
|
|
* (https://gitlab.com/mrjones.id.au/bluetoothheater)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 Ray Jones <ray@mrjones.id.au>
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
#ifndef __SCREEN_MANAGER_H__
|
|
|
|
#define __SCREEN_MANAGER_H__
|
2018-11-17 02:08:22 +00:00
|
|
|
|
2018-12-07 04:53:08 +00:00
|
|
|
#include <vector>
|
2019-06-02 20:34:45 +00:00
|
|
|
#include "../Utility/UtilClasses.h"
|
2018-11-17 02:08:22 +00:00
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
class C128x64_OLED;
|
|
|
|
class CScreen;
|
2019-01-16 09:22:17 +00:00
|
|
|
class CRebootScreen;
|
2018-11-17 02:08:22 +00:00
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
class CScreenManager {
|
2019-03-15 12:42:54 +00:00
|
|
|
std::vector<std::vector<CScreen*>> _Screens;
|
2019-03-15 10:48:22 +00:00
|
|
|
CRebootScreen* _pRebootScreen;
|
2018-11-25 04:45:17 +00:00
|
|
|
C128x64_OLED* _pDisplay;
|
2020-05-13 00:37:31 +00:00
|
|
|
unsigned long _OTAholdoff;
|
2019-03-15 12:42:54 +00:00
|
|
|
int _menu;
|
|
|
|
int _subMenu;
|
2019-03-15 10:48:22 +00:00
|
|
|
int _rootMenu;
|
2019-10-18 01:55:16 +00:00
|
|
|
int _returnMenu;
|
|
|
|
int _returnSubMenu;
|
2019-04-27 10:41:47 +00:00
|
|
|
bool _bDimmed;
|
2019-09-16 22:30:49 +00:00
|
|
|
bool _bReload;
|
2019-04-27 10:41:47 +00:00
|
|
|
unsigned long _DimTime_ms;
|
|
|
|
unsigned long _MenuTimeout;
|
2018-11-27 10:44:47 +00:00
|
|
|
bool _bReqUpdate;
|
2019-02-28 08:56:13 +00:00
|
|
|
void _enterScreen();
|
|
|
|
void _leaveScreen();
|
2019-03-15 21:43:44 +00:00
|
|
|
void _changeSubMenu(int dir);
|
2019-04-27 10:41:47 +00:00
|
|
|
void _dim(bool state);
|
2019-09-16 22:30:49 +00:00
|
|
|
void _loadScreens();
|
|
|
|
void _unloadScreens();
|
2020-05-13 00:37:31 +00:00
|
|
|
bool _checkOTAholdoff();
|
2019-03-15 10:48:22 +00:00
|
|
|
public:
|
2019-09-15 02:51:51 +00:00
|
|
|
enum eUIMenuSets { RootMenuLoop, TimerMenuLoop, UserSettingsLoop, SystemSettingsLoop, TuningMenuLoop, BranchMenu };
|
2019-08-01 12:57:18 +00:00
|
|
|
enum eUIRootMenus { DetailedControlUI, BasicControlUI, ClockUI, ModeUI, GPIOInfoUI, TrunkUI };
|
2019-03-15 21:43:44 +00:00
|
|
|
enum eUITimerMenus { TimerOverviewUI, Timer1UI, Timer2UI, Timer3UI, Timer4UI, Timer5UI, Timer6UI, Timer7UI,
|
|
|
|
Timer8UI, Timer9UI, Timer10UI, Timer11UI, Timer12UI, Timer13UI, Timer14UI };
|
2019-07-20 06:08:43 +00:00
|
|
|
enum eUITuningMenus { MixtureUI, HeaterSettingsUI, FuelCalUI };
|
2019-11-10 04:44:54 +00:00
|
|
|
enum eUIUserSettingsMenus { ExThermostatUI, FrostUI, HomeMenuUI, TimeIntervalsUI, TempSensorUI, GPIOUI };
|
2019-11-11 07:59:49 +00:00
|
|
|
enum eUIBranchMenus { SetClockUI, InheritSettingsUI, HtrSettingsUI, DS18B20UI };
|
2019-07-27 14:28:39 +00:00
|
|
|
enum eUISystemSettingsMenus { SysVerUI, SysHoursUI, SysWifiUI, SysBTUI };
|
2018-11-25 04:45:17 +00:00
|
|
|
public:
|
|
|
|
CScreenManager();
|
|
|
|
~CScreenManager();
|
2019-09-16 22:30:49 +00:00
|
|
|
void begin();
|
2018-12-01 18:25:10 +00:00
|
|
|
bool checkUpdate();
|
|
|
|
bool animate();
|
2018-11-25 04:45:17 +00:00
|
|
|
void keyHandler(uint8_t event);
|
2019-03-15 21:43:44 +00:00
|
|
|
void refresh();
|
|
|
|
void nextMenu();
|
|
|
|
void prevMenu();
|
2018-11-27 10:44:47 +00:00
|
|
|
void reqUpdate();
|
2019-11-21 08:25:14 +00:00
|
|
|
void selectHomeMenu();
|
2019-03-15 21:43:44 +00:00
|
|
|
void selectMenu(eUIMenuSets menuset, int specific = -1); // use to select loop menus, including the root or branches
|
2019-10-18 01:55:16 +00:00
|
|
|
void returnMenu(); // use to select loop menus, including the root or branches
|
2019-01-16 09:22:17 +00:00
|
|
|
void showRebootMsg(const char* content[2], long delayTime);
|
2020-04-22 06:21:24 +00:00
|
|
|
void showBootMsg(const char* msg);
|
|
|
|
void showBootWait(int show);
|
2019-06-02 20:34:45 +00:00
|
|
|
void showOTAMessage(int percent, eOTAmodes updateType);
|
2019-07-28 10:59:26 +00:00
|
|
|
void clearDisplay();
|
2019-07-20 06:08:43 +00:00
|
|
|
void bumpTimeout();
|
2019-08-03 02:42:49 +00:00
|
|
|
void showSplash();
|
2019-09-16 22:30:49 +00:00
|
|
|
void reqReload() { _bReload = true; };
|
2018-11-25 04:45:17 +00:00
|
|
|
};
|
2018-11-23 10:34:37 +00:00
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
#endif // __SCREEN_MANAGER_H__
|