/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/info_mode.cc

  • Committer: Tim Marston
  • Date: 2012-05-17 19:17:05 UTC
  • Revision ID: tim@ed.am-20120517191705-3d28d50tw8w51v7g
removed 5V regulator from scematic and replaced the connection to the regulator
on the Arduino -- ecause that's what we should be using and out seperate
regulator is only working around a fault in out arduino

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
// display flavour
31
31
static int _flavour = 0;
32
32
 
33
 
// previous millis
34
 
static unsigned long _millis_last = 0;
35
 
 
36
33
 
37
34
static void reset_messages()
38
35
{
39
36
        switch( _flavour )
40
37
        {
41
38
        case 0:
42
 
                Text::reset_message( 0, Text::MODE_TOP | Text::MODE_THREEQUARTERS |
43
 
                                Text::MODE_HSCROLL, Text::SCALE_SMALL );
 
39
                Text::reset_message( 0, Text::MODE_TOP | Text::MODE_THREEQUARTERS );
44
40
                break;
45
41
        case 1:
46
 
                Text::reset_message( 0, Text::MODE_TOP | Text::MODE_HALF,
47
 
                                Text::SCALE_FAT );
48
 
                Text::reset_message( 1, Text::MODE_BOTTOM | Text::MODE_HALF,
49
 
                                Text::SCALE_FAT );
 
42
                Text::reset_message( 0, Text::MODE_TOP | Text::MODE_HALF );
 
43
                Text::reset_message( 1, Text::MODE_BOTTOM | Text::MODE_HALF );
50
44
                break;
51
45
        }
52
46
}
72
66
 
73
67
void info_mode_draw_reset()
74
68
{
 
69
        PString str0( Text::_messages[ 0 ], MESSAGE_LEN );
 
70
        PString str1( Text::_messages[ 1 ], MESSAGE_LEN );
 
71
        str0.begin();
 
72
        str1.begin();
 
73
 
75
74
        switch( _flavour )
76
75
        {
77
 
        case 0: {
78
 
                        PString str0( Text::_messages[ 0 ], MESSAGE_LEN * 4 );
79
 
                        str0.begin();
80
 
                        str0.format(
81
 
                                        "Propeller Clock mk.1   ...   "
82
 
                                        "Created by Tim and Dan Marston in 2011   ...   "
83
 
                                        "http://ed.am/dev/elec/propeller-clock" );
84
 
                        Text::set_message( 0, str0 );
85
 
                }
 
76
        case 0:
 
77
                str0.format(
 
78
                        "Propeller Clock mk.1   ...   "
 
79
                        "Created by Tim and Dan Marston in 2011   ...   "
 
80
                        "http://ed.am/dev/elec/propeller-clock" );
86
81
                break;
87
 
        case 1: {
88
 
                        PString str0( Text::_messages[ 0 ], MESSAGE_LEN );
89
 
                        PString str1( Text::_messages[ 1 ], MESSAGE_LEN );
90
 
                        str0.begin();
91
 
                        str1.begin();
92
 
                        str0.format( "RPM" );
93
 
                        unsigned long millis = ::millis();
94
 
                        str1.format( "%ld",
95
 
                                        (unsigned long)60 * 1000 / ( millis - _millis_last ) );
96
 
                        _millis_last = millis;
97
 
                        Text::set_message( 0, str0 );
98
 
                        Text::set_message( 1, str1 );
99
 
                }
 
82
        case 1:
 
83
                str0.format( "RPM" );
 
84
                str1.format( "%d", 123 );
100
85
                break;
101
86
        }
 
87
 
 
88
        Text::set_message( 0, str0 );
 
89
        Text::set_message( 1, str1 );
102
90
}
103
91
 
104
92
 
105
93
void info_mode_activate()
106
94
{
107
95
        _flavour = 0;
108
 
        _millis_last = ::millis();
109
96
 
110
97
        // reset messages
111
98
        reset_messages();