4
* Copyright (C) 2011 Tim Marston <tim@ed.am> and Dan Marston.
6
* This file is part of propeller-clock (hereafter referred to as "this
7
* program"). See http://ed.am/dev/software/arduino/propeller-clock for more
10
* This program is free software: you can redistribute it and/or modify
11
* it under the terms of the GNU Lesser General Public License as published
12
* by the Free Software Foundation, either version 3 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Lesser General Public License for more details.
20
* You should have received a copy of the GNU Lesser General Public License
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24
#include "settings_mode.h"
26
#include "text_renderer.h"
31
#define TIME_SET_IDX 0
32
#define DATE_SET_IDX 1
33
#define FONT_SET_IDX 2
41
void settings_mode_press()
47
case 0: Time::inc_hours(); break;
48
case 1: Time::inc_minutes(); break;
49
case 2: Time::reset_seconds(); break;
54
case 0: Time::inc_year(); break;
55
case 1: Time::inc_month(); break;
56
case 2: Time::inc_day(); break;
60
TextRenderer::inc_font();
66
static void reset_messages()
68
Text::reset_message( 0, Text::MODE_TOP | Text::MODE_ALL );
72
void settings_mode_long_press()
74
// how many parts does this item have?
77
case DATE_SET_IDX: // fall through
78
case TIME_SET_IDX: max = 3; break;
82
if( ++_part >= max ) {
93
void settings_mode_draw( int segment )
95
Text::draw( 0, segment );
99
void settings_mode_draw_reset()
101
bool flash = ( ::millis() % 1000 ) > 600;
102
PString str0( Text::_messages[ 0 ], MESSAGE_LEN * 2 );
107
if( _part == 0 && flash )
110
str0.format( "%2d", Time::get_hours() % 12 );
112
if( _part == 1 && flash )
115
str0.format( "%02d", Time::get_minutes() );
117
if( _part == 2 && flash )
120
str0.format( "%02d", Time::get_seconds() );
121
if( _part == 0 && flash )
124
str0.print( Time::get_hours() > 11? "pm" : "am" );
128
if( _part == 0 && flash )
131
str0.format( "%04d", Time::get_year() );
133
if( _part == 1 && flash )
136
str0.format( "%02d", Time::get_month() );
138
if( _part == 2 && flash )
141
str0.format( "%02d", Time::get_day() );
145
str0.print( "font " );
149
str0.format( "%d", TextRenderer::get_font() );
153
Text::set_message( 0, str0 );
157
void settings_mode_activate()