Fix screen stack popping and add a menu

This commit is contained in:
2019-06-26 09:07:34 -07:00
parent 5cfa22c650
commit e0b49ba109
9 changed files with 269 additions and 38 deletions

View File

@@ -22,16 +22,13 @@
#include "DisplayTimeScreen.h"
#include "RtcDriver.h"
#include "SystemTime.h"
#include "SystemFonts.h"
#include "font-notomono-29.h"
#include "font-notomono-68.h"
using Common::ReturnCode;
using Common::Time;
using Common::Schedule::NextTime;
static const struct font &font = font_notomono_68;
DisplayTimeScreen::DisplayTimeScreen(BSP::DisplayDriver &driver,
ScreenManager &manager,
Screen &menu_screen)
@@ -52,12 +49,6 @@ static char get_char_for_digit(uint8_t bcd_digit)
ReturnCode DisplayTimeScreen::init()
{
SET_TO(GPIOA->MODER, GPIO_MODER_MODE0, 1u << GPIO_MODER_MODE1_Pos);
GPIOA->OTYPER &= ~GPIO_OTYPER_OT_1;
GPIOA->PUPDR &= ~GPIO_PUPDR_PUPD1;
GPIOA->PUPDR |= 2u << GPIO_PUPDR_PUPD1_Pos;
return ReturnCode::OK;
}
@@ -76,14 +67,12 @@ void DisplayTimeScreen::display_time()
{
Common::WallClockTime time;
BSP::RtcDriver::get_time(time);
// FIXME: Don't clear every redraw. Something is broken on screen
// switching. enable/disable not called?
m_driver.clear();
const struct font &font = large_font;
const uint32_t font_width = large_font_width;
const uint32_t y_space = (m_driver.get_height() - (2 * font.size)) / 3;
const uint32_t x_space = (m_driver.get_width() - (2 * font_width)) / 2;
uint32_t x = 0;
const uint32_t y_space = (m_driver.get_height() - (2 * font.size)) / 3;
const uint32_t x_space = (m_driver.get_width() - (2 * 54)) / 2;
if (m_last_time.get_hours_24() != time.get_hours_24()) {
x = x_space;