/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 22:49:36 UTC
  • Revision ID: tim@ed.am-20120517224936-0wgyem932dlq5bs4
various tweaks, a (failed) attempt to fix text reset bug and added TODO

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "Arduino.h"
28
28
 
29
29
 
30
 
void InfoMode::draw( int segment )
 
30
// display flavour
 
31
static int _flavour = 0;
 
32
 
 
33
// previous millis
 
34
static unsigned long _millis_last = 0;
 
35
 
 
36
 
 
37
static void reset_messages()
 
38
{
 
39
        switch( _flavour )
 
40
        {
 
41
        case 0:
 
42
                Text::reset_message( 0, Text::MODE_TOP | Text::MODE_THREEQUARTERS |
 
43
                                Text::MODE_HSCROLL, Text::SCALE_SMALL );
 
44
                break;
 
45
        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 );
 
50
                break;
 
51
        }
 
52
}
 
53
 
 
54
 
 
55
void info_mode_press()
 
56
{
 
57
        if( ++_flavour >= 2 )
 
58
                _flavour = 0;
 
59
 
 
60
        // reset messages
 
61
        reset_messages();
 
62
}
 
63
 
 
64
 
 
65
void info_mode_draw( int segment )
31
66
{
32
67
        Text::draw( 0, segment );
33
68
        if( _flavour == 1 )
35
70
}
36
71
 
37
72
 
38
 
void InfoMode::draw_reset()
 
73
void info_mode_draw_reset()
39
74
{
40
75
        switch( _flavour )
41
76
        {
44
79
                        str0.begin();
45
80
                        str0.format(
46
81
                                        "Propeller Clock mk.1   ...   "
47
 
                                        "Created by Tim and Dan Marston in 2012   ...   "
 
82
                                        "Created by Tim and Dan Marston in 2011   ...   "
48
83
                                        "http://ed.am/dev/elec/propeller-clock" );
49
84
                        Text::set_message( 0, str0 );
50
85
                }
67
102
}
68
103
 
69
104
 
70
 
void InfoMode::activate()
 
105
void info_mode_activate()
71
106
{
72
107
        _flavour = 0;
73
108
        _millis_last = ::millis();
74
109
 
75
 
        reset_messages();
76
 
}
77
 
 
78
 
 
79
 
void InfoMode::press()
80
 
{
81
 
        if( ++_flavour >= 2 )
82
 
                _flavour = 0;
83
 
 
84
 
        reset_messages();
85
 
}
86
 
 
87
 
 
88
 
void InfoMode::reset_messages()
89
 
{
90
 
        switch( _flavour )
91
 
        {
92
 
        case 0:
93
 
                Text::reset_message( 0, Text::MODE_TOP | Text::MODE_THREEQUARTERS |
94
 
                                Text::MODE_HSCROLL, Text::SCALE_SMALL );
95
 
                break;
96
 
        case 1:
97
 
                Text::reset_message( 0, Text::MODE_TOP | Text::MODE_HALF,
98
 
                                Text::SCALE_FAT );
99
 
                Text::reset_message( 1, Text::MODE_BOTTOM | Text::MODE_HALF,
100
 
                                Text::SCALE_FAT );
101
 
                break;
102
 
        }
 
110
        // reset messages
 
111
        reset_messages();
103
112
}