21
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
23
#include "Arduino.h"
24
#include "settings_mode.h"
24
#include "settings_major_mode.h"
26
26
#include "text_renderer.h"
28
28
#include "common.h"
31
#define TIME_SET_IDX 0
32
#define DATE_SET_IDX 1
33
#define FONT_SET_IDX 2
41
void settings_mode_press()
31
#define FONT_SET_IDX 0
32
#define TIME_SET_IDX 1
33
#define DATE_SET_IDX 2
36
void SettingsMajorMode::draw( int segment )
38
Text::draw( 0, segment );
42
void SettingsMajorMode::draw_reset()
44
bool flash = ( ::millis() % 1000 ) > 600;
45
PString str0( Text::_messages[ 0 ], MESSAGE_LEN * 2 );
50
if( _part == 0 && flash )
51
str0.print( ( Time::get_hours() % 12 ) < 10? " " : " " );
53
str0.format( "%d", Time::get_hours() % 12 );
55
if( _part == 1 && flash )
58
str0.format( "%02d", Time::get_minutes() );
60
if( _part == 2 && flash )
63
str0.format( "%02d", Time::get_seconds() );
65
if( _part == 0 && flash )
68
str0.print( Time::get_hours() > 11? "pm" : "am" );
72
if( _part == 0 && flash )
75
str0.format( "%04d", Time::get_year() );
77
if( _part == 1 && flash )
80
str0.format( "%02d", Time::get_month() );
82
if( _part == 2 && flash )
85
str0.format( "%02d", Time::get_day() );
89
str0.print( "font " );
93
str0.format( "%d", TextRenderer::get_font() );
97
Text::set_message( 0, str0 );
101
void SettingsMajorMode::activate()
109
void SettingsMajorMode::deactivate()
114
void SettingsMajorMode::press()
47
120
case 0: Time::inc_hours(); break;
48
121
case 1: Time::inc_minutes(); break;
66
static void reset_messages()
68
Text::reset_message( 0, Text::MODE_TOP | Text::MODE_ALL );
72
void settings_mode_long_press()
139
void SettingsMajorMode::long_press()
74
141
// how many parts does this item have?
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()
159
void SettingsMajorMode::reset_messages()
161
Text::reset_message( 0, Text::MODE_TOP | Text::MODE_ALL );