/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-23 23:02:50 UTC
  • Revision ID: tim@ed.am-20120523230250-3pls2u6zt3av0uam
fixed text glitch; extended all modes; added screen flip super-long press;
added button unpress debounde; moved interim button press ignoration to
settings mode; fixed left-over led issue; finished for demo!

Show diffs side-by-side

added added

removed removed

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