/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-18 18:29:50 UTC
  • Revision ID: tim@ed.am-20120518182950-t85bn9a21n72uzm8
text messages are now individually enabled and draw()n automatically

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
        {
35
35
        case 0: {
36
36
                        PString str0( Text::_messages[ 0 ], MESSAGE_LEN * 4 );
 
37
                        str0.begin();
37
38
                        str0.format(
38
39
                                        "Propeller Clock mk.1   ...   "
39
40
                                        "Created by Tim and Dan Marston in 2012   ...   "
44
45
        case 1: {
45
46
                        PString str0( Text::_messages[ 0 ], MESSAGE_LEN );
46
47
                        PString str1( Text::_messages[ 1 ], MESSAGE_LEN );
 
48
                        str0.begin();
 
49
                        str1.begin();
47
50
                        str0.format( "RPM" );
48
51
                        unsigned long millis = ::millis();
49
52
                        str1.format( "%ld",
53
56
                        Text::set_message_text( 1, str1 );
54
57
                }
55
58
                break;
56
 
        case 2: {
57
 
                        PString str0( Text::_messages[ 0 ], MESSAGE_LEN );
58
 
                        PString str1( Text::_messages[ 1 ], MESSAGE_LEN );
59
 
                        str0.format( "FPS" );
60
 
                        unsigned long millis = ::millis();
61
 
                        str1.format( "%ld",
62
 
                                        (unsigned long)1000 / ( millis - _millis_last ) );
63
 
                        _millis_last = millis;
64
 
                        Text::set_message_text( 0, str0 );
65
 
                        Text::set_message_text( 1, str1 );
66
 
                }
67
 
                break;
68
59
        }
69
60
}
70
61
 
80
71
 
81
72
void InfoMode::press()
82
73
{
83
 
        if( ++_flavour >= 3 )
 
74
        if( ++_flavour >= 2 )
84
75
                _flavour = 0;
85
76
 
86
77
        reset_messages();
97
88
                Text::set_up_message( 0, Text::MODE_TOP | Text::MODE_THREEQUARTERS |
98
89
                                Text::MODE_HSCROLL, Text::SCALE_SMALL );
99
90
                break;
100
 
        case 1: // fall through
101
 
        case 2:
 
91
        case 1:
102
92
                Text::set_up_message( 0, Text::MODE_TOP | Text::MODE_HALF,
103
93
                                Text::SCALE_FAT );
104
94
                Text::set_up_message( 1, Text::MODE_BOTTOM | Text::MODE_HALF,