Fix screen stack popping and add a menu
This commit is contained in:
@@ -22,16 +22,13 @@
|
||||
|
||||
#include "SetTimeScreen.h"
|
||||
#include "SystemTime.h"
|
||||
#include "SystemFonts.h"
|
||||
#include "RtcDriver.h"
|
||||
|
||||
#include "font-notomono-29.h"
|
||||
|
||||
using Common::ReturnCode;
|
||||
using Common::Time;
|
||||
using Common::Schedule::NextTime;
|
||||
|
||||
static const font &font = font_notomono_29;
|
||||
|
||||
SetTimeScreen::SetTimeScreen(BSP::DisplayDriver &display,
|
||||
ScreenManager &manager)
|
||||
: m_display(display)
|
||||
@@ -77,15 +74,20 @@ void SetTimeScreen::render_time()
|
||||
{
|
||||
uint32_t x = 0;
|
||||
uint32_t y = 32;
|
||||
const struct font &font = default_font;
|
||||
|
||||
display_number(&x, y,
|
||||
m_time.get_hours_12_tens(), m_time.get_hours_12_ones(),
|
||||
font);
|
||||
|
||||
m_display.string_at(&x, y, ":", &font);
|
||||
|
||||
display_number(&x, y,
|
||||
m_time.get_minutes_tens(), m_time.get_minutes_ones(),
|
||||
font);
|
||||
|
||||
m_display.string_at(&x, y, ":", &font);
|
||||
|
||||
display_number(&x, y,
|
||||
m_time.get_seconds_tens(), m_time.get_seconds_ones(),
|
||||
font);
|
||||
@@ -103,15 +105,17 @@ void SetTimeScreen::draw_line(uint32_t x, uint32_t y, uint32_t width)
|
||||
|
||||
void SetTimeScreen::render_selection()
|
||||
{
|
||||
uint32_t font_width = default_font_width;
|
||||
|
||||
switch (m_state) {
|
||||
case SetState::HOURS:
|
||||
draw_line(0, 64, 24 * 2);
|
||||
draw_line(0, 64, font_width * 2);
|
||||
break;
|
||||
case SetState::MINUTES:
|
||||
draw_line(48, 64, 24 * 2);
|
||||
draw_line(font_width * 2, 64, font_width * 2);
|
||||
break;
|
||||
case SetState::SECONDS:
|
||||
draw_line(96, 64, 24 * 2);
|
||||
draw_line(font_width * 4, 64, font_width * 2);
|
||||
break;
|
||||
case SetState::AM_PM:
|
||||
break;
|
||||
@@ -132,7 +136,6 @@ void SetTimeScreen::refresh()
|
||||
|
||||
void SetTimeScreen::enable()
|
||||
{
|
||||
|
||||
BSP::RtcDriver::get_time(m_time);
|
||||
m_state = SetState::HOURS;
|
||||
m_is_acked = true;
|
||||
@@ -189,7 +192,7 @@ void SetTimeScreen::notify_middle_button()
|
||||
BSP::RtcDriver::set_time(m_time);
|
||||
}
|
||||
m_manager.pop_screen();
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
refresh();
|
||||
|
||||
Reference in New Issue
Block a user