/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/modes/digital_clock.cc

  • Committer: Tim Marston
  • Date: 2012-05-09 21:36:01 UTC
  • Revision ID: tim@ed.am-20120509213601-kk1tqa9yg4xk45y9
added info mode, a '/' to the fonts and cleaned up a couple of bits

Show diffs side-by-side

added added

removed removed

28
28
#include "Arduino.h"
29
29
 
30
30
 
31
 
// font flavour
 
31
// display flavour
32
32
static int _flavour = 0;
33
33
 
34
34
 
37
37
        switch( _flavour )
38
38
        {
39
39
        case 0:
40
 
                Text::reset_message( 0, Text::MODE_TOP + Text::MODE_ALL );
41
 
                Text::reset_message( 1, Text::MODE_BOTTOM + Text::MODE_ONEQUARTER );
 
40
                Text::reset_message( 0, Text::MODE_TOP | Text::MODE_ALL );
 
41
                Text::reset_message( 1, Text::MODE_BOTTOM | Text::MODE_ONEQUARTER );
42
42
                break;
43
43
        case 1:
44
44
                Text::reset_message( 0, Text::MODE_HSCROLL | Text::MODE_TOP |
45
45
                                Text::MODE_THREEQUARTERS );
46
 
                Text::reset_message( 1, Text::MODE_BOTTOM + Text::MODE_ONEQUARTER );
 
46
                Text::reset_message( 1, Text::MODE_BOTTOM | Text::MODE_ONEQUARTER );
47
47
                break;
48
48
        }
49
49
}
75
75
 
76
76
        switch( _flavour )
77
77
        {
78
 
        case 0: {
79
 
                        char colon = ::millis() % 1000 < 500? ':' : ' ';
80
 
                        str0.format( "%d%c%02d %s", Time::get_hours() % 12,
81
 
                                        ::millis() % 1000 < 500? ':' : '.',
82
 
                                        Time::get_minutes(),
83
 
                                        Time::get_hours() >= 12? "pm" : "am" );
84
 
                }
 
78
        case 0:
 
79
                str0.format( "%d%c%02d %s", Time::get_hours() % 12,
 
80
                        ::millis() % 1000 < 500? ':' : '.',
 
81
                        Time::get_minutes(),
 
82
                        Time::get_hours() >= 12? "pm" : "am" );
85
83
                str1.print( "- -" );
86
84
                break;
87
85
        case 1:
88
86
                str0.format( "%d%s %s, %d", Time::get_day(),
89
87
                                Time::get_day_suffix(),
90
88
                                Time::get_month_name(), Time::get_year() );
91
 
                Text::set_message( 1, str1 );
92
89
                break;
93
90
        }
94
91