2018-12-07 04:18:24 +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/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2019-01-18 07:09:40 +00:00
|
|
|
// CSetTimerScreen
|
2018-12-07 04:18:24 +00:00
|
|
|
//
|
2018-12-15 09:34:58 +00:00
|
|
|
// This screen allows the timers to be adjusted
|
2018-12-07 04:18:24 +00:00
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2019-01-18 07:09:40 +00:00
|
|
|
#include "SetTimerScreen.h"
|
2018-12-16 07:34:39 +00:00
|
|
|
#include "KeyPad.h"
|
2019-06-15 23:09:29 +00:00
|
|
|
#include "../Utility/helpers.h"
|
2019-07-25 07:40:23 +00:00
|
|
|
#include "../../lib/RTClib/RTClib.h"
|
2019-02-14 10:20:15 +00:00
|
|
|
#include "../RTC/TimerManager.h"
|
2019-07-27 23:07:29 +00:00
|
|
|
#include "fonts/Arial.h"
|
2018-12-07 04:18:24 +00:00
|
|
|
|
2018-12-08 01:39:41 +00:00
|
|
|
const char* briefDOW[] = { "S", "M", "T", "W", "T", "F", "S" };
|
|
|
|
|
2019-11-21 08:25:14 +00:00
|
|
|
CSetTimerScreen::CSetTimerScreen(C128x64_OLED& display, CScreenManager& mgr, int instance) : CUIEditScreen(display, mgr)
|
2018-12-07 04:18:24 +00:00
|
|
|
{
|
2019-02-28 08:56:13 +00:00
|
|
|
_initUI();
|
2019-02-14 10:20:15 +00:00
|
|
|
_ConflictTime = 0;
|
|
|
|
_conflictID = 0;
|
|
|
|
_timerID = instance;
|
2018-12-07 04:18:24 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 04:18:37 +00:00
|
|
|
void
|
2019-01-18 07:09:40 +00:00
|
|
|
CSetTimerScreen::onSelect()
|
2018-12-08 04:18:37 +00:00
|
|
|
{
|
2019-11-21 08:25:14 +00:00
|
|
|
CUIEditScreen::onSelect();
|
2019-02-28 08:56:13 +00:00
|
|
|
_initUI();
|
2019-02-14 10:20:15 +00:00
|
|
|
NVstore.getTimerInfo(_timerID, _timerInfo);
|
2018-12-08 04:18:37 +00:00
|
|
|
}
|
2018-12-07 04:18:24 +00:00
|
|
|
|
2019-01-18 23:06:12 +00:00
|
|
|
bool
|
2019-01-18 07:09:40 +00:00
|
|
|
CSetTimerScreen::show()
|
2018-12-07 04:18:24 +00:00
|
|
|
{
|
2019-11-21 08:25:14 +00:00
|
|
|
if(CUIEditScreen::show()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-07-27 23:07:29 +00:00
|
|
|
CScreen::show();
|
|
|
|
|
|
|
|
_display.clearDisplay();
|
2018-12-07 04:18:24 +00:00
|
|
|
|
2019-02-14 10:20:15 +00:00
|
|
|
char str[20];
|
2018-12-07 04:18:24 +00:00
|
|
|
int xPos, yPos;
|
|
|
|
|
2018-12-15 09:34:58 +00:00
|
|
|
if(_rowSel == 0) {
|
2019-07-28 07:40:12 +00:00
|
|
|
NVstore.getTimerInfo(_timerID, _timerInfo); // ensure actual data when on base menu bar
|
2018-12-15 09:34:58 +00:00
|
|
|
}
|
2019-07-27 23:07:29 +00:00
|
|
|
sprintf(str, "Set Timer #%d", _timerID + 1);
|
|
|
|
_showTitle(str);
|
2018-12-07 04:18:24 +00:00
|
|
|
|
2019-11-21 08:25:14 +00:00
|
|
|
if(_ConflictTime) {
|
2019-02-14 10:20:15 +00:00
|
|
|
long tDelta = millis() - _ConflictTime;
|
|
|
|
if(tDelta > 0)
|
|
|
|
_ConflictTime = 0;
|
|
|
|
sprintf(str, " with Timer %d ", _conflictID);
|
2019-07-27 23:07:29 +00:00
|
|
|
_showConflict(str);
|
2019-02-14 10:20:15 +00:00
|
|
|
}
|
2019-01-18 20:15:02 +00:00
|
|
|
else {
|
2019-03-17 07:10:01 +00:00
|
|
|
// start
|
|
|
|
xPos = 18;
|
2020-03-29 02:59:13 +00:00
|
|
|
yPos = 16;
|
2019-03-17 07:10:01 +00:00
|
|
|
_printMenuText(xPos, yPos, "On", false, eRightJustify);
|
2019-07-28 01:37:39 +00:00
|
|
|
_printMenuText(xPos+17, yPos, ":");
|
2019-03-17 07:10:01 +00:00
|
|
|
xPos += 6;
|
|
|
|
sprintf(str, "%02d", _timerInfo.start.hour);
|
|
|
|
_printMenuText(xPos, yPos, str, _rowSel==1 && _colSel==0);
|
|
|
|
xPos += 17;
|
|
|
|
sprintf(str, "%02d", _timerInfo.start.min);
|
|
|
|
_printMenuText(xPos, yPos, str, _rowSel==1 && _colSel==1);
|
2018-12-07 04:18:24 +00:00
|
|
|
|
2019-03-17 07:10:01 +00:00
|
|
|
// stop
|
2019-07-28 01:37:39 +00:00
|
|
|
xPos = 82;
|
2020-03-29 02:59:13 +00:00
|
|
|
yPos = 16;
|
2019-03-17 07:10:01 +00:00
|
|
|
_printMenuText(xPos, yPos, "Off", false, eRightJustify);
|
2019-07-28 01:37:39 +00:00
|
|
|
_printMenuText(xPos+17, yPos, ":");
|
2019-03-17 07:10:01 +00:00
|
|
|
xPos += 6;
|
|
|
|
sprintf(str, "%02d", _timerInfo.stop.hour);
|
|
|
|
_printMenuText(xPos, yPos, str, _rowSel==1 && _colSel==2);
|
|
|
|
xPos += 17;
|
|
|
|
sprintf(str, "%02d", _timerInfo.stop.min);
|
|
|
|
_printMenuText(xPos, yPos, str, _rowSel==1 && _colSel==3);
|
|
|
|
|
|
|
|
// control
|
|
|
|
const char* msg;
|
|
|
|
_printEnabledTimers();
|
|
|
|
|
2019-07-28 01:37:39 +00:00
|
|
|
xPos = _display.width() - border;
|
2020-03-29 02:59:13 +00:00
|
|
|
yPos = 28;
|
2019-03-17 07:10:01 +00:00
|
|
|
if(_timerInfo.repeat)
|
|
|
|
msg = "Repeat";
|
|
|
|
else
|
|
|
|
msg = "Once";
|
2019-07-28 01:37:39 +00:00
|
|
|
_printMenuText(xPos, yPos, msg, _rowSel==1 && _colSel==5, eRightJustify);
|
2019-07-27 23:07:29 +00:00
|
|
|
|
2020-03-29 02:59:13 +00:00
|
|
|
xPos = 18;
|
|
|
|
yPos = 40;
|
|
|
|
float fTemp = _timerInfo.temperature;
|
|
|
|
if(NVstore.getUserSettings().degF) {
|
|
|
|
fTemp = fTemp * 9 / 5 + 32;
|
|
|
|
sprintf(str, "%.0f`F", fTemp);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(str, "%.0f`C", fTemp);
|
|
|
|
}
|
|
|
|
_printMenuText(_display.xCentre(), yPos, str, _rowSel==1 && _colSel==6, eCentreJustify);
|
|
|
|
|
|
|
|
|
2019-07-27 23:07:29 +00:00
|
|
|
// navigation line
|
|
|
|
yPos = 53;
|
|
|
|
xPos = _display.xCentre();
|
|
|
|
if(_rowSel == 2) {
|
|
|
|
_display.drawFastHLine(0, 53, 128, WHITE);
|
|
|
|
_printMenuText(_display.xCentre(), 57, "\033\032 Sel \030\031 Adj", false, eCentreJustify);
|
|
|
|
_printMenuText(_display.xCentre(), 57, "Done", false, eCentreJustify);
|
|
|
|
}
|
|
|
|
else if(_rowSel == 1) {
|
|
|
|
_display.drawFastHLine(0, 53, 128, WHITE);
|
|
|
|
_printMenuText(_display.xCentre(), 57, "\033\032 Sel \030\031 Adj", false, eCentreJustify);
|
|
|
|
_printMenuText(_display.xCentre(), 57, "Save", false, eCentreJustify);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
_printMenuText(xPos, yPos, " \021 Exit \020 ", _rowSel==0, eCentreJustify);
|
|
|
|
}
|
2019-03-17 07:10:01 +00:00
|
|
|
}
|
2019-01-18 23:06:12 +00:00
|
|
|
|
|
|
|
return true;
|
2018-12-07 04:18:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-18 23:06:12 +00:00
|
|
|
bool
|
2019-01-18 07:09:40 +00:00
|
|
|
CSetTimerScreen::keyHandler(uint8_t event)
|
2018-12-07 04:18:24 +00:00
|
|
|
{
|
2018-12-08 01:39:41 +00:00
|
|
|
static bool bHeld = false;
|
2018-12-07 04:18:24 +00:00
|
|
|
// handle initial key press
|
|
|
|
if(event & keyPressed) {
|
2019-07-28 07:40:12 +00:00
|
|
|
_repeatCount = 0;
|
2018-12-08 01:39:41 +00:00
|
|
|
bHeld = false;
|
2018-12-07 04:18:24 +00:00
|
|
|
// press CENTRE
|
|
|
|
if(event & key_Centre) {
|
2019-07-28 07:40:12 +00:00
|
|
|
// ON KEY RELEASE
|
2018-12-07 04:18:24 +00:00
|
|
|
}
|
|
|
|
// press LEFT - navigate fields, or screens
|
|
|
|
if(event & key_Left) {
|
|
|
|
switch(_rowSel) {
|
|
|
|
case 0:
|
2019-03-15 21:43:44 +00:00
|
|
|
_ScreenManager.prevMenu();
|
2018-12-07 04:18:24 +00:00
|
|
|
break;
|
2019-03-15 23:54:50 +00:00
|
|
|
case 1:
|
2019-03-17 07:10:01 +00:00
|
|
|
// select previous field
|
2019-03-15 23:54:50 +00:00
|
|
|
_colSel--;
|
2020-03-29 02:59:13 +00:00
|
|
|
WRAPLOWERLIMIT(_colSel, 0, 6);
|
2019-03-15 23:54:50 +00:00
|
|
|
break;
|
2018-12-08 01:39:41 +00:00
|
|
|
case 2:
|
2019-03-17 07:10:01 +00:00
|
|
|
// select previous day
|
2018-12-08 01:39:41 +00:00
|
|
|
_colSel--;
|
2019-06-02 12:47:35 +00:00
|
|
|
WRAPLOWERLIMIT(_colSel, 0, 6);
|
2018-12-08 01:39:41 +00:00
|
|
|
break;
|
2018-12-07 04:18:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// press RIGHT - navigate fields, or screens
|
|
|
|
if(event & key_Right) {
|
|
|
|
switch(_rowSel) {
|
|
|
|
case 0:
|
2019-03-15 21:43:44 +00:00
|
|
|
_ScreenManager.nextMenu();
|
2018-12-07 04:18:24 +00:00
|
|
|
break;
|
2019-03-15 23:54:50 +00:00
|
|
|
case 1:
|
2019-03-17 07:10:01 +00:00
|
|
|
// select next field
|
2019-03-15 23:54:50 +00:00
|
|
|
_colSel++;
|
2020-03-29 02:59:13 +00:00
|
|
|
WRAPUPPERLIMIT(_colSel, 6, 0);
|
2019-03-15 23:54:50 +00:00
|
|
|
break;
|
2018-12-08 01:39:41 +00:00
|
|
|
case 2:
|
2019-03-17 07:10:01 +00:00
|
|
|
// select next day
|
2018-12-08 01:39:41 +00:00
|
|
|
_colSel++;
|
2019-06-02 12:47:35 +00:00
|
|
|
WRAPUPPERLIMIT(_colSel, 6, 0);
|
2018-12-07 04:18:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// handle held down keys
|
|
|
|
if(event & keyRepeat) {
|
2019-07-28 07:40:12 +00:00
|
|
|
_repeatCount++;
|
2018-12-08 01:39:41 +00:00
|
|
|
bHeld = true;
|
2018-12-07 04:18:24 +00:00
|
|
|
if(_rowSel == 1) {
|
2019-07-28 07:40:12 +00:00
|
|
|
if(event & key_Centre) {
|
|
|
|
_ScreenManager.reqUpdate();
|
|
|
|
_rowSel = 0;
|
|
|
|
_colSel = 0;
|
|
|
|
}
|
2018-12-08 01:39:41 +00:00
|
|
|
if(_colSel < 4) {
|
2019-03-17 07:10:01 +00:00
|
|
|
// fast repeat of hour/minute adjustments by holding up or down keys
|
2019-03-15 23:54:50 +00:00
|
|
|
if(event & key_Down) _adjust(-1);
|
|
|
|
if(event & key_Up) _adjust(+1);
|
2018-12-08 01:39:41 +00:00
|
|
|
}
|
|
|
|
else if(_colSel == 4) {
|
2019-03-17 07:10:01 +00:00
|
|
|
if(event & (key_Up | key_Down)) {
|
|
|
|
// enable per day programming by holding up or down
|
2019-02-14 10:20:15 +00:00
|
|
|
_timerInfo.enabled &= 0x7f; // strip next day flag
|
2018-12-08 01:39:41 +00:00
|
|
|
_rowSel = 2;
|
|
|
|
_colSel = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(event & keyReleased) {
|
2019-07-28 07:40:12 +00:00
|
|
|
|
2018-12-08 01:39:41 +00:00
|
|
|
if(!bHeld) {
|
2019-07-28 07:40:12 +00:00
|
|
|
if(event & key_Centre) {
|
|
|
|
if(_rowSel == 0) {
|
|
|
|
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop); // exit: return to clock screen
|
|
|
|
}
|
|
|
|
else if(_rowSel == 2) { // exit from per day settings
|
|
|
|
_rowSel = 1;
|
|
|
|
_colSel = 4;
|
|
|
|
}
|
|
|
|
else { // in config fields, save new settings
|
|
|
|
// test if the setting conflict with an already defined timer
|
|
|
|
_conflictID = CTimerManager::conflictTest(_timerInfo);
|
|
|
|
if(_conflictID) {
|
|
|
|
_timerInfo.enabled = 0; // cancel enabled status
|
|
|
|
_ConflictTime = millis() + 1500;
|
|
|
|
_ScreenManager.reqUpdate();
|
|
|
|
_rowSel = 1;
|
|
|
|
_colSel = 4; // select enable/disable
|
|
|
|
}
|
|
|
|
else {
|
2019-11-21 08:25:14 +00:00
|
|
|
_enableStoringMessage();
|
2019-07-28 07:40:12 +00:00
|
|
|
_rowSel = 0;
|
|
|
|
_colSel = 0;
|
|
|
|
}
|
|
|
|
CTimerManager::setTimer(_timerInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-08 01:39:41 +00:00
|
|
|
int maskDOW = 0x01 << _colSel;
|
2019-01-18 20:15:02 +00:00
|
|
|
// released DOWN - can only leave adjustment by using OK (centre button)
|
|
|
|
if(event & key_Down) {
|
|
|
|
// adjust selected item
|
|
|
|
switch(_rowSel) {
|
2019-03-15 23:54:50 +00:00
|
|
|
case 1:
|
2019-03-17 07:10:01 +00:00
|
|
|
if(!(_colSel == 4 && (_timerInfo.enabled & 0x7F) != 0)) {
|
|
|
|
_adjust(-1);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// bump into per day setup
|
|
|
|
_rowSel = 2;
|
|
|
|
_colSel = 0;
|
|
|
|
}
|
2019-03-15 23:54:50 +00:00
|
|
|
break;
|
2019-01-18 07:09:40 +00:00
|
|
|
case 2:
|
|
|
|
// adjust selected item
|
2019-02-14 10:20:15 +00:00
|
|
|
_timerInfo.enabled ^= maskDOW;
|
|
|
|
_timerInfo.enabled &= 0x7f;
|
2019-01-18 07:09:40 +00:00
|
|
|
break;
|
2018-12-08 01:39:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// released UP
|
|
|
|
if(event & key_Up) {
|
|
|
|
switch(_rowSel) {
|
2019-03-15 23:54:50 +00:00
|
|
|
case 0:
|
2018-12-08 01:39:41 +00:00
|
|
|
_rowSel = 1;
|
2019-03-15 23:54:50 +00:00
|
|
|
_colSel = 0;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
// prevent accidentally losing per day settings
|
|
|
|
if(!(_colSel == 4 && (_timerInfo.enabled & 0x7F) != 0)) {
|
|
|
|
_adjust(+1); // adjust selected item, unless in per day mode
|
|
|
|
}
|
2019-03-17 07:10:01 +00:00
|
|
|
else {
|
|
|
|
// bump into per day setup
|
|
|
|
_rowSel = 2;
|
|
|
|
_colSel = 0;
|
|
|
|
}
|
2019-03-15 23:54:50 +00:00
|
|
|
break;
|
2018-12-08 01:39:41 +00:00
|
|
|
case 2:
|
|
|
|
// adjust selected item
|
2019-02-14 10:20:15 +00:00
|
|
|
_timerInfo.enabled ^= maskDOW;
|
|
|
|
_timerInfo.enabled &= 0x7f;
|
2018-12-08 01:39:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-12-07 04:18:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_ScreenManager.reqUpdate();
|
2019-01-18 23:06:12 +00:00
|
|
|
return true;
|
2018-12-07 04:18:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2019-02-28 08:56:13 +00:00
|
|
|
CSetTimerScreen::_adjust(int dir)
|
2018-12-07 04:18:24 +00:00
|
|
|
{
|
2018-12-07 22:30:55 +00:00
|
|
|
int maskDOW = 0x01 << _colSel; // if doing Day of Week - (_rowSel == 2)
|
|
|
|
|
2018-12-07 04:18:24 +00:00
|
|
|
switch(_colSel) {
|
|
|
|
case 0:
|
2019-02-14 10:20:15 +00:00
|
|
|
_timerInfo.start.hour += dir;
|
2019-06-02 12:47:35 +00:00
|
|
|
WRAPLIMITS(_timerInfo.start.hour, 0, 23);
|
2018-12-07 04:18:24 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2019-02-14 10:20:15 +00:00
|
|
|
_timerInfo.start.min += dir;
|
2019-06-02 12:47:35 +00:00
|
|
|
WRAPLIMITS(_timerInfo.start.min, 0, 59);
|
2018-12-07 04:18:24 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2019-02-14 10:20:15 +00:00
|
|
|
_timerInfo.stop.hour += dir;
|
2019-06-02 12:47:35 +00:00
|
|
|
WRAPLIMITS(_timerInfo.stop.hour, 0, 23);
|
2018-12-07 04:18:24 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2019-02-14 10:20:15 +00:00
|
|
|
_timerInfo.stop.min += dir;
|
2019-06-02 12:47:35 +00:00
|
|
|
WRAPLIMITS(_timerInfo.stop.min, 0, 59);
|
2018-12-07 04:18:24 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2018-12-07 22:30:55 +00:00
|
|
|
if(_rowSel == 1) {
|
2019-02-14 10:20:15 +00:00
|
|
|
_timerInfo.enabled &= 0x80; // ensure specific day flags are cleared
|
|
|
|
_timerInfo.enabled ^= 0x80; // toggle next day flag
|
2018-12-07 22:30:55 +00:00
|
|
|
}
|
|
|
|
if(_rowSel == 2) {
|
2019-02-14 10:20:15 +00:00
|
|
|
_timerInfo.enabled &= 0x7f; // ensure next day flag is cleared
|
|
|
|
_timerInfo.enabled ^= maskDOW; // toggle flag for day of week
|
2018-12-07 22:30:55 +00:00
|
|
|
}
|
2018-12-07 04:18:24 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2019-02-14 10:20:15 +00:00
|
|
|
_timerInfo.repeat = !_timerInfo.repeat;
|
2018-12-07 04:18:24 +00:00
|
|
|
break;
|
2020-03-29 02:59:13 +00:00
|
|
|
case 6:
|
|
|
|
_timerInfo.temperature += dir;
|
|
|
|
BOUNDSLIMIT(_timerInfo.temperature, 8, 35);
|
|
|
|
break;
|
2018-12-07 04:18:24 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-08 01:39:41 +00:00
|
|
|
|
|
|
|
void
|
2019-01-18 07:09:40 +00:00
|
|
|
CSetTimerScreen::_printEnabledTimers()
|
2018-12-08 01:39:41 +00:00
|
|
|
{
|
2019-07-28 01:37:39 +00:00
|
|
|
const int dayWidth = 10;
|
|
|
|
int xPos = border;
|
2020-03-29 02:59:13 +00:00
|
|
|
int yPos = 28;
|
2018-12-08 01:39:41 +00:00
|
|
|
|
2019-02-14 10:20:15 +00:00
|
|
|
if(_timerInfo.enabled == 0x00 && _rowSel != 2) {
|
2019-07-28 01:37:39 +00:00
|
|
|
_printMenuText(xPos, yPos, "Disabled", _colSel==4);
|
2018-12-08 01:39:41 +00:00
|
|
|
}
|
2019-02-14 10:20:15 +00:00
|
|
|
else if(_timerInfo.enabled & 0x80) {
|
2018-12-08 01:39:41 +00:00
|
|
|
if(_rowSel==1 && _colSel==4)
|
2019-07-28 01:37:39 +00:00
|
|
|
_printMenuText(xPos, yPos, "Enabled", true);
|
2018-12-08 01:39:41 +00:00
|
|
|
else
|
2019-07-28 01:37:39 +00:00
|
|
|
_printInverted(xPos, yPos, "Enabled", true);
|
2018-12-08 01:39:41 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(_rowSel==1 && _colSel==4) {
|
2019-03-17 07:10:01 +00:00
|
|
|
CRect extents;
|
|
|
|
extents.width = 7 * dayWidth + 2;
|
2019-07-28 01:37:39 +00:00
|
|
|
extents.height = 11;
|
|
|
|
extents.xPos = border;
|
|
|
|
extents.yPos = yPos-2;
|
2019-03-17 07:10:01 +00:00
|
|
|
extents.Expand(border);
|
|
|
|
_display.drawRoundRect(extents.xPos, extents.yPos, extents.width, extents.height, radius, WHITE);
|
2018-12-08 01:39:41 +00:00
|
|
|
}
|
2019-07-28 01:37:39 +00:00
|
|
|
xPos = border+3; // back step 7 day entries
|
2019-03-17 07:10:01 +00:00
|
|
|
int xSel = xPos + _colSel * dayWidth; // note location of selection now (xPos gets changed)
|
|
|
|
// print days, inverse if enabled
|
|
|
|
for(int i=0; i<7; i++) {
|
|
|
|
int dayMask = 0x01 << i;
|
2019-07-28 01:37:39 +00:00
|
|
|
if(_timerInfo.enabled & dayMask) {
|
|
|
|
_display.fillRect(xPos-2, yPos-2, 9, 11, WHITE);
|
|
|
|
}
|
2019-03-17 07:10:01 +00:00
|
|
|
_printInverted(xPos, yPos, briefDOW[i], _timerInfo.enabled & dayMask);
|
2019-07-28 01:37:39 +00:00
|
|
|
_display.drawPixel(xPos-2, yPos-2, BLACK);
|
|
|
|
_display.drawPixel(xPos-2, yPos+8, BLACK);
|
|
|
|
_display.drawPixel(xPos+6, yPos-2, BLACK);
|
|
|
|
_display.drawPixel(xPos+6, yPos+8, BLACK);
|
2019-03-17 07:10:01 +00:00
|
|
|
xPos += dayWidth;
|
|
|
|
}
|
|
|
|
// draw selection loop afterwards - writing text otherwise obliterates it
|
|
|
|
if(_rowSel==2) {
|
|
|
|
CRect extents;
|
2019-07-28 01:37:39 +00:00
|
|
|
extents.xPos = xSel-1-border;
|
|
|
|
extents.yPos = yPos-1-border;
|
|
|
|
extents.width = 13;
|
|
|
|
extents.height = 15;
|
|
|
|
_display.drawRoundRect(extents.xPos, extents.yPos, extents.width, extents.height, 3, WHITE);
|
2018-12-08 01:39:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-27 23:07:29 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
CSetTimerScreen::_showConflict(const char* str)
|
|
|
|
{
|
|
|
|
CTransientFont AF(_display, &arial_8ptBoldFontInfo);
|
|
|
|
_display.fillRect(19, 22, 90, 36, WHITE);
|
|
|
|
_printInverted(_display.xCentre(), 39, str, true, eCentreJustify);
|
|
|
|
_printInverted(_display.xCentre(), 28, "Conflicts", true, eCentreJustify);
|
|
|
|
}
|
|
|
|
|