/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/text.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:
39
39
// mode-specific message parameters
40
40
static signed long _message_params[ NUM_MESSAGE_BUFFERS ];
41
41
 
 
42
// text scaling factors
 
43
static int _message_scale[ NUM_MESSAGE_BUFFERS ];
 
44
 
42
45
// time last frame
43
46
static unsigned long _last_millis;
44
47
 
90
93
                        _message_params[ message_num ] = NUM_SEGMENTS; break;
91
94
                }
92
95
                _message_params[ message_num ] = -( _message_params[ message_num ] -
93
 
                        TextRenderer::get_width( _message_lens[ message_num ] ) ) / 2;
 
96
                        TextRenderer::get_width( _message_lens[ message_num ],
 
97
                                        _message_scale[ message_num ] ) ) / 2;
94
98
        }
95
99
}
96
100
 
102
106
}
103
107
 
104
108
 
105
 
void Text::reset_message( int message_num, char mode )
 
109
void Text::reset_message( int message_num, char mode, int scale )
106
110
{
107
111
        _message_modes[ message_num ] = mode;
108
112
        _message_recalc_flags |= 1 << message_num;
 
113
        _message_scale[ message_num ] = scale;
109
114
}
110
115
 
111
116
 
153
158
                        _message_params[ message_num ] +=
154
159
                                _duration * TEXT_SCROLL_SPEED / 1000;
155
160
                        long excess = _message_params[ message_num ] -
156
 
                                TextRenderer::get_width( _message_lens[ message_num ] );
 
161
                                TextRenderer::get_width( _message_lens[ message_num ],
 
162
                                                _message_scale[ message_num ] );
157
163
                        if( excess >= 0 ) {
158
164
                                reset_message_param( message_num );
159
165
                                _message_params[ message_num ] += excess;
211
217
        TextRenderer::render(
212
218
                _messages[ message_num ], _message_lens[ message_num ],
213
219
                (long)segment + _message_params[ message_num ],
214
 
                ( _message_modes[ message_num ] & 1 ) == 0, 0 );
 
220
                ( _message_modes[ message_num ] & 1 ) == 0, 0,
 
221
                _message_scale[ message_num ] );
215
222
}