Tidied up timer setup screen

OTA uploads now have a bar graph!
This commit is contained in:
Ray Jones 2019-07-28 11:37:39 +10:00
parent 6c21a9c6a6
commit f154580eb2
4 changed files with 50 additions and 36 deletions

View File

@ -200,7 +200,7 @@ CScreen::_showStoringMessage()
{
_display.writeFillRect(34, 19, 60, 26, WHITE);
CTransientFont AF(_display, &arial_8ptBoldFontInfo);
_printInverted(_display.xCentre(), 25, " STORING ", true, eCentreJustify);
_printInverted(_display.xCentre(), 27, " STORING ", true, eCentreJustify);
}

View File

@ -51,6 +51,7 @@
#include "fonts/MiniFont.h"
#include "fonts/MidiFont.h"
#include "../Protocol/Protocol.h"
#include "fonts/Arial.h"
////////////////////////////////////////////////////////////////////////////////////////////////
@ -590,18 +591,25 @@ CScreenManager::showOTAMessage(int percent, eOTAmodes updateType)
{
static int prevPercent = -1;
if(percent != prevPercent/* && tDelta > 500*/) {
if(percent != prevPercent) {
_pDisplay->clearDisplay();
_pDisplay->setFontInfo(&arial_8ptBoldFontInfo);
_pDisplay->setCursor(64, -1);
_pDisplay->printCentreJustified("Firmware update");
_pDisplay->setFontInfo(NULL);
_pDisplay->drawFastHLine(0, 10, 128, WHITE);
_pDisplay->setCursor(64,22);
switch(updateType) {
case eOTAnormal: _pDisplay->printCentreJustified("OTA update active"); break;
case eOTAbrowser: _pDisplay->printCentreJustified("Browser update active"); break;
case eOTAWWW: _pDisplay->printCentreJustified("WWW update active"); break;
case eOTAnormal: _pDisplay->printCentreJustified("OTA upload"); break;
case eOTAbrowser: _pDisplay->printCentreJustified("Browser upload"); break;
case eOTAWWW: _pDisplay->printCentreJustified("Web download"); break;
}
if(percent) {
_pDisplay->drawRect(14, 32, 100, 8, WHITE);
_pDisplay->fillRect(14, 32, percent, 8, WHITE);
char msg[16];
sprintf(msg, "%d%%", percent);
_pDisplay->setCursor(64,32);
_pDisplay->setCursor(64,42);
_pDisplay->printCentreJustified(msg);
}
prevPercent = percent;

View File

@ -94,9 +94,9 @@ CSetTimerScreen::show()
else {
// start
xPos = 18;
yPos = 28;
yPos = 18;
_printMenuText(xPos, yPos, "On", false, eRightJustify);
_printMenuText(xPos+18, yPos, ":");
_printMenuText(xPos+17, yPos, ":");
xPos += 6;
sprintf(str, "%02d", _timerInfo.start.hour);
_printMenuText(xPos, yPos, str, _rowSel==1 && _colSel==0);
@ -105,10 +105,10 @@ CSetTimerScreen::show()
_printMenuText(xPos, yPos, str, _rowSel==1 && _colSel==1);
// stop
xPos = 18;
yPos = 41;
xPos = 82;
yPos = 18;
_printMenuText(xPos, yPos, "Off", false, eRightJustify);
_printMenuText(xPos+18, yPos, ":");
_printMenuText(xPos+17, yPos, ":");
xPos += 6;
sprintf(str, "%02d", _timerInfo.stop.hour);
_printMenuText(xPos, yPos, str, _rowSel==1 && _colSel==2);
@ -118,18 +118,15 @@ CSetTimerScreen::show()
// control
const char* msg;
xPos = _display.width() - border;
_printEnabledTimers();
yPos = 41;
xPos = _display.width() - border;
yPos = 35;
if(_timerInfo.repeat)
msg = "Repeat";
else
msg = "Once";
if(_rowSel == 1)
_printMenuText(xPos, yPos, msg, _colSel==5, eRightJustify);
else
_printInverted(xPos, yPos, msg, _timerInfo.repeat, eRightJustify);
_printMenuText(xPos, yPos, msg, _rowSel==1 && _colSel==5, eRightJustify);
// navigation line
yPos = 53;
@ -345,43 +342,52 @@ CSetTimerScreen::_adjust(int dir)
void
CSetTimerScreen::_printEnabledTimers()
{
const int dayWidth = 8;
int xPos = _display.width() - border;
int yPos = 28;
const int dayWidth = 10;
int xPos = border;
int yPos = 35;
if(_timerInfo.enabled == 0x00 && _rowSel != 2) {
_printMenuText(xPos, yPos, "Disabled", _colSel==4, eRightJustify);
_printMenuText(xPos, yPos, "Disabled", _colSel==4);
}
else if(_timerInfo.enabled & 0x80) {
if(_rowSel==1 && _colSel==4)
_printMenuText(xPos, yPos, "Enabled", true, eRightJustify);
_printMenuText(xPos, yPos, "Enabled", true);
else
_printInverted(xPos, yPos, "Enabled", true, eRightJustify);
_printInverted(xPos, yPos, "Enabled", true);
}
else {
if(_rowSel==1 && _colSel==4) {
CRect extents;
extents.width = 7 * dayWidth + 2;
extents.height = 8;
extents.xPos = xPos - extents.width;
extents.yPos = yPos;
extents.height = 11;
extents.xPos = border;
extents.yPos = yPos-2;
extents.Expand(border);
_display.drawRoundRect(extents.xPos, extents.yPos, extents.width, extents.height, radius, WHITE);
}
xPos -= 7 * dayWidth; // back step 7 day entries
xPos = border+3; // back step 7 day entries
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;
if(_timerInfo.enabled & dayMask) {
_display.fillRect(xPos-2, yPos-2, 9, 11, WHITE);
}
_printInverted(xPos, yPos, briefDOW[i], _timerInfo.enabled & dayMask);
_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);
xPos += dayWidth;
}
// draw selection loop afterwards - writing text otherwise obliterates it
if(_rowSel==2) {
CRect extents;
extents.xPos = xSel;
extents.yPos = yPos;
_drawMenuSelection(extents, briefDOW[_colSel]);
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);
}
}
}

View File

@ -3322,12 +3322,12 @@ const uint8_t PROGMEM arialBlack_12ptBitmaps [] =
// @162 '-' (8 pixels wide)
0x00, 0x00,
0x03, 0xC0, // ###
0x03, 0xC0, // ###
0x03, 0xC0, // ###
0x03, 0xC0, // ###
0x03, 0xC0, // ###
0x03, 0xC0, // ###
0x01, 0x80, // ##
0x03, 0xC0, // ####
0x03, 0xC0, // ####
0x03, 0xC0, // ####
0x03, 0xC0, // ####
0x01, 0x80, // ##
0x00, 0x00,
// @178 ' ' (3 pixels wide)